From e9983306d981d3b3c07038d0d448c76f96a1a0ce Mon Sep 17 00:00:00 2001 From: Praveen M Date: Thu, 16 Nov 2023 20:59:13 +0530 Subject: [PATCH] util: remove metrics argument from NewMiddlewareServerOption This commit removes metrics argument from NewMiddlewareServerOption as it always set to false. Signed-off-by: Praveen M --- internal/csi-addons/server/server.go | 2 +- internal/csi-common/server.go | 2 +- internal/csi-common/utils.go | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/csi-addons/server/server.go b/internal/csi-addons/server/server.go index b230eaba628..e5c6310eec3 100644 --- a/internal/csi-addons/server/server.go +++ b/internal/csi-addons/server/server.go @@ -87,7 +87,7 @@ func (cas *CSIAddonsServer) RegisterService(svc CSIAddonsService) { // returned. func (cas *CSIAddonsServer) Start() error { // create the gRPC server and register services - cas.server = grpc.NewServer(csicommon.NewMiddlewareServerOption(false)) + cas.server = grpc.NewServer(csicommon.NewMiddlewareServerOption()) for _, svc := range cas.services { svc.RegisterService(cas.server) diff --git a/internal/csi-common/server.go b/internal/csi-common/server.go index 428473375a6..13157f222fa 100644 --- a/internal/csi-common/server.go +++ b/internal/csi-common/server.go @@ -97,7 +97,7 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, srv Servers) { klog.Fatalf("Failed to listen: %v", err) } - server := grpc.NewServer(NewMiddlewareServerOption(false)) + server := grpc.NewServer(NewMiddlewareServerOption()) s.server = server if srv.IS != nil { diff --git a/internal/csi-common/utils.go b/internal/csi-common/utils.go index 09049f1fc21..03323af04ce 100644 --- a/internal/csi-common/utils.go +++ b/internal/csi-common/utils.go @@ -29,7 +29,6 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" - grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" "github.com/kubernetes-csi/csi-lib-utils/protosanitizer" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -93,13 +92,9 @@ func NewControllerServiceCapability(ctrlCap csi.ControllerServiceCapability_RPC_ // NewMiddlewareServerOption creates a new grpc.ServerOption that configures a // common format for log messages and other gRPC related handlers. -func NewMiddlewareServerOption(withMetrics bool) grpc.ServerOption { +func NewMiddlewareServerOption() grpc.ServerOption { middleWare := []grpc.UnaryServerInterceptor{contextIDInjector, logGRPC, panicHandler} - if withMetrics { - middleWare = append(middleWare, grpc_prometheus.UnaryServerInterceptor) - } - return grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(middleWare...)) }