You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The gRPC libraries call opencensus APIs to add spans for incoming server requests (these spans have a remote parent). These have a name like "Recv.MyService.MyMethod'.
We wish to add further child spans in our user code (e.g. our implementation of MyService.MyMethod).
The problem we see is that our child spans are created as brand new traces.
Steps to reproduce
Reproduction requires a working gRPC server (it can just be a hello world) with opencensus instrumentation enabled.
To reproduce the problem:
Add the opencensus-shim as a dependency
Start & activate a span in the implementation of any gRPC service method.
What did you expect to see?
The spans created in the user code should be children of the spans created by the gRPC server interceptors.
What did you see instead?
The spans were treated as root spans and a new trace was started.
It does seem that the bug is really in the gRPC library since it bypasses the context management API when it activates the spans. Perhaps there is something we can do to make the fix easier for them (I think gRPC's context is passed around a lot so switching that to another type may be quite painful).
The client side does NOT have the same issue, but it seems like this may be good luck rather than intention. On the client side we create a span using otel API then call into the grpc client library. These spans created by the client library are correctly added as children but this happens despite the fact that gRPC itself thinks there is no parent (it calls the span builder with a blank parent span). It ends up with the correct output because the shim then finds the original parent via the opentelemetry context.
The text was updated successfully, but these errors were encountered:
Describe the bug
The gRPC libraries call opencensus APIs to add spans for incoming server requests (these spans have a remote parent). These have a name like "Recv.MyService.MyMethod'.
We wish to add further child spans in our user code (e.g. our implementation of MyService.MyMethod).
The problem we see is that our child spans are created as brand new traces.
Steps to reproduce
Reproduction requires a working gRPC server (it can just be a hello world) with opencensus instrumentation enabled.
To reproduce the problem:
What did you expect to see?
The spans created in the user code should be children of the spans created by the gRPC server interceptors.
What did you see instead?
The spans were treated as root spans and a new trace was started.
What version and what artifacts are you using?
(from build.gradle)
Environment
Java 21 (temurin)
Additional context
Please see also: grpc/grpc-java#7732 and #5475
It does seem that the bug is really in the gRPC library since it bypasses the context management API when it activates the spans. Perhaps there is something we can do to make the fix easier for them (I think gRPC's context is passed around a lot so switching that to another type may be quite painful).
The client side does NOT have the same issue, but it seems like this may be good luck rather than intention. On the client side we create a span using otel API then call into the grpc client library. These spans created by the client library are correctly added as children but this happens despite the fact that gRPC itself thinks there is no parent (it calls the span builder with a blank parent span). It ends up with the correct output because the shim then finds the original parent via the opentelemetry context.
The text was updated successfully, but these errors were encountered: