Skip to content
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

contrib/google.golang.org/grpc: fix client stream context propagation #919

Merged
merged 7 commits into from
Jun 29, 2021

Conversation

Julio-Guerra
Copy link
Contributor

Fix the client stream context returned by method Context() on the traced
client stream. It now correctly returns the context containing the
grpc.client span instead of its parent context.

This was leading to misconnected or orphan grpc.message spans.

Fixes APMS-5154.

Fix the client stream context returned by method Context() on the traced
client stream. It now correctly returns the context containing the
grpc.client span instead of its parent context.

This was leading to misconnected or orphan grpc.message spans.
@Julio-Guerra Julio-Guerra added the bug unintended behavior that has to be fixed label May 6, 2021
@Julio-Guerra Julio-Guerra requested review from knusbaum and gbbr May 6, 2021 15:50
@knusbaum knusbaum added this to the Triage milestone May 11, 2021
Copy link
Contributor

@knusbaum knusbaum left a comment

Choose a reason for hiding this comment

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

Thanks, @Julio-Guerra
I have some nitpicks and questions.

contrib/google.golang.org/grpc/grpc_test.go Outdated Show resolved Hide resolved
contrib/google.golang.org/grpc/grpc_test.go Outdated Show resolved Hide resolved
contrib/google.golang.org/grpc/grpc_test.go Outdated Show resolved Hide resolved
defer rig.Close()
client := rig.client

{
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as explained above


var serverSpan, clientSpan mocktracer.Span
{
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for putting this in a block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The following rootSpan type is tracer.Span and then come the assertions with the tracer mockup spans which have different types. So I created a new separate scope to avoid having two types of spans in the function scope.

Happy to put it in a separate function if you prefer.

@knusbaum knusbaum modified the milestones: Triage, 1.32.0 Jun 29, 2021
@knusbaum knusbaum merged commit bfaa50c into v1 Jun 29, 2021
@knusbaum knusbaum deleted the julio/fix-grpc-client-stream-context branch June 29, 2021 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unintended behavior that has to be fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants