diff --git a/src/internal/nozzle/otel_server.go b/src/internal/nozzle/otel_server.go index 5caf6e47..65c565d1 100644 --- a/src/internal/nozzle/otel_server.go +++ b/src/internal/nozzle/otel_server.go @@ -14,7 +14,6 @@ import ( "github.com/cloudfoundry/metric-store-release/src/pkg/logger" "google.golang.org/grpc" - "google.golang.org/grpc/credentials" ) type OtelServer struct { @@ -55,15 +54,14 @@ func (s *OtelServer) Start(addr string, otelTlsConfig *tls.Config) { s.log.Info("OtelServer starting grpc server at ", zap.String("address", addr)) // Initialize gRPC server with TLS credentials - grpcServer := grpc.NewServer(grpc.Creds(credentials.NewTLS(otelTlsConfig))) + grpcServer := grpc.NewServer() + // Start the gRPC server in a separate goroutine + go s.startGRPCServer(addr, grpcServer, otelTlsConfig) // Register Metric and Trace services with the gRPC server metricspb.RegisterMetricsServiceServer(grpcServer, s.ms) tracepb.RegisterTraceServiceServer(grpcServer, s.ts) - // Start the gRPC server in a separate goroutine - go s.startGRPCServer(addr, grpcServer) - s.log.Info("Starting Metrics and Trace Servers") s.ms.StartListening() s.ts.StartListening() @@ -89,7 +87,7 @@ func NewOtelServer( } // StartGRPCServer starts the gRPC server and listens for incoming connections. -func (s *OtelServer) startGRPCServer(addr string, grpcServer *grpc.Server) { +func (s *OtelServer) startGRPCServer(addr string, grpcServer *grpc.Server, otelTlsConfig *tls.Config) { defer func() { close(s.done) }() @@ -99,8 +97,7 @@ func (s *OtelServer) startGRPCServer(addr string, grpcServer *grpc.Server) { if err != nil { s.log.Panic("Failed to resolve address", zap.Error(err)) } - - listener, err := net.ListenTCP("tcp", resolvedAddr) + listener, err := tls.Listen("tcp", resolvedAddr.String(), otelTlsConfig) if err != nil { s.log.Panic("Failed to start listener", zap.Error(err)) } diff --git a/src/internal/nozzle/trace_service.go b/src/internal/nozzle/trace_service.go index 384a8007..d21c412e 100644 --- a/src/internal/nozzle/trace_service.go +++ b/src/internal/nozzle/trace_service.go @@ -1,13 +1,14 @@ package nozzle import ( + "strconv" + "time" + "code.cloudfoundry.org/go-diodes" "github.com/cloudfoundry/metric-store-release/src/internal/metrics" "github.com/cloudfoundry/metric-store-release/src/internal/nozzle/rollup" "github.com/cloudfoundry/metric-store-release/src/pkg/logger" "github.com/cloudfoundry/metric-store-release/src/pkg/persistence/transform" - "strconv" - "time" "github.com/cloudfoundry/metric-store-release/src/pkg/ingressclient" "github.com/cloudfoundry/metric-store-release/src/pkg/rpc" @@ -159,8 +160,6 @@ func (s *TraceService) convertToSpan(sp *ot.Span) *rpc.Span { } func (s *TraceService) addToRollup(span *rpc.Span) { - s.log.Log("msg", "TraceService.addToRollup:", "span", span) - s.totalRollup.Record(span.SourceId, span.Labels, 1) s.durationRollup.Record(span.SourceId, span.Labels, span.Duration) }