fix(tracer): don't activate runtime metrics v1 if otel runtime metrics are enabled#4962
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: b0ae9bf | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-06-30 12:07:20 Comparing candidate commit b0ae9bf in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 321 metrics, 2 unstable metrics, 1 flaky benchmarks without significant changes.
|
|
LGTM but I think we are missing a test here. This is a regression risk, a unit test would be a safety addition. It could be |
When DD_RUNTIME_METRICS_ENABLED and DD_METRICS_OTEL_ENABLED are both set, the legacy reportRuntimeMetrics goroutine (DogStatsD, runtime.go.*) was starting alongside the OTel path, causing dual emission. Pre-compute otelRuntimeMetricsShouldBeEnabled once in config and use it to guard the legacy path in newTracer(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hen OTel is active Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e2305ca to
b0ae9bf
Compare
Good point! Added a test that asserts legacy runtime metrics aren't enabled when OTel is active (b0ae9bf), this sets both flags, installs stub hooks, calls newTracer, and asserts legacy runtime metrics aren't started when OTel is active reading logs and boolean. |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
devflow unqueued this merge request: It did not become mergeable within the expected time |
zacharycmontoya
left a comment
There was a problem hiding this comment.
LGTM requirements wise
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Tests failed on this commit ab3259f: What to do next?
|
|
View all feedbacks in Devflow UI.
The expected merge time in
|
061ffc3
into
main
Following #4803, fixes dual-emission when both
DD_RUNTIME_METRICS_ENABLED=trueandDD_METRICS_OTEL_ENABLED=trueare set: the legacy v1 runtime metrics shouldn't start.Fix: Pre-compute
otelRuntimeMetricsShouldBeEnabledinconfig(option.go) and add a!otelRuntimeMetricsShouldBeEnabledguard around the legacy goroutine innewTracer().Testing:
TestTracerRuntimeMetrics(all subtests) passOTLP_RUNTIME_METRICSscenario):test_otel_metrics_are_present_and_attributedandtest_dd_metrics_are_absentboth pass🤖 Generated with Claude Code