From 885e553d98682078486d7d060dd0ddcbf60a709a Mon Sep 17 00:00:00 2001 From: Florian Ritterhoff Date: Mon, 25 Nov 2024 16:24:31 +0100 Subject: [PATCH] try reusing trace --- cas/sectigocas/sectigocas.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cas/sectigocas/sectigocas.go b/cas/sectigocas/sectigocas.go index 4497fb5dd..ca68f8499 100644 --- a/cas/sectigocas/sectigocas.go +++ b/cas/sectigocas/sectigocas.go @@ -52,8 +52,17 @@ func sentryInterceptor(ctx context.Context, operationName := defaultClientOperationName - span := sentry.StartSpan(ctx, operationName, sentry.WithDescription(method)) + trace, okTrace := ctx.Value(sentryTrace{}).(string) + baggage, okBaggage := ctx.Value(sentryBaggage{}).(string) + + options := []sentry.SpanOption{sentry.WithDescription(method)} + if okTrace && okBaggage { + options = append(options, sentry.ContinueFromHeaders(trace, baggage)) + } + + span := sentry.StartSpan(ctx, operationName, options...) span.SetData("grpc.request.method", method) + ctx = span.Context() md, ok := metadata.FromOutgoingContext(ctx) if ok {