Describe the suggested improvement
Is your improvement related to a problem? Please describe.
When using NServiceBus with an OpenTelemetry exporter (e.g. Azure Monitor/Application Insights), a "Start dispatching" and "Finished dispatching" ActivityEvent are added to the incoming message span on every processed message. In telemetry backends that charge per ingested record, these events accumulate cost with little diagnostic value. There is currently no way to opt out of them at the NServiceBus configuration level.
Reference: https://discuss.particular.net/t/filter-opentelemetry-tracing-events/4590
Describe the suggested solution
Add a TracingSettings class accessible via an extension method on EndpointConfiguration: endpointConfiguration.Tracing().DisableDispatchingActivityEvents(); This suppresses the two dispatching ActivityEvents without affecting spans, metrics, or any other telemetry. Opt-out keeps the behavior unchanged for existing users
Describe alternatives you've considered
- Filter at the exporter/backend level - Azure Data Collection Rules can drop these records after ingestion, but you still pay for the ingestion cost. It also leaks an NServiceBus implementation detail into infrastructure config.
- Custom ActivitySource wrapping NServiceBus - the workaround the customer ended up using. Fragile because it must track internal NServiceBus tracing changes manually.
- OTel SDK sampler - samplers operate on spans (Activities), not on events within a span, so they cannot target these specific events.
Additional Context
No response
Describe the suggested improvement
Is your improvement related to a problem? Please describe.
When using NServiceBus with an OpenTelemetry exporter (e.g. Azure Monitor/Application Insights), a "Start dispatching" and "Finished dispatching" ActivityEvent are added to the incoming message span on every processed message. In telemetry backends that charge per ingested record, these events accumulate cost with little diagnostic value. There is currently no way to opt out of them at the NServiceBus configuration level.
Reference: https://discuss.particular.net/t/filter-opentelemetry-tracing-events/4590
Describe the suggested solution
Add a TracingSettings class accessible via an extension method on EndpointConfiguration: endpointConfiguration.Tracing().DisableDispatchingActivityEvents(); This suppresses the two dispatching ActivityEvents without affecting spans, metrics, or any other telemetry. Opt-out keeps the behavior unchanged for existing users
Describe alternatives you've considered
Additional Context
No response