open-telemetry/opentelemetry-dotnet

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

Open

#6,452 opened on 2025年8月25日

GitHub で見る
 (2 comments) (1 reaction) (1 assignee)C# (889 forks)auto 404
enhancementhelp wantedpkg:OpenTelemetry

Repository metrics

Stars
 (3,725 stars)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド