Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMissingRegistry = errors.New("missing registry")
When the registry is not passed in the Opts
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct { // A prometheus registry Registry *prometheus.Registry // Buckets specifies an custom buckets to be used in request histograpm. Buckets []float64 // Labels specifies the label names that will be used Labels []string }
Opts specifies options how to create new PrometheusMiddleware.
type PromMiddleware ¶
type PromMiddleware struct {
// contains filtered or unexported fields
}
PromMiddleware specifies the metrics that is going to be generated
func New ¶
func New(opts Opts) (*PromMiddleware, error)
New creates a new PrometheusMiddleware instance
func (*PromMiddleware) Handler ¶
func (p *PromMiddleware) Handler() http.Handler
Handler will return the handler for the metrics based on the registry setup.
func (*PromMiddleware) InstrumentHandlerDuration ¶
func (p *PromMiddleware) InstrumentHandlerDuration(next http.Handler) http.Handler
InstrumentHandlerDuration is a middleware that wraps the http.Handler and it record how long the handler took to run, which path was called, and the status code. This method is going to be used with gorilla/mux.
Click to show internal directories.
Click to hide internal directories.