Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add opt-in to export *unsampled but recording* Activities from trace processors

Aperta
#3,610 5 commenti 1 reazione 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Stale triage/accepted

Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.


Is your feature request related to a problem?
Yes. By default, the C++ SDK only exports sampled spans. This prevents collectors from seeing the full request volume, which makes it difficult to calculate accurate metrics (e.g., request rates, error ratios, latency percentiles) or perform tail-based sampling decisions with complete coverage.

In the Java SDK, this problem was tracked in:

  • Issue #4990 — Proposal to forward non-sampled spans to SpanProcessors/Exporters
  • PR #6057 — Merged implementation adding an exportUnsampledSpans option

C++ processors (BatchSpanProcessor, SimpleSpanProcessor) currently drop unsampled spans unconditionally, leaving no opt-in for users who want to forward them.


Describe the solution you'd like
Introduce an opt-in flag on the span processors (e.g., BatchSpanProcessorOptions, SimpleSpanProcessorOptions) that allows unsampled-but-recording spans to be forwarded to exporters.

Example pseudocode:

// sdk/include/opentelemetry/sdk/trace/batch_span_processor_options.h
struct BatchSpanProcessorOptions {
  // Existing fields...
  bool export_unsampled_spans = false; // default false
};

// sdk/src/trace/batch_span_processor.cc (simplified pseudocode)
void BatchSpanProcessor::OnEnd(std::unique_ptr<Recordable> &&span) noexcept {
  auto *readable = static_cast<ReadableSpan*>(span.get());
  bool is_sampled = readable->GetSpanContext().IsSampled();

  if (!is_sampled && !options_.export_unsampled_spans) {
    return;
  }

  this->queue_.Add(std::move(span));
}

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Lingua principale
C++
Stelle
1.4k
Fork
647
Merge medio
1g 10h
PR unite (30g)
73

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-telemetry/opentelemetry-cpp

Tutte le issue di open-telemetry/opentelemetry-cpp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.