Back to

Package gpmiddleware

Latest Go to latest

The latest major version is .

Published: Feb 19, 2020 | License: MIT | Module:


type Prometheus

type Prometheus struct {
	MetricsPath string
	// contains filtered or unexported fields

Prometheus contains the metrics gathered by the instance and its path

func NewPrometheus

func NewPrometheus(subsystem string) *Prometheus

NewPrometheus generates a new set of metrics with a certain subsystem name

func (*Prometheus) HandlerFunc

func (p *Prometheus) HandlerFunc() gin.HandlerFunc

HandlerFunc defines handler function for middleware

func (*Prometheus) SetListenAddress

func (p *Prometheus) SetListenAddress(address string)

SetListenAddress for exposing metrics on address. If not set, it will be exposed at the same address of the gin engine that is being used

func (*Prometheus) SetListenAddressWithRouter

func (p *Prometheus) SetListenAddressWithRouter(listenAddress string, r *gin.Engine)

SetListenAddressWithRouter for using a separate router to expose metrics. (this keeps things like GET /metrics out of your content's access log).

func (*Prometheus) SetMetricsPath

func (p *Prometheus) SetMetricsPath(e *gin.Engine)

SetMetricsPath set metrics paths

func (*Prometheus) Use

func (p *Prometheus) Use(e *gin.Engine)

Use adds the middleware to a gin engine with /metrics route path.

func (*Prometheus) UseCustom

func (p *Prometheus) UseCustom(e *gin.Engine)

UseCustom adds the middleware to a gin engine with a custom route path.

type RequestCounterURLLabelMappingFn

type RequestCounterURLLabelMappingFn func(c *gin.Context) string

RequestCounterURLLabelMappingFn url label

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier