Single AppContext switch for the OpenTelemetry v11 behaviors - #7955
Open
ramonsmits wants to merge 2 commits into
Open
ramonsmits wants to merge 2 commits into
ramonsmits wants to merge 2 commits into
Conversation
Merged
irinascurtu
approved these changes
Oct 5, 2026
ramonsmits
force-pushed
the
otel-v11-switch
branch
from
October 5, 2026 12:56
a780f61 to
0fd2a39
Compare
ramonsmits
force-pushed
the
otel-ambient-baggage
branch
from
October 5, 2026 14:12
30798ae to
86cc2b3
Compare
Matches the root obsoletes-v10.cs convention where obsoletes-vN.cs holds code that is obsolete in vN and removed in vN+1. The ExceptionRecordingMode environment variable scaffold is removed in v12, so it belongs in obsoletes-v11.cs.
Several OpenTelemetry behaviors become the only behavior in v11 with no option left to opt in or out. Until then they are gated behind one AppContext switch, NServiceBus.Core.OpenTelemetry.UseV11Behavior, so an endpoint adopts the v11 behavior as a whole instead of per feature: - DistributedContextPropagator-based trace context and baggage propagation - handler spans from the NServiceBus.Core.Handler ActivitySource - ambient transport SDK receive span as parent of the incoming span - destination and message type in span names - no Start/Finished dispatching events on the incoming span - no execution.result metric tag - no legacy otel.status_code/otel.status_description tags and no exception.escaped attribute Replaces the UseDistributedContextPropagator, UseHandlerActivitySource and UseTransportActivityAsParent switches and removes the unreleased UseMessageTypeNamesInSpanNames, EmitMessageDispatchingEvents and Meters.EmitExecutionResultTags options. PublishTraceMode keeps its public option in v11 and is not governed by the switch. All v11 scaffolding now lives in the root obsoletes-v10.cs, replacing OpenTelemetry/Tracing/obsolete_v11.cs.
ramonsmits
force-pushed
the
otel-v11-switch
branch
from
October 5, 2026 14:13
0fd2a39 to
622edc2
Compare
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.
Several OpenTelemetry behaviors become the only behavior in v11. There is no option to opt in or opt out in v11. Until v11, one AppContext switch enables all of them together:
When the switch is on:
DistributedContextPropagator(W3C baggage format).NServiceBus.Core.HandlerActivitySource.process orders,send Payment.Start dispatchingandFinished dispatchingevents.execution.resulttag.otel.status_codeandotel.status_descriptiontags and theexception.escapedattribute.Removed:
UseDistributedContextPropagator,UseHandlerActivitySourceandUseTransportActivityAsParent.UseMessageTypeNamesInSpanNames,EmitMessageDispatchingEventsandMeters.EmitExecutionResultTags. None of these shipped.Not changed:
PublishTraceMode. It keeps its option in v11.File layout:
obsoletes-v10.csholds code that is obsolete in v10 and removed in v11. All v11 scaffolding now lives there, includingV11BehaviorSwitch.OpenTelemetry/Tracing/obsolete_v11.csis deleted.OpenTelemetry/Tracing/obsolete_v12.csis renamed toobsoletes-v11.cs.obsoletes-v10.cswith the[OpenTelemetryV11Defaults]attribute. It runs a test with the switch on. Tests are named for the behavior; the attribute marks the mode.Stacked on: