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

Ability to extract current otel context from grpc context #11965

Open
svametcalf opened this issue Aug 7, 2024 · 1 comment
Open

Ability to extract current otel context from grpc context #11965

svametcalf opened this issue Aug 7, 2024 · 1 comment
Labels
enhancement New feature or request needs triage New issue that requires triage

Comments

@svametcalf
Copy link

Is your feature request related to a problem? Please describe.

We are currently using grpc and the reactive-grpc generators in Spring. To make the tracing infrastructure all gel together, we are needing to provide a bridge between the gRPC context and Reactor Context, so that other Spring libraries can correlate started spans.

Currently, there is not a way to access the otel context value that has been stored in the gRPC context, because the gRPC Context uses reference equality for access and the key instances that have been used for storage are private.

Describe the solution you'd like

We would need a public Context.Key somewhere, so that the current otel context could be accessed. For example:

ContextStorageBridge.OTEL_CONTEXT.get(Context.current())  // this could be anywhere, it just needs to be `public`

This way, we can pass this context value to the Reactor pipeline

Describe alternatives you've considered

No response

Additional context

No response

@svametcalf svametcalf added enhancement New feature or request needs triage New issue that requires triage labels Aug 7, 2024
@heyams
Copy link
Contributor

heyams commented Aug 16, 2024

Check out this code sample using request header to inject current context.. then you can retrieve it out to be used in other libraries?

// Inject the request with the current Context, which contains our current Span.
openTelemetry.getPropagators().getTextMapPropagator().inject(Context.current(), transportLayer, setter);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage New issue that requires triage
Projects
None yet
Development

No branches or pull requests

2 participants