-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(vertx): inject context to downstream #15285
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
Open
squakez
wants to merge
1
commit into
open-telemetry:main
Choose a base branch
from
squakez:feat/15284
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the typical pattern is injecting context using TextMapSetters is something that happens in a client as opposed to server instrumentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an expert on Otel, but this is what I've seen as a way to propagate context [1]. It's also the way we're doing internally in our framework. If there is a better alternative to achieve the same goal, we can certainly go for it.
[1] https://opentelemetry.io/docs/languages/java/api/#contextpropagators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually you'd just call
Context.current(). Serializing the context to context propagation headers is used for propagating context to external systems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with
Context.current()is the thread consistency. We have a multithreading environment and we cannot be certain that the thread that was executing the Vertx process is the same later used in the downstream process. That is the reason why we do prefer to use the context propagation via header instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are using threads in a way where context isn't automatically propagated you could capture the value of
Context.current()at a point where it is still available and pass it along manually.Could you elaborate why you wish to add the header based propagation here instead of doing it inside your own application?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apache Camel is not a simple application. It's a large framework with the integration of many components. We don't know beforehand how the user configure their applications or if even the user is going to include telemetry or not. We found several problem due to the context propagation in async situations, reason why we are adopting the header propagation [1] which seems to fit perfectly into our design. You can consider Camel as a black box, so, we are expecting upstream traces to carry on a
traceparentheader when this is somehow instrumented or enabled. Camel expects any upstream to carry on that header. And same for the downstream, Camel will add always atraceparentheader for any downstream process to be able to relate the trace. I understood that was the correct way to handle distributed tracing.[1] https://github.com/apache/camel/blob/main/proposals/tracing.adoc#context-propagation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laurit FYI, I've created a reproducer in the issue linked for this PR [1] if you want to have a look.
[1] #15284 (comment)