fix(otlp): preserve service-entry trace metrics - #9774
Conversation
Fixes several OTLP trace-metrics (traces.span.sdk.metrics.duration) attribute gaps found in a cross-tracer audit against SEMCON-1093: - datadog.process_tags now emits one array-valued resource attribute (mirroring the legacy v0.6/stats ProcessTags shape) instead of flattening each tag into its own datadog.<key> attribute. - datadog.is_trace_root is now emitted per data point, gated the same way as the other datadog.* attributes. - span.kind is canonicalized to the OTel Span Metrics Connector's SPAN_KIND_* uppercase convention instead of being passed through lowercase. - status.code is now a required string attribute (STATUS_CODE_OK/STATUS_CODE_ERROR) on every data point, replacing the previous OTLP-trace-style int enum that was only set on errors. additional_metric_tags and peer_tags remain unimplemented on this path; both are flagged with a one-line TODO pointing at the corresponding gap (or its absence) in the legacy v0.6/stats exporter.
service.name was omitted from OTLP trace-metrics data points whenever a span's service matched the default/global service, mirroring the status.code fix earlier in this branch: required attributes must be unconditional, not skipped as an optimization.
Native stats without OTLP regressed from a 1.26s to 1.43s benchmark median because service-boundary state was tracked for every span. Removing that tracking restores the master baseline; the behavior will move to an OTLP-gated follow-up.
Gate service tracking on the OTLP exporter so native stats keep the baseline hot path. Preserve parent services across partial flushes and treat spans whose parent is absent locally as service entries.
Overall package sizeSelf size: 7.99 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 441.68 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
🎉 All green!🧪 All tests passed 🔄 Datadog auto-retried 1 job - 1 passed on retry 🎯 Code Coverage (details) 🔗 Commit SHA: 0698550 | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-08-11 20:17:40 Comparing candidate commit 0698550 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2330 metrics, 28 unstable metrics.
|
…into codex/otlp-trace-metrics-service-boundaries # Conflicts: # packages/dd-trace/src/span_processor.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9774 +/- ##
=========================================
Coverage 98.55% 98.55%
=========================================
Files 966 966
Lines 139420 139534 +114
Branches 12543 13998 +1455
=========================================
+ Hits 137407 137522 +115
+ Misses 2013 2012 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…into codex/otlp-trace-metrics-service-boundaries
5069eb6 to
a849759
Compare
What does this PR do?
Motivation
This is stacked on #9685 so service-boundary inference remains separate from the core attribute translation and resolves the remote-parent gap reported in review
Additional Notes
The native-stats benchmark with OTLP disabled stays at baseline: 1.23s median here versus 1.26s on master. Focused tests, npm run lint, and the merged-main OTLP system-test suite pass; the suite reports 38 passed, 3 expected failures, and 10 expected-failure tests passing