diff --git a/web/web.go b/web/web.go index f4336cfb2..1945051a0 100644 --- a/web/web.go +++ b/web/web.go @@ -191,6 +191,12 @@ type Options struct { RemoteReadConcurrencyLimit int } +func instrumentHandlerWithPrefix(prefix string) func(handlerName string, handler http.HandlerFunc) http.HandlerFunc { + return func(handlerName string, handler http.HandlerFunc) http.HandlerFunc { + return instrumentHandler(prefix+handlerName, handler) + } +} + func instrumentHandler(handlerName string, handler http.HandlerFunc) http.HandlerFunc { return promhttp.InstrumentHandlerDuration( requestDuration.MustCurryWith(prometheus.Labels{"handler": handlerName}), @@ -459,7 +465,7 @@ func (h *Handler) Run(ctx context.Context) error { mux := http.NewServeMux() mux.Handle("/", h.router) - av1 := route.New().WithInstrumentation(instrumentHandler) + av1 := route.New().WithInstrumentation(instrumentHandlerWithPrefix("/api/v1")) h.apiV1.Register(av1) apiPath := "/api" if h.options.RoutePrefix != "/" {