middleware

package
v0.0.0-...-a538606 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2017 License: BSD-2-Clause-Views Imports: 8 Imported by: 0

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()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL