Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricMiddleware ¶
type MetricMiddleware struct { // Handler represents the user HTTP handler Handler http.Handler // PrometheusEndpoint is an HTTP endpointn for prometheus PrometheusEndpoint string // RequestPerSecondFunc is a function that runs with updated request/per/second RequestPerSecondFunc func(int64) // Name is an identifier used in prometheus Name string // contains filtered or unexported fields }
MetricMiddleware is a go-http middleware add metrics reporting for the http.Handler. The metrics include standard Go runtime metrics but also total number of requests served by this HTTP server as well as requests per second counter.
func (*MetricMiddleware) ServeHTTP ¶
func (a *MetricMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP wraps the go-http ServerHTTP method with metrics.
func (*MetricMiddleware) StartMetrics ¶
func (a *MetricMiddleware) StartMetrics()
Click to show internal directories.
Click to hide internal directories.