Skip to content

RequestInstrumentationPolicy doesn't set newly created span for parenting.#3910

Merged
LarryOsterman merged 2 commits intoAzure:mainfrom
LarryOsterman:larryo/request_instrumentation_policy_sets_context
Mar 17, 2026
Merged

RequestInstrumentationPolicy doesn't set newly created span for parenting.#3910
LarryOsterman merged 2 commits intoAzure:mainfrom
LarryOsterman:larryo/request_instrumentation_policy_sets_context

Conversation

@LarryOsterman
Copy link
Member

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.

@LarryOsterman LarryOsterman requested a review from heaths as a code owner March 10, 2026 22:26
Copilot AI review requested due to automatic review settings March 10, 2026 22:26
@github-actions github-actions bot added the Azure.Core The azure_core crate label Mar 10, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Context via with_value(...) before calling the next policy.
  • Update the downstream send call 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.

@LarryOsterman LarryOsterman merged commit ccbcd78 into Azure:main Mar 17, 2026
25 checks passed
@LarryOsterman LarryOsterman deleted the larryo/request_instrumentation_policy_sets_context branch March 17, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Core The azure_core crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RequestInstrumentationPolicy doesn't pass spans to the next policy

4 participants