-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Otel server context interceptor and add experimental variable for experimental API #11500
Merged
YifeiZhuang
merged 9 commits into
grpc:master
from
YifeiZhuang:otel-server-context-interceptor
Sep 16, 2024
Merged
Otel server context interceptor and add experimental variable for experimental API #11500
YifeiZhuang
merged 9 commits into
grpc:master
from
YifeiZhuang:otel-server-context-interceptor
Sep 16, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ejona86
reviewed
Sep 3, 2024
opentelemetry/src/main/java/io/grpc/opentelemetry/OpenTelemetryTracingModule.java
Outdated
Show resolved
Hide resolved
In the interop-test, I switched to |
ejona86
reviewed
Sep 5, 2024
opentelemetry/src/main/java/io/grpc/opentelemetry/OpenTelemetryTracingModule.java
Outdated
Show resolved
Hide resolved
opentelemetry/src/main/java/io/grpc/opentelemetry/GrpcOpenTelemetry.java
Outdated
Show resolved
Hide resolved
ejona86
approved these changes
Sep 16, 2024
YifeiZhuang
changed the title
Otel server context interceptor
Otel server context interceptor and add experimental variable for experimental API
Oct 4, 2024
This was referenced Oct 4, 2024
kannanjgithub
pushed a commit
to kannanjgithub/grpc-java
that referenced
this pull request
Oct 23, 2024
Add opentelemetry tracing API, guarded by environmental variable(disabled by default). Use server interceptor to explicitly propagate span to the application thread.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
b/357892637
following up on: #11477
This uses inprocess transport. Next we will add interop test using netty transport to test real across thread span propagation.
Context
io.opentelemetry.context
forksio.grpc.context
, so propagating span context becomes an issue.In grpc, the server context is propagated from transport thread to the application thread at the
JumpToApplicationThreadServerListener
, usingContextRunnable
. However, due to opentelemetry has its own context object/storage, the span propagation does not happen automatically with the existing grpc support. There are two ways of doing this:serverStreamTracer.filterContext
runs in transport thread).Pros: simplicity, UX, API support
Cons:context does not propagate between opentelemetry and grpc, only span context is manually propagated.
io.grpc.override.ContextStorageOverride
, e.g. https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/grpc-1.6/library/src/main/java/io/grpc/override/ContextStorageOverride.java,which delegates the grpc context storage to opentelemetry context.
Pros: propagate all
Cons: UX is complicated. users can not it use with other custom ContextStorageOverride if we add it to grpc-opentelemetry package. Or if we release it as a separate artifact, users need to add dependency, no API support.
Client side is easier, the current span context in opentelemetry from the application will be propagated as parent span towards grpc client/attempt spans, automatically support by SpanBuilderImpl.