util: remove metrics argument from NewMiddlewareServerOption

This commit removes metrics argument from NewMiddlewareServerOption
as it always set to false.

Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
Praveen M 2023-11-16 20:59:13 +05:30 committed by mergify[bot]
parent 0c13a70363
commit e9983306d9
3 changed files with 3 additions and 8 deletions

View File

@ -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)

View File

@ -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 {

View File

@ -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...))
}