Conversation
Declare the export mode and semantics mode on the wire so the backend can measure OTLP adoption instead of inferring it at ingest time. Native v0.4/v0.5 payloads carry _dd.sdk.otlp_export=false once per payload; OTLP exports carry _dd.sdk.otlp_export=true and datadog.sdk.semantics as resource attributes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Overall package sizeSelf size: 9.21 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.5.1 | 127.66 kB | 513.61 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10482 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 1047 1047
Lines 166704 166755 +51
Branches 74 74
=======================================
+ Hits 164662 164713 +51
Misses 2042 2042
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:
|
🎉 All green!🧪 All tests passed 🔄 Datadog retried 2 tests - 2 passed on retry 🎯 Code Coverage (details) 🔗 Commit SHA: e7eb884 | Docs | View more details | Give us feedback! |
BenchmarksBenchmark execution time: 2026-09-24 20:39:29 Comparing candidate commit e7eb884 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2303 metrics, 10 unstable metrics.
|
Move _dd.sdk.otlp_export=false out of the v0.4/v0.5 encoders and into span formatting, next to _dd.tags.process, so it is written on the first span of each chunk without copying meta or tracking payload state. It is skipped when traces are exported over OTLP, which the tracer already decides when it picks the exporter. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ilter Compute whether traces go out over OTLP in SpanProcessor from config, next to process tags, instead of widening its constructor. Stop stripping the adoption marker keys from OTLP span attributes, matching dd-trace-java; the resource values are still set after global tags so they cannot be overridden. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Test Optimization and Electron overrides send spans to intakes that do not feed the ingestion metric, so the extra conditions add nothing that intake uses. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Preserve the native marker against user-tag overwrites and make the semantics test environment-independent.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds OTLP export and semantic-convention markers to native and OTLP trace payloads.
Changes:
- Adds native markers to the first span of each chunk.
- Adds OTLP resource attributes for export mode and semantics.
- Adds processor, formatting, and resource-marker tests.
| File | Description |
|---|---|
packages/dd-trace/test/span_processor.spec.js |
Tests marker selection and chunk behavior. |
packages/dd-trace/test/span_format.spec.js |
Tests native marker placement. |
packages/dd-trace/test/opentelemetry/traces.spec.js |
Tests OTLP resource markers and precedence. |
packages/dd-trace/src/span_processor.js |
Selects marker behavior by exporter. |
packages/dd-trace/src/span_format.js |
Emits native export markers. |
packages/dd-trace/src/opentelemetry/trace/index.js |
Adds OTLP resource attributes. |
packages/dd-trace/src/constants.js |
Defines marker keys. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7eb884d11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


What does this PR do?
Adds two wire markers that let the backend attribute ingested spans to the SDK's export path and semantic conventions:
_dd.sdk.otlp_export:"false"goes into the meta of the first span of each chunk. It's written inextractChunkTagsduring span formatting, next to_dd.tags.process, so the v0.4/v0.5 encoders are unchanged. TheSpanProcessorskips the marker whenOTEL_TRACES_EXPORTER=otlp."true"is added as a resource attribute inbuildResourceAttributes.datadog.sdk.semantics, an OTLP resource attribute:"otel"whenDD_TRACE_OTEL_SEMANTICS_ENABLEDis on,"datadog"otherwise.Both resource attributes are set after the global tags are merged, so a global tag can't override them. Matching dd-trace-java, span tags with either key are not stripped from OTLP span attributes.
Motivation
Today, "how many customers run Datadog SDKs emitting OTLP" is answered by
dd.trace.intake.ingested_spans, tagged withsdk_name/span_source. Those tags are inferred at ingest time rather than declared by the tracer. Thedatadogreceiverhardcodestelemetry.sdk.name:Datadogon native payloads it converts, so a native payload that only passed through a Collector looks the same as one a Datadog SDK exported over OTLP. Andspan_sourcerecords which endpoint the payload reached, not the tracer's export mode.Declaring both modes on the wire lets the backend resolve them into explicit tags and measure adoption directly. Related changes: DataDog/dd-trace-java#12516, DataDog/dd-trace-dotnet#9310 and DataDog/dd-trace-go#5436.
Additional Notes
"false"means native Datadog export, so the only check isOTEL_TRACES_EXPORTER !== 'otlp'. Test Optimization and Electron overrideotlpand use their own exporters. Test Optimization sends to the citestcycle intake, whose spans are excluded fromdd.trace.intake.ingested_spans, and Electron sends to the browser intake. So withotlpset they simply get no marker, and intake counts them as unknown export mode; they never get a wrong value._dd.sdk.otlp_exportinto the outgoing payload,logs-backendpropagates it into chunk tags, anddd-goresolves it into thedatadog.sdk.otlp_exportmetric tag. The wire marker and the metric tag are named differently on purpose.span_format.spec.js: the marker is on the first span of each chunk only.span_processor.spec.js: the marker is requested for the first span of each chunk, including after a partial flush, and not for OTLP export.opentelemetry/traces.spec.js: the resource markers, the semantics switch, and that global tags can't override them.eslint --max-warnings 0on changed files passes. An earlier revision ran the fullnpm run test:trace:coresuite, where the only failure wasprocess-tags.spec.js:104, which fails locally only because the worktree directory isn't nameddd-trace-js; the full suite hasn't been re-run on the final gating change.🤖 Generated with Claude Code