Skip to content

Fix Service Bus session trace propagation in OpenTelemetry - #11946

Merged
Rohit Ranjan (RohitRanjanMS) merged 4 commits into
devfrom
rohitranjanms-fix-service-bus-session-tracing
Sep 15, 2026
Merged

Rohit Ranjan (RohitRanjanMS) merged 4 commits into
devfrom
rohitranjanms-fix-service-bus-session-tracing

Conversation

@RohitRanjanMS

@RohitRanjanMS Rohit Ranjan (RohitRanjanMS) commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Issue describing the changes in this PR

Resolves #11734

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Backport PR will follow after this change merges.
  • My changes do not require documentation changes
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
  • My changes do not require diagnostic events changes
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Registers the Azure.Messaging.ServiceBus.ServiceBusSessionProcessor activity source so session-enabled Service Bus triggers preserve W3C trace context in OpenTelemetry mode.

Validated with a private site extension against a session-enabled Service Bus trigger: the stock host omitted the session processor request and broke the producer trace, while the patched host emitted ServiceBusSessionProcessor.ProcessSessionMessage with the producer operation ID.

@RohitRanjanMS
Rohit Ranjan (RohitRanjanMS) requested a review from a team as a code owner August 27, 2026 06:01
Copilot AI lite review requested due to automatic review settings August 27, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses a distributed tracing gap in Functions Host OpenTelemetry integration by ensuring session-enabled Service Bus triggers are instrumented via the correct ActivitySource, preserving W3C trace context.

Changes:

  • Added Azure.Messaging.ServiceBus.ServiceBusSessionProcessor to the host’s OpenTelemetry ActivitySource allowlist.
  • Introduced a constant for the Service Bus session processor ActivitySource name.
  • Added a unit test validating that an activity can be started for the session processor source (i.e., a listener is registered).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/WebJobs.Script.Tests/Diagnostics/OpenTelemetry/OpenTelemetryConfigurationExtensionsTests.cs Adds coverage to validate the host listens to the Service Bus session processor ActivitySource.
src/WebJobs.Script/Diagnostics/OpenTelemetry/OpenTelemetryConstants.cs Introduces a constant for the Service Bus session processor ActivitySource name.
src/WebJobs.Script/Diagnostics/OpenTelemetry/OpenTelemetryConfigurationExtensions.cs Subscribes to the Service Bus session processor ActivitySource during tracing configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@RohitRanjanMS
Rohit Ranjan (RohitRanjanMS) force-pushed the rohitranjanms-fix-service-bus-session-tracing branch from a09f7c7 to bdc32e2 Compare September 14, 2026 07:17
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e01f6e03-4761-4eeb-9d24-e2522eb0f446
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e01f6e03-4761-4eeb-9d24-e2522eb0f446
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e01f6e03-4761-4eeb-9d24-e2522eb0f446
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e01f6e03-4761-4eeb-9d24-e2522eb0f446
@RohitRanjanMS
Rohit Ranjan (RohitRanjanMS) force-pushed the rohitranjanms-fix-service-bus-session-tracing branch from bdc32e2 to 71557c0 Compare September 14, 2026 18:33
@RohitRanjanMS
Rohit Ranjan (RohitRanjanMS) merged commit c02bfa6 into dev Sep 15, 2026
12 checks passed
@RohitRanjanMS
Rohit Ranjan (RohitRanjanMS) deleted the rohitranjanms-fix-service-bus-session-tracing branch September 15, 2026 05:37
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.

W3C trace context not propagated for session-enabled Service Bus triggers (OpenTelemetry)

4 participants