fix(tracer): skip stats concentrator in OTLP export mode#4609
fix(tracer): skip stats concentrator in OTLP export mode#4609mtoffl01 wants to merge 2 commits intomtoff/otlp-export-tracesfrom
Conversation
| @@ -28,6 +28,8 @@ import ( | |||
| "time" | |||
|
|
|||
| "go.uber.org/goleak" | |||
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)
| assert.True(t, trc.config.canDropP0s(), "canDropP0s must be true for this test to exercise submit()") | ||
|
|
||
| const spanCount = 5 | ||
| for i := 0; i < spanCount; i++ { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
rangeint: for loop can be modernized using range over int (modernize)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 0e4f52b | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
BenchmarksBenchmark execution time: 2026-03-27 16:10:42 Comparing candidate commit 0e4f52b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 214 metrics, 10 unstable metrics.
|
What does this PR do?
Skips initializing the stats concentrator when the tracer is running in OTLP export mode. Instead of creating the concentrator and letting it run idle, t.stats is left as nil. All *concentrator methods (Start, Stop, flushAndSend, newTracerStatSpan) are made nil-receiver safe so call sites don't need nil checks.
Motivation:
In OTLP export mode, traces are sent to an OpenTelemetry Collector — not the Datadog agent. The stats concentrator aggregates client-side stats and sends them to the agent's /v0.6/stats endpoint, which is unnecessary in this mode: either the user has no agent (using the collector exclusively), or they've opted to prioritize the collector. Keeping the concentrator running wastes CPU, memory, and goroutines on stats that are never consumed. This PR eliminates that overhead while ensuring all spans are still retained and delivered to the OTLP writer.
Reviewer's Checklist
make lintlocally.make testlocally.make generatelocally.make fix-moduleslocally.Unsure? Have a question? Request a review!