Skip to content

feat: honour OTEL_TRACES_SAMPLER and add sampler options across the traceAI SDKs - #711

Merged
nik13 merged 13 commits into
devfrom
feat/sampler-parity-1117
Nov 17, 2026
Merged

nik13 merged 13 commits into
devfrom
feat/sampler-parity-1117

Conversation

@nik13

@nik13 nik13 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Lets you choose the head sampler the standard OpenTelemetry way wherever traceAI creates its own tracer provider, in all six SDKs.

Behaviour

  • When the auto agent (or a manual registration) creates its own provider and FI_SAMPLE_RATE (or the explicit sample-rate option) is not set, OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG are honoured with each OpenTelemetry SDK's own semantics: always_on, always_off, traceidratio, parentbased_always_on, parentbased_always_off, parentbased_traceidratio.
  • An explicit FI_SAMPLE_RATE still wins and keeps today's ParentBased(TraceIdRatio(rate)).
  • An invalid or unsupported value falls back to ParentBased(TraceIdRatio(1.0)) with one warning; it never throws.
  • An application-owned provider keeps its own sampler, unchanged.
  • Java TraceAI.init(TraceConfig) and C# TraceAI.Register(RegisterOptions) gain an optional sampler, used only when that call creates the provider.
  • No new span attributes; a span the sampler dropped is never marked sampled.

Languages

Python (fi_instrumentation.auto), TypeScript (@traceai/auto), Java (core + agent), Go (go/auto), C# (FIInstrumentation + auto), Ruby (traceai-auto). Each language has a test commit followed by its implementation, and its README/configuration docs describe the precedence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant