open-telemetry/opentelemetry-dotnet

[feature request] Add opt-in to export unsampled but recording Activities from trace processors

Open

#6452 aperta il 25 ago 2025

Vedi su GitHub
 (2 commenti) (1 reazione) (1 assegnatario)C# (889 fork)auto 404
enhancementhelp wantedpkg:OpenTelemetry

Metriche repository

Star
 (3725 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Package

OpenTelemetry

Is your feature request related to a problem?

The Trace SDK spec says span exporters MUST receive sampled spans and SHOULD NOT receive non-sampled ones. That “SHOULD NOT” leaves room for language-level opt-ins. Java added exactly this via PR https://github.com/open-telemetry/opentelemetry-java/pull/6057 (“export unsampled spans from span processors”) so collectors can compute metrics or do tail decisions with full coverage.

What is the expected behavior?

When the new option export_unsampled_spans = true (or equivalent flag/env var) is enabled:

  • The SDK forwards both sampled and unsampled-but-recording spans to the configured exporters.
  • By default (false), only sampled spans are exported (current behavior).
  • Non-recording (DROP) spans remain excluded regardless of the setting.

This ensures users who opt in can export unsampled spans to the Collector for use cases such as:

  • Accurate request/transaction metrics (RED metrics, error ratios, SLO burn).
  • Collector-side tail-based sampling with full request visibility.

Which alternative solutions or features have you considered?

  • Computing metrics in-process from all spans — this would require consider additional logic to be added to the SDK . The ideal case is we can we can ship to a collector

Additional context

No response

Guida contributor