From 71b897d05f21b6fb89a9549ffb206b6653cb14c4 Mon Sep 17 00:00:00 2001 From: SammyOina Date: Wed, 24 Jan 2024 21:22:31 +0300 Subject: [PATCH] Upgrade gRPC instrumentation for better telemetry Replaced the gRPC server's UnaryInterceptor with StatsHandler from the otelgrpc package for enhanced monitoring capabilities, aligning with best practices for observability. This update allows us to take full advantage of OpenTelemetry's metrics and traces, thereby improving insight into our gRPC server's performance and reliability. Signed-off-by: SammyOina --- internal/server/grpc/grpc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/server/grpc/grpc.go b/internal/server/grpc/grpc.go index 86042cfe6..6a91495fa 100644 --- a/internal/server/grpc/grpc.go +++ b/internal/server/grpc/grpc.go @@ -52,7 +52,7 @@ func New(ctx context.Context, cancel context.CancelFunc, name string, config ser func (s *Server) Start() error { errCh := make(chan error) grpcServerOptions := []grpc.ServerOption{ - grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()), + grpc.StatsHandler(otelgrpc.NewServerHandler()), } listener, err := net.Listen("tcp", s.Address)