-
Notifications
You must be signed in to change notification settings - Fork 5.3k
router: inject tracing context in the upstream request #20503
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -486,6 +486,11 @@ void UpstreamRequest::onPoolReady( | |
|
|
||
| if (span_ != nullptr) { | ||
| span_->injectContext(*parent_.downstreamHeaders()); | ||
| } else { | ||
| // No independent child span for current upstream request then inject the parent span's tracing | ||
| // context into the request headers. | ||
|
Comment on lines
+490
to
+491
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I understand now, thanks for explaining. Do you mind adding a few more comments here on the implications of doing this multiple times for retries, etc.? I understand this is the way it was always done, but it's a little more confusing now. Thank you! /wait
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. get it. |
||
| // The injectContext() of the parent span may be called repeatedly when the request is retried. | ||
| parent_.callbacks()->activeSpan().injectContext(*parent_.downstreamHeaders()); | ||
| } | ||
|
|
||
| upstreamTiming().onFirstUpstreamTxByteSent(parent_.callbacks()->dispatcher().timeSource()); | ||
|
|
||
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.
What are the implications of this with regard to retries and hedging? I'm concerned this a change in behavior here?
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
start_child_spanis set tofalse, then we may do some repeated injectings when retries occur. This should be safe because in previous implementation, we may re-inject tracing context as well.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.
In the #20367, we want to update the
injectContextAPI to add a new parameter to provide target upstream of current upstream request. This PR can also complete some pre-work.