RequestInstrumentationPolicy doesn't set newly created span for parenting.#3910
Merged
LarryOsterman merged 2 commits intoAzure:mainfrom Mar 17, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes span parenting in RequestInstrumentationPolicy by ensuring the newly created request span is added to the Context passed to downstream policies, so later spans in the pipeline become children of the request span (addressing #3424).
Changes:
- Add the created request span into a cloned
Contextviawith_value(...)before calling the next policy. - Update the downstream
sendcall to pass the updated context reference. - Add a regression test that inserts a custom policy after request instrumentation to verify the span is present in the downstream context.
RickWinter
approved these changes
Mar 10, 2026
heaths
approved these changes
Mar 10, 2026
sdk/core/azure_core/src/http/policies/instrumentation/request_instrumentation.rs
Show resolved
Hide resolved
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
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.
Fixes #3424.
Before this change, a newly created request instrumentation policy span was not added to the context, which means that any spans created later in the pipeline would not correctly be parented to this request.