Documentation ¶
Overview ¶
Package middleware provides a collection of go-chi compatible custom middleware.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestMetrics ¶
func RequestMetrics( service string, registry prometheus.Registerer, buckets ...float64, ) func(next http.Handler) http.Handler
RequestMetrics tracks request counts and latencies partitioned by response code, HTTP method and path.
The provided service should be unique to each tracked service. The registry is optional and will default to a process-level singleton.
Latency buckets, specified by upper bound, may be optionally be provided. If omitted they will be set to the following default values (in milliseconds): []float64{5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000}
For accuracy, buckets should mirror the distribution of the latencies of the service. See https://github.com/danielfm/prometheus-for-developers#quantile-estimation-errors
Types ¶
This section is empty.