Label HTTP metrics with the chi route pattern (closes #254)
Some checks failed
check / check (push) Superseded by a newer commit; never tested
Some checks failed
check / check (push) Superseded by a newer commit; never tested
This commit was merged in pull request #258.
This commit is contained in:
@@ -4,8 +4,28 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
httpmetrics "github.com/slok/go-http-metrics/metrics"
|
||||
)
|
||||
|
||||
// MetricsMiddlewareForTest builds the metrics recording middleware
|
||||
// against a caller-supplied recorder, so a test can gather from its
|
||||
// own Prometheus registry rather than the process-wide default one
|
||||
// that Middleware.Metrics uses.
|
||||
func MetricsMiddlewareForTest(
|
||||
rec httpmetrics.Recorder,
|
||||
) func(http.Handler) http.Handler {
|
||||
return metricsMiddleware(rec)
|
||||
}
|
||||
|
||||
// UnmatchedRouteConst exposes the sentinel that stands in for a
|
||||
// request matching no route pattern.
|
||||
const UnmatchedRouteConst = unmatchedRoute
|
||||
|
||||
// InflightHandlerConst exposes the fixed handler label on the
|
||||
// inflight gauge.
|
||||
const InflightHandlerConst = inflightHandler
|
||||
|
||||
// NewLoggingResponseWriterForTest wraps newLoggingResponseWriter
|
||||
// for use in external test packages.
|
||||
func NewLoggingResponseWriterForTest(
|
||||
|
||||
Reference in New Issue
Block a user