From c14cd479408b94ac4dff6508f77f326ab9320410 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 30 May 2024 18:04:08 -0400 Subject: [PATCH] updates --- baseapp/grpcserver.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/baseapp/grpcserver.go b/baseapp/grpcserver.go index 27c6f85086ff..ff0602748e6b 100644 --- a/baseapp/grpcserver.go +++ b/baseapp/grpcserver.go @@ -7,6 +7,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + otelcodes "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -90,7 +91,15 @@ func (app *BaseApp) RegisterGRPCServer(server gogogrpc.Server, logQueries bool) span.SetAttributes(attribute.String("http.method", grpcInfo.FullMethod)) - return handler(grpcCtx, req) + resp, err = handler(grpcCtx, req) + + if err != nil { + span.SetStatus(otelcodes.Error, err.Error()) + } else { + span.SetStatus(otelcodes.Ok, "OK") + } + + return resp, err } // Loop through all services and methods, add the interceptor, and register