Repository navigation
Conversation
… is configured Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Existing OTLP integration snapshots still expect the previous sampling metadata and must be updated before merging.
1 open issue
What changed in this PR
Corrects the managed tracer’s OTLP sampling fallback so unconfigured traces use the Default mechanism without a rate limiter, rather than appearing as user-rule decisions.
Changes:
- Adds an always-keep default rule for OTLP while preserving Agent sampling for Datadog export.
- Removes the implicit global sampling rate of
1.0in OTLP mode. - Adds sampler tests and updates configuration expectations.
| File | Description |
|---|---|
| tracer/test/Datadog.Trace.Tests/Sampling/ManagedTraceSamplerTests.cs | Tests default and explicit-rate sampling behavior. |
| tracer/test/Datadog.Trace.Tests/Configuration/MutableSettingsTests.cs | Expects a null global rate when unconfigured. |
| tracer/src/Datadog.Trace/Sampling/ManagedTraceSampler.cs | Registers the default fallback for OTLP. |
| tracer/src/Datadog.Trace/Sampling/DefaultSamplingRule.cs | Defines the always-keep Default sampling rule. |
| tracer/src/Datadog.Trace/Configuration/MutableSettings.cs | Removes the OTLP-specific global-rate default. |
Review effort: Balanced
| } | ||
| else | ||
| { | ||
| sampler.RegisterRule(new DefaultSamplingRule()); |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BenchmarksBenchmark execution time: 2026-10-27 19:04:24 Comparing candidate commit 7d38596 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 12 known flaky benchmarks, 114 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (9531) and master. ✅ No regressions detected |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Snapshots difference summaryThe following differences have been observed in committed snapshots. It is meant to help the reviewer. 30 occurrences of : - {
- "key": "_dd.limit_psr",
- "value": {
- "doubleValue": 1.0
- }
- },
- {
- "key": "_dd.rule_psr",
- "value": {
- "doubleValue": 1.0
- }
- },
[...]
- "intValue": "2"
+ "intValue": "1"
34 occurrences of : - "stringValue": "-3"
- }
- },
- {
- "key": "_dd.p.ksr",
- "value": {
- "stringValue": "1"
+ "stringValue": "-0"
4 occurrences of : - "intValue": "2"
- }
- },
- {
- "key": "_dd.rule_psr",
- "value": {
- "doubleValue": 1.0
- }
- },
- {
- "key": "_dd.limit_psr",
- "value": {
- "doubleValue": 1.0
+ "intValue": "1"
8 occurrences of : - "intValue": "2"
+ "intValue": "1"
[...]
- "stringValue": "-3"
- }
- },
- {
- "key": "_dd.p.ksr",
- "value": {
- "stringValue": "1"
- }
- },
- {
- "key": "_dd.rule_psr",
- "value": {
- "doubleValue": 1.0
- }
- },
- {
- "key": "_dd.limit_psr",
- "value": {
- "doubleValue": 1.0
+ "stringValue": "-0"
106 occurrences of : - {
- "key": "_dd.limit_psr",
- "value": {
- "doubleValue": 1.0
- }
- },
[...]
- "stringValue": "-3"
- }
- },
- {
- "key": "_dd.p.ksr",
- "value": {
- "stringValue": "1"
- }
- },
- {
- "key": "_dd.rule_psr",
- "value": {
- "doubleValue": 1.0
+ "stringValue": "-0"
[...]
- "intValue": "2"
+ "intValue": "1"
|
There was a problem hiding this comment.
More details
Unconfigured OTLP traces now use Default/AutoKeep without the user-rule rate limiter, while explicitly configured sampling rules retain precedence.
🤖 Bits Code Review · Commit 1445339
| { | ||
| // Keeps all traces when no other rule matches. Used instead of AgentSamplingRule | ||
| // when traces are exported over OTLP, because the Agent doesn't send sampling rates. | ||
| internal sealed class DefaultSamplingRule : ISamplingRule |
There was a problem hiding this comment.
What about renaming this to indicate that this is only intended for use for OTLP export?
| internal sealed class DefaultSamplingRule : ISamplingRule | |
| internal sealed class OtlpDefaultSamplingRule : ISamplingRule |
There was a problem hiding this comment.
Good idea, renamed to OtlpDefaultSamplingRule in Rename the DefaultSamplingRule class and its usages to OtlpDefaultSamplingRule (7d3859614c).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…plingRule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Summary of changes
In OTLP export mode, when no sampling rule or rate is configured, keep traces with the
Defaultmechanism (_dd.p.dm=-0, priority 1) instead of treating them as kept by a user rule (_dd.p.dm=-3, priority 2).Reason for change
OTLP mode skips
AgentSamplingRule(the Agent never sends rates there), which also removed the "keep everything, Default" fallback. To compensate, the global sample rate was defaulted to1.0in OTLP mode, so every trace looked like a user-rule decision.Consequences of
-3/ priority 2 for services that configured nothing:SpansIngestionReasonResolver) maps priority 2 +-3to ingestion reasonrule, so these services appear to have a local 100% sampling rule.Other tracers already use a dedicated default sampler in OTLP mode instead:
otelParentBasedAlwaysOnSampler(AutoKeep,samplernames.Default)ParentBasedAlwaysOnSampler(SAMPLER_KEEP,SamplingMechanism.DEFAULT)Implementation details
OtlpDefaultSamplingRule(matches every trace, rate 1, mechanismDefault), registered byManagedTraceSamplerin OTLP mode. Datadog mode still usesAgentSamplingRule.1.0default inMutableSettings.BuildSampleRate. As a result, the manual API'sGlobalSamplingRatereturnsnullin OTLP mode when nothing is configured, as in Datadog mode.Test coverage
ManagedTraceSamplerTests(Datadog and OTLP modes): no rules →Default, AutoKeep, no limiter;DD_TRACE_SAMPLE_RATEset →LocalTraceSamplingRule, UserKeep.MutableSettingsTests.GlobalSamplingRateWithOtlpTracesExporter.-3→-0, priority 2 → 1, no_dd.rule_psr/_dd.limit_psr/_dd.p.ksr).Other details
Follow-up to #9498. The
1.0default came from #8211.🤖 Generated with Claude Code