From ab8bf7b7a62d43abd9a8d5213fc3b5855472bd9e Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Mon, 6 Nov 2023 10:14:10 +0800 Subject: [PATCH] mcs: fix duplicated metrics (#7319) close tikv/pd#7290 Signed-off-by: Ryan Leung --- pkg/mcs/resourcemanager/server/apis/v1/api.go | 2 +- pkg/mcs/scheduling/server/apis/v1/api.go | 2 +- pkg/mcs/tso/server/apis/v1/api.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/mcs/resourcemanager/server/apis/v1/api.go b/pkg/mcs/resourcemanager/server/apis/v1/api.go index ffcb9318590..7b5f2903484 100644 --- a/pkg/mcs/resourcemanager/server/apis/v1/api.go +++ b/pkg/mcs/resourcemanager/server/apis/v1/api.go @@ -81,10 +81,10 @@ func NewService(srv *rmserver.Service) *Service { c.Set(multiservicesapi.ServiceContextKey, manager.GetBasicServer()) c.Next() }) - apiHandlerEngine.Use(multiservicesapi.ServiceRedirector()) apiHandlerEngine.GET("metrics", utils.PromHandler()) pprof.Register(apiHandlerEngine) endpoint := apiHandlerEngine.Group(APIPathPrefix) + endpoint.Use(multiservicesapi.ServiceRedirector()) s := &Service{ manager: manager, apiHandlerEngine: apiHandlerEngine, diff --git a/pkg/mcs/scheduling/server/apis/v1/api.go b/pkg/mcs/scheduling/server/apis/v1/api.go index 356dc5a7f42..98fb68c090b 100644 --- a/pkg/mcs/scheduling/server/apis/v1/api.go +++ b/pkg/mcs/scheduling/server/apis/v1/api.go @@ -100,10 +100,10 @@ func NewService(srv *scheserver.Service) *Service { c.Set(handlerKey, handler.NewHandler(&server{srv.Server})) c.Next() }) - apiHandlerEngine.Use(multiservicesapi.ServiceRedirector()) apiHandlerEngine.GET("metrics", mcsutils.PromHandler()) pprof.Register(apiHandlerEngine) root := apiHandlerEngine.Group(APIPathPrefix) + root.Use(multiservicesapi.ServiceRedirector()) s := &Service{ srv: srv, apiHandlerEngine: apiHandlerEngine, diff --git a/pkg/mcs/tso/server/apis/v1/api.go b/pkg/mcs/tso/server/apis/v1/api.go index f1853bf5483..1b8f68778af 100644 --- a/pkg/mcs/tso/server/apis/v1/api.go +++ b/pkg/mcs/tso/server/apis/v1/api.go @@ -89,10 +89,10 @@ func NewService(srv *tsoserver.Service) *Service { c.Set(multiservicesapi.ServiceContextKey, srv) c.Next() }) - apiHandlerEngine.Use(multiservicesapi.ServiceRedirector()) apiHandlerEngine.GET("metrics", utils.PromHandler()) pprof.Register(apiHandlerEngine) root := apiHandlerEngine.Group(APIPathPrefix) + root.Use(multiservicesapi.ServiceRedirector()) s := &Service{ srv: srv, apiHandlerEngine: apiHandlerEngine,