Skip to content

router: inject tracing context in the upstream request#20503

Merged
mattklein123 merged 2 commits intoenvoyproxy:mainfrom
wbpcode:tracing-inject
Mar 28, 2022
Merged

router: inject tracing context in the upstream request#20503
mattklein123 merged 2 commits intoenvoyproxy:mainfrom
wbpcode:tracing-inject

Conversation

@wbpcode
Copy link
Copy Markdown
Member

@wbpcode wbpcode commented Mar 24, 2022

Commit Message: router: inject tracing context in the upstream request
Additional Description:

Move tracing context injecting to upstream request. We can reduce some unnecessary injectings by this way. And in the future, we can provide some more upstream infos (for example, upstream host) to injectContext call.

Risk Level: Low.
Testing: Unit.
Docs Changes: N/A.
Release Notes: N/A.
Platform Specific Features: N/A.

@phlax
Copy link
Copy Markdown
Member

phlax commented Mar 24, 2022

@wbpcode - please fix missing DCO

Signed-off-by: wbpcode <wbphub@live.com>
Comment on lines -655 to -656
// Inject the active span's tracing context into the request headers.
callbacks_->activeSpan().injectContext(headers);
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If start_child_span is set to false, 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.

Copy link
Copy Markdown
Member Author

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 injectContext API to add a new parameter to provide target upstream of current upstream request. This PR can also complete some pre-work.

Comment on lines +490 to +491
// No independent child span for current upstream request then inject the parent span's tracing
// context into the request headers.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get it.

Signed-off-by: wbpcode <wbphub@live.com>
@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented Mar 27, 2022

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #20503 (comment) was created by @wbpcode.

see: more, trace.

@wbpcode
Copy link
Copy Markdown
Member Author

wbpcode commented Mar 27, 2022

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #20503 (comment) was created by @wbpcode.

see: more, trace.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants