Skip to content

Commit

Permalink
util: remove metrics argument from NewMiddlewareServerOption
Browse files Browse the repository at this point in the history
This commit removes metrics argument from NewMiddlewareServerOption
as it always set to false.

Signed-off-by: Praveen M <[email protected]>
  • Loading branch information
iPraveenParihar authored and mergify[bot] committed Nov 17, 2023
1 parent 0c13a70 commit e998330
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/csi-addons/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/csi-common/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions internal/csi-common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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...))
}

Expand Down

0 comments on commit e998330

Please sign in to comment.