Skip to content

Add ctx in SpanDecorator option#47

Open
mmoustai wants to merge 1 commit into
grpc-ecosystem:masterfrom
mmoustai:feat/decorator-add-ctx
Open

Add ctx in SpanDecorator option#47
mmoustai wants to merge 1 commit into
grpc-ecosystem:masterfrom
mmoustai:feat/decorator-add-ctx

Conversation

@mmoustai
Copy link
Copy Markdown

@mmoustai mmoustai commented Jan 9, 2019

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.

@googlebot
Copy link
Copy Markdown

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. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@mmoustai
Copy link
Copy Markdown
Author

mmoustai commented Jan 9, 2019

I signed it!

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@fho
Copy link
Copy Markdown

fho commented Sep 23, 2019

@rnburn could this be merged?

Comment thread go/otgrpc/client.go
}
if otgrpcOpts.decorator != nil {
otgrpcOpts.decorator(clientSpan, method, nil, nil, err)
otgrpcOpts.decorator(context.Background(), clientSpan, method, nil, nil, err)
Copy link
Copy Markdown

@fho fho Sep 23, 2019

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:

Suggested change
otgrpcOpts.decorator(context.Background(), clientSpan, method, nil, nil, err)
otgrpcOpts.decorator(cs.Context(), clientSpan, method, nil, nil, err)

Comment thread go/otgrpc/server.go
}
if otgrpcOpts.decorator != nil {
otgrpcOpts.decorator(serverSpan, info.FullMethod, nil, nil, err)
otgrpcOpts.decorator(context.Background(), serverSpan, info.FullMethod, nil, nil, err)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
otgrpcOpts.decorator(context.Background(), serverSpan, info.FullMethod, nil, nil, err)
otgrpcOpts.decorator(ss.Context(), serverSpan, info.FullMethod, nil, nil, err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants