diff --git a/cmd/query/app/server.go b/cmd/query/app/server.go index a26508e4b15..543ede956ee 100644 --- a/cmd/query/app/server.go +++ b/cmd/query/app/server.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" "google.golang.org/grpc" - "google.golang.org/grpc/credentials" "google.golang.org/grpc/health" "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/reflection" @@ -78,12 +77,7 @@ func NewServer( return nil, errors.New("server with TLS enabled can not use same host ports for gRPC and HTTP. Use dedicated HTTP and gRPC host ports instead") } - var grpcServer *grpc.Server - if !separatePorts { - grpcServer, err = createGRPCServerLegacy(ctx, options, tm) - } else { - grpcServer, err = createGRPCServerOTEL(ctx, options, tm, telset) - } + grpcServer, err := createGRPCServer(ctx, options, tm, telset) if err != nil { return nil, err } @@ -103,45 +97,6 @@ func NewServer( }, nil } -func createGRPCServerLegacy( - ctx context.Context, - options *QueryOptions, - tm *tenancy.Manager, -) (*grpc.Server, error) { - var grpcOpts []grpc.ServerOption - - if options.GRPC.TLSSetting != nil { - tlsCfg, err := options.GRPC.TLSSetting.LoadTLSConfig(ctx) - if err != nil { - return nil, err - } - - creds := credentials.NewTLS(tlsCfg) - - grpcOpts = append(grpcOpts, grpc.Creds(creds)) - } - - unaryInterceptors := []grpc.UnaryServerInterceptor{ - bearertoken.NewUnaryServerInterceptor(), - } - streamInterceptors := []grpc.StreamServerInterceptor{ - bearertoken.NewStreamServerInterceptor(), - } - //nolint:contextcheck - if tm.Enabled { - unaryInterceptors = append(unaryInterceptors, tenancy.NewGuardingUnaryInterceptor(tm)) - streamInterceptors = append(streamInterceptors, tenancy.NewGuardingStreamInterceptor(tm)) - } - - grpcOpts = append(grpcOpts, - grpc.ChainUnaryInterceptor(unaryInterceptors...), - grpc.ChainStreamInterceptor(streamInterceptors...), - ) - - server := grpc.NewServer(grpcOpts...) - return server, nil -} - func registerGRPCHandlers( server *grpc.Server, querySvc *querysvc.QueryService, @@ -165,7 +120,7 @@ func registerGRPCHandlers( grpc_health_v1.RegisterHealthServer(server, healthServer) } -func createGRPCServerOTEL( +func createGRPCServer( ctx context.Context, options *QueryOptions, tm *tenancy.Manager,