fix(propagation): honor OTEL B3 injection on v5 #10892
Overall package size
Self size: 9.7 MB
Deduped: 10.44 MB
No deduping: 10.44 MB
<details><summary>Dependency sizes</summary>
| name | version | self size | total size |
|------|---------|-----------|------------|
| import-in-the-middle | 3.5.1 | 127.66 kB | 528.28 kB |
| opentracing | 0.14.7 | 194.81 kB | 194.81 kB |
| dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |
</details>
<sub>🤖 This report was automatically generated by heaviest-objects-in-the-universe<sub>
<a target='_blank' href='https://app.datadoghq.com/ci/pipeline-executions?query=ci_level%3Ajob+%40git.commit.sha%3A6b88986ede6f8077c1d426fb7a1c658525696c87&referrer=pr-comment&start=1793030535000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok-light.svg" alt="Pipelines" align="center" /></picture></a> <a target='_blank' href='https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest+%40git.commit.sha%3A9e3a99801f1c8b03a7bad58349fdbbbd914f99eb&referrer=pr-comment&start=1793030535000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok-light.svg" alt="Tests" align="center" /></picture></a>
<details><summary><b>🎉 All green!</b></summary>
🧪 All tests passed
❄️ No new flaky tests detected
</details>
🔄 Datadog retried 2 tests - 2 passed on retry <a href="https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest+%40git.commit.sha%3A9e3a99801f1c8b03a7bad58349fdbbbd914f99eb+%40test.is_retry%3Atrue+AND+%28%40test.retry_reason%3Aauto_test_retry+OR+%28-%40test.retry_reason%3A%2A+AND+-%40test.is_new%3Atrue%29%29&referrer=pr-comment" title="View in Datadog"><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/datadog_icon.svg" alt="View in Datadog" align="center" /></a>
🎯 Code Coverage (<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdd-trace-js/pull-requests/10892'>details</a>)<br>• <strong><span title="Percentage of modified executable lines covered by tests in this PR">Patch Coverage</span></strong>: 100.00%<br>• <strong><span title="Percentage of all executable lines covered by tests in the entire codebase">Overall Coverage</span></strong>: 98.36%<br>
<sub>
This comment will be updated automatically if new data arrives. <br />
🔗 Commit SHA: 6b88986 | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | <a href="https://app.datadoghq.com/ci/pull-request/Z2l0aHViLmNvbS9kYXRhZG9nL2RkLXRyYWNlLWpzLzEwODky?referrer=pr-comment">View more details</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
</sub>
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 98.96%. Comparing base (
1fae4a7) to head (6b88986).:warning: Report is 33 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
@@ Coverage Diff @@
## master #10892 +/- ##
==========================================
+ Coverage 93.61% 98.96% +5.34%
==========================================
Files 1068 1069 +1
Lines 175077 175456 +379
Branches 72 72
==========================================
+ Hits 163906 173638 +9732
+ Misses 11170 1817 -9353
Partials 1 1
| Flag | Coverage Δ | |
|---|---|---|
| ai-guard | 63.60% <47.87%> (-0.09%) | :arrow_down: |
| apm-capabilities | 54.82% <100.00%> (+0.08%) | :arrow_up: |
| apm-integrations | 80.86% <47.87%> (?) | |
| appsec | 57.26% <47.87%> (+0.04%) | :arrow_up: |
| debugger | 70.82% <45.74%> (-0.10%) | :arrow_down: |
| instrumentation | 55.39% <47.87%> (+0.07%) | :arrow_up: |
| llmobs | 81.32% <47.87%> (-0.11%) | :arrow_down: |
| master-coverage | 98.96% <100.00%> (?) | |
| openfeature | 67.31% <47.87%> (-0.10%) | :arrow_down: |
| platform | 68.35% <47.87%> (-0.07%) | :arrow_down: |
| profiling | 65.84% <45.74%> (-0.09%) | :arrow_down: |
| serverless | 64.85% <47.87%> (-0.07%) | :arrow_down: |
| test-optimization | 82.04% <100.00%> (+0.10%) | :arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
</details>
:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
Benchmarks
Benchmark execution time: 2026-10-26 16:49:14
Comparing candidate commit 6b88986ede6f8077c1d426fb7a1c658525696c87 in PR branch rochdev/fix-v5-otel-b3-injection with baseline commit 1fae4a7fd99d0647f8627657c790b0d4815a68ec in branch master.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 2446 metrics, 11 unstable metrics.
<details>
<summary><h3>Explanation</h3></summary>
This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:
🟩 = significantly better candidate vs. baseline
🟥 = significantly worse candidate vs. baseline
We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.
If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.
Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.
<details>
<summary><h4>More details about the CI and significant changes</h4></summary>
You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.
CIs of the difference of means are often centered around 0%, because often changes are not that big:
---------------------------------(------|---^--------)-------------------------------->
-0.6% 0% 0.3% +1.2%
| | |
lower bound of the CI --' | |
sample mean (center of the CI) -------------' |
upper bound of the CI ----------------------'
As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).
For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:
----------------------------------------|---------|---(---------^---------)---------->
0% 1% 1.3% 2.2% 3.1%
| | | |
significant impact threshold --------------' | | |
lower bound of CI --------------' | |
sample mean (center of the CI) --------------------------' |
upper bound of CI ----------------------------------'
</details>
</details>
<details>
<summary><h3>Unstable benchmarks</h3></summary>
These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.
scenario:appsec-appsec-enabled-20
max_rss_usage [-91.497MB; -24.795MB] or [-40.307%; -10.923%]scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20
max_rss_usage [-30.675MB; +36.603MB] or [-8.527%; +10.175%]scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-26
max_rss_usage [-30.270MB; +25.764MB] or [-9.876%; +8.406%]scenario:debugger-line-probe-with-snapshot-default-20
max_rss_usage [-6.982MB; +9.622MB] or [-5.080%; +7.000%]scenario:encoders-0.4-immediate-flush-20
max_rss_usage [-10662.944KB; +10538.944KB] or [-12.868%; +12.718%]scenario:openfeature-scale-full-24
max_rss_usage [-31.286MB; +27.591MB] or [-10.283%; +9.069%]scenario:plugin-graphql-long-with-depth-off-26
cpu_user_time [-605.176ms; +475.667ms] or [-8.847%; +6.954%]execution_time [-635.720ms; +488.359ms] or [-9.103%; +6.993%]max_rss_usage [-55.130MB; +19.782MB] or [-22.377%; +8.029%]throughput [-21.944op/s; +31.246op/s] or [-6.759%; +9.624%]scenario:plugin-graphql-long-with-depth-on-max-26
max_rss_usage [-6.774MB; +21.078MB] or [-2.633%; +8.193%]</details>
<!-- codex-pull-request-review-summary -->
<!-- codex-review-state:v1 {"code_review":{"commit_sha":"6b88986ede6f8077c1d426fb7a1c658525696c87","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-10-26T19:34:41.930913Z">2026-10-26T19:34:41.930913Z</relative-time> | 6b88986 | Draft marked ready |
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your 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.
</details>
<sub><sub>!P1 Badge</sub></sub> Remove the primitive return annotation
Remove this @returns tag from the newly added method: its return value is primitive (string|undefined), for which the repository explicitly prohibits @return/@returns annotations; retain the typed @param annotation.
AGENTS.md reference: AGENTS.md:L105-L108
Useful? React with 👍 / 👎.
<!-- codex-code-review-finding:v1 -->
<!-- codex-review-receipt:v1 -->
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e2240ca8d
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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".
</details>
<!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
<!-- datadog-autotest-inline:v1:prod -->
<!-- datadog-autotest-delivery:v1:prod:cded68282fdcee0eb3e41d90ec1f0dabc250f3dafb10bc48a28846013a322842:inline-0 -->
<sub><sub>!P2</sub></sub> Update standalone fixtures for the new v5 origin lookup
<!-- autotest-finding-meta source=static_analysis prod_data_type=none production_evidence_effect=none finding_id=5a2b7f32-ce21-4a6f-b107-19b313f38490 -->
On v5, construction now unconditionally calls getOrigin(), even when B3 is disabled. Existing extraction and injection tests in packages/dd-trace/test/standalone/index.spec.js pass plain configuration fixtures without that method, so they now throw TypeError before reaching their assertions. A focused base/head comparison confirmed the regression. Update the standalone fixtures to supply the new configuration contract.
<!-- datadog-autotest-feedback-legend:v1 -->
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
<details><summary>What each reaction means</summary>
</details>
<sub>🤖 Bits Code Review</sub> <sub>· <a href="https://app.datadoghq.com/code/b1751a09-71f9-4931-834c-2be7d27ea920?referrer=autotest-pr-comment">Open Bits AI session</a></sub>
<!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
<!-- datadog-autotest-inline:v1:prod -->
<!-- datadog-autotest-delivery:v1:prod:cded68282fdcee0eb3e41d90ec1f0dabc250f3dafb10bc48a28846013a322842:inline-1 -->
<sub><sub>!P2</sub></sub> Remote DD_TRACE_PROPAGATION_STYLE_INJECT=b3 override retains single-header B3 when OTEL_PROPAGATORS=b3 is set
<!-- autotest-finding-meta source=static_analysis prod_data_type=none production_evidence_effect=none finding_id=b167b6ae-f40f-4d44-9d7e-39017cc12771 -->
When OTEL_PROPAGATORS=b3 is set at startup on v5, tracePropagationStyle.inject is populated via fallbackConfigurations and recorded in changeTracker.calculated. If config.setRemoteConfig({ DD_TRACE_PROPAGATION_STYLE_INJECT: 'b3' }) is later called, Config.#applyCalculated() runs undo(this, 'calculated'), which reverts every previously calculated key back to changeTracker.baseValuesByPath (discarding the remote_config entry) and re-applies the DD_TRACE_PROPAGATION_STYLE fallback with origin 'calculated'. Because origin remains 'calculated' and sharedOrigin remains 'env_var', #refreshB3InjectionStyle() returns early and continues emitting single-header b3 instead of switching to legacy x-b3-* multi-header injection. The new unit test 'should refresh the injection style after remote configuration' does not catch this because it stubs config.getOrigin('tracePropagationStyle.inject') to return 'remote_config' directly.
<!-- datadog-autotest-feedback-legend:v1 -->
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
<details><summary>What each reaction means</summary>
</details>
<sub>🤖 Bits Code Review</sub> <sub>· <a href="https://app.datadoghq.com/code/b1751a09-71f9-4931-834c-2be7d27ea920?referrer=autotest-pr-comment">Open Bits AI session</a></sub>
Two distinct issues were found: standalone test fixtures lack the getOrigin() method now required by the v5 construction path, causing TypeErrors before assertions run; and #refreshB3InjectionStyle() fails to switch injection style after a remote config override when OTEL_PROPAGATORS=b3 is set at startup, because the origin stays 'calculated' rather than becoming 'remote_config'.
<sub>Open Bits AI session</sub>
<sub>🤖 Bits Code Review · Commit 3e2240c</sub>
<!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=FAIL ddrs_bucket=unknown session_id=b1751a09-71f9-4931-834c-2be7d27ea920 -->
<!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
<!-- datadog-autotest:v1:prod -->
<!-- datadog-autotest-delivery:v1:prod:cded68282fdcee0eb3e41d90ec1f0dabc250f3dafb10bc48a28846013a322842:bundle -->
Fixed calculated rollback so it only reverts values still owned by the calculated source, preserving a higher-priority remote_config override. Added a regression test using the real Config path that applies and removes DD_TRACE_PROPAGATION_STYLE_INJECT while OTEL_PROPAGATORS is set. This is included in commit 6b88986ede.
Generated by Codex.
Updated the propagator to treat getOrigin as optional and use the legacy v5 fallback for duck-typed configuration objects. Added regression coverage for a configuration without origin tracking. This is included in commit 6b88986ede.
Generated by Codex.
Removed the primitive @returns annotation while retaining the typed parameter, as requested. This is included in commit 6b88986ede.
Generated by Codex.
<details>
<summary>More details</summary>
Static review and isolated checks support the intended B3 format selection across configuration precedence and remote-config rollback. The human PR discussion supplied no reason to change that conclusion.
</details>
Was this helpful? React 👍 or 👎
<sub>Open Bits AI session</sub>
<sub>🤖 Bits Code Review · Commit 6b88986</sub>
<!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=PASS ddrs_bucket=unknown session_id=536b5ed7-54cd-4e9a-87a0-f2bfde46748a -->
<!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
<!-- datadog-autotest:v1:prod -->
<!-- datadog-autotest-delivery:v1:prod:3e0c39a79d3b67f53b8d7cd11e1f43951b34f85fd7dc603d9156a689fb7fcc08:bundle -->
Approved these changes.
pabloerhard
rochdev
What does this PR do?
Makes v5 resolve the
b3injection wire format from the effective configuration source:OTEL_PROPAGATORS=b3emits the singleb3header.b3settings retain the legacyx-b3-headers.Motivation
System tests exposed that v5 already extracted
OTEL_PROPAGATORS=b3as single-header B3 but injected it as multi-header B3. This made cross-process propagation asymmetric and caused the v5 release-line failure in DataDog/dd-trace-js#10768.Additional Notes
Validation:
masterfound no actionable issues.Generated by Codex.*