-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ctx in SpanDecorator option #47
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
@rnburn could this be merged? |
@@ -147,7 +148,7 @@ func newOpenTracingClientStream(cs grpc.ClientStream, method string, desc *grpc. | |||
SetSpanTags(clientSpan, err, true) | |||
} | |||
if otgrpcOpts.decorator != nil { | |||
otgrpcOpts.decorator(clientSpan, method, nil, nil, err) | |||
otgrpcOpts.decorator(context.Background(), clientSpan, method, nil, nil, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass ctx
also to the streaming interceptors:
otgrpcOpts.decorator(context.Background(), clientSpan, method, nil, nil, err) | |
otgrpcOpts.decorator(cs.Context(), clientSpan, method, nil, nil, err) |
@@ -117,7 +117,7 @@ func OpenTracingStreamServerInterceptor(tracer opentracing.Tracer, optFuncs ...O | |||
serverSpan.LogFields(log.String("event", "error"), log.String("message", err.Error())) | |||
} | |||
if otgrpcOpts.decorator != nil { | |||
otgrpcOpts.decorator(serverSpan, info.FullMethod, nil, nil, err) | |||
otgrpcOpts.decorator(context.Background(), serverSpan, info.FullMethod, nil, nil, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otgrpcOpts.decorator(context.Background(), serverSpan, info.FullMethod, nil, nil, err) | |
otgrpcOpts.decorator(ss.Context(), serverSpan, info.FullMethod, nil, nil, err) |
I needed to add specific tag from contextKey set in the context on an other middleware before this one.
I wasn't able to access it without adding the context in the decorator.