From f197cec7f3a599ca18807e7b7719ef7666cfdb70 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Tue, 22 Sep 2020 22:10:34 -0400 Subject: metrics: Always track method label in uppercase (#3742) * metrics: Always track method label in uppercase Signed-off-by: Dave Henderson * Just use strings.ToUpper for clarity Signed-off-by: Dave Henderson --- admin.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'admin.go') diff --git a/admin.go b/admin.go index 4ce2099..b2eb542 100644 --- a/admin.go +++ b/admin.go @@ -36,7 +36,6 @@ import ( "time" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" "go.uber.org/zap" ) @@ -111,7 +110,7 @@ func (admin AdminConfig) newAdminHandler(addr NetworkAddress) adminHandler { addRouteWithMetrics := func(pattern string, handlerLabel string, h http.Handler) { labels := prometheus.Labels{"path": pattern, "handler": handlerLabel} - h = promhttp.InstrumentHandlerCounter( + h = instrumentHandlerCounter( adminMetrics.requestCount.MustCurryWith(labels), h, ) @@ -126,7 +125,7 @@ func (admin AdminConfig) newAdminHandler(addr NetworkAddress) adminHandler { labels := prometheus.Labels{ "path": pattern, "handler": handlerLabel, - "method": r.Method, + "method": strings.ToUpper(r.Method), } adminMetrics.requestErrors.With(labels).Inc() } -- cgit v1.2.3