feat(otel): Implement parentbased_always_on in otlp mode#4567
Conversation
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 3ea6e13 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-03-20 18:13:48 Comparing candidate commit 3ea6e13 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 215 metrics, 9 unstable metrics.
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Background
This PR is part of an ongoing effort to support OTLP Traces Export Phase 1, documented here. It contains some placeholder/no-op code (e.g. otlpTraceWriter) which will be implemented in follow-up PRs (e.g, #4522).
What does this PR do?
When OTLP export mode is enabled, the SDK must not use the Datadog Agent priority sampler, since there is no agent available to provide per-service sampling rates. This PR introduces a replacement fallback sampler for that mode.
New type:
otelParentBasedAlwaysOnSampler— implements theparentbased_always_onstrategy (ref), which honors propagated sampling decisions from parent contexts, otherwise samples all traces at rate 1.0. User-configured rules take precedence over this fallback.New interface:
defaultSampler— abstracts the fallback sampling strategy applied when no user-defined rules match a span. BothprioritySampler(agent mode) andotelParentBasedAlwaysOnSampler(OTLP mode) satisfy this interface, replacing the previous concrete*prioritySamplerfield on the tracer and ensuring the fallback is never nil.Motivation
See Requirements: https://docs.google.com/document/d/1AsUrJxjJavLvSG33kUAJLYzGU8IYgrnf1SMbFDsuGmo/edit?tab=t.avgpmfl6f0c6#heading=h.nqkivnomx6oe
Reviewer's Checklist
make lintlocally.make testlocally.make generatelocally.make fix-moduleslocally.Unsure? Have a question? Request a review!