Skip to content

fix(opentelemetry): wrap sdk-trace TracerProvider for sdk-node 0.220+#9255

Merged
BridgeAR merged 2 commits into
masterfrom
BridgeAR/2026-07-08-otel-sdk-trace-provider-hook
Jul 8, 2026
Merged

fix(opentelemetry): wrap sdk-trace TracerProvider for sdk-node 0.220+#9255
BridgeAR merged 2 commits into
masterfrom
BridgeAR/2026-07-08-otel-sdk-trace-provider-hook

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

@opentelemetry/sdk-node 0.220.0 builds its provider from @opentelemetry/sdk-trace's TracerProvider instead of sdk-trace-node's NodeTracerProvider. The existing hook only wraps NodeTracerProvider, so under DD_TRACE_OTEL_ENABLED the OTel-bridged spans stop reaching the tracer on 0.220+. This wraps the sdk-trace TracerProvider export too, keeping the older hook for pre-0.220 and direct NodeTracerProvider users.

Surfaced by the version bump in #9247, whose integration jobs fail on should auto-instrument @opentelemetry/sdk-node with a fake-agent timeout (the otel-sub span never arrives).

Why

master pins @opentelemetry/sdk-node at 0.219.0 in the test-versions folder, so this PR's own integration CI still installs 0.219 and won't exercise the new path. Verified locally against 0.220.0: the existing integration test times out without this change and passes with it. #9247 becomes the end-to-end guard once it rebases on top.

@opentelemetry/sdk-node 0.220.0 builds its provider from
@opentelemetry/sdk-trace's TracerProvider instead of sdk-trace-node's
NodeTracerProvider, so the existing hook no longer intercepts it and
DD_TRACE_OTEL_ENABLED spans are silently dropped. Hook the new export too.
@dd-octo-sts

dd-octo-sts Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.65 MB
Deduped: 7.31 MB
No deduping: 7.31 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 437.94 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

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jul 8, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.50% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: cf78a9a | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.54%. Comparing base (a619775) to head (cf78a9a).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9255      +/-   ##
==========================================
- Coverage   96.54%   96.54%   -0.01%     
==========================================
  Files         915      915              
  Lines      121018   121034      +16     
  Branches    20693    20817     +124     
==========================================
+ Hits       116837   116851      +14     
- Misses       4181     4183       +2     
Flag Coverage Δ
aiguard 53.57% <100.00%> (-0.05%) ⬇️
aiguard-integration 57.01% <100.00%> (+<0.01%) ⬆️
apm-bucket-0 53.80% <100.00%> (-0.05%) ⬇️
apm-bucket-1 58.11% <100.00%> (-0.05%) ⬇️
apm-bucket-2 56.13% <100.00%> (-0.05%) ⬇️
apm-capabilities-tracing 60.30% <100.00%> (+<0.01%) ⬆️
apm-integrations-aerospike 52.95% <100.00%> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.08% <100.00%> (+0.02%) ⬆️
apm-integrations-couchbase 53.27% <100.00%> (-0.05%) ⬇️
apm-integrations-http 57.99% <100.00%> (-0.04%) ⬇️
apm-integrations-kafkajs 57.73% <100.00%> (-0.07%) ⬇️
apm-integrations-next 54.25% <100.00%> (-0.05%) ⬇️
apm-integrations-prisma 54.19% <100.00%> (-0.05%) ⬇️
apm-integrations-tedious 53.05% <100.00%> (-0.05%) ⬇️
appsec 69.03% <100.00%> (-0.11%) ⬇️
appsec-express_fastify_graphql 65.70% <100.00%> (-0.04%) ⬇️
appsec-integration 45.50% <6.25%> (-0.01%) ⬇️
appsec-kafka_ldapjs_lodash 59.13% <100.00%> (-0.04%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.29% <100.00%> (-0.04%) ⬇️
appsec-next 52.86% <100.00%> (-0.04%) ⬇️
appsec-node-serialize_passport_postgres 61.93% <100.00%> (-0.04%) ⬇️
appsec-sourcing_stripe_template 60.28% <100.00%> (-0.04%) ⬇️
debugger 65.70% <100.00%> (-0.02%) ⬇️
instrumentations-bucket-0 48.75% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-1 54.98% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-10 56.65% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-11 48.75% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-12 48.85% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-13 48.68% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-2 49.74% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-3 53.84% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-4 49.17% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-5 53.02% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-6 55.63% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-7 53.61% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-8 54.65% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-9 56.13% <100.00%> (-0.03%) ⬇️
instrumentations-instrumentation-couchbase 48.18% <100.00%> (-0.05%) ⬇️
instrumentations-integration-esbuild 33.90% <6.25%> (-0.01%) ⬇️
llmobs-ai_anthropic_bedrock 57.76% <100.00%> (-0.04%) ⬇️
llmobs-bucket-1 56.82% <100.00%> (-0.04%) ⬇️
llmobs-openai 57.59% <100.00%> (-0.04%) ⬇️
llmobs-sdk 60.00% <100.00%> (-0.05%) ⬇️
llmobs-vertex-ai 54.23% <100.00%> (-0.05%) ⬇️
master-coverage 96.54% <100.00%> (?)
openfeature 54.62% <100.00%> (+<0.01%) ⬆️
openfeature-unit 49.83% <100.00%> (-0.05%) ⬇️
platform-core_esbuild_instrumentations-misc 38.38% <6.25%> (-0.04%) ⬇️
platform-integration 62.20% <75.00%> (+<0.01%) ⬆️
platform-shimmer_unit-guardrails_webpack 37.18% <6.25%> (-0.04%) ⬇️
plugins-bucket-0 53.19% <100.00%> (-0.04%) ⬇️
plugins-bucket-1 55.08% <100.00%> (+<0.01%) ⬆️
plugins-bucket-11 56.74% <100.00%> (-0.06%) ⬇️
plugins-bucket-17 56.76% <100.00%> (-0.05%) ⬇️
plugins-bucket-18 57.61% <100.00%> (-0.05%) ⬇️
plugins-bucket-19 57.15% <100.00%> (-0.05%) ⬇️
plugins-bucket-20 59.39% <100.00%> (-0.05%) ⬇️
plugins-bucket-4 53.86% <100.00%> (-0.05%) ⬇️
plugins-bullmq_cassandra_cookie 57.41% <100.00%> (-0.05%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 52.33% <100.00%> (-0.05%) ⬇️
plugins-fetch_fs_generic-pool 54.47% <100.00%> (-0.13%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 59.90% <100.00%> (-0.05%) ⬇️
plugins-hapi_hono_ioredis 55.88% <100.00%> (-0.05%) ⬇️
plugins-jest_knex_langgraph 51.67% <100.00%> (-0.05%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 53.45% <100.00%> (-0.03%) ⬇️
plugins-lodash_mariadb_memcached 54.22% <100.00%> (-0.05%) ⬇️
plugins-mongodb_mongodb-core_mongoose 55.47% <100.00%> (-0.05%) ⬇️
plugins-multer_mysql_mysql2 54.38% <100.00%> (-0.05%) ⬇️
plugins-nats_node-serialize_opensearch 56.08% <100.00%> (-0.05%) ⬇️
plugins-passport-http_pino_postgres 54.76% <100.00%> (-0.05%) ⬇️
plugins-process_pug_redis 53.89% <100.00%> (-0.05%) ⬇️
plugins-undici_url_valkey 54.39% <100.00%> (-0.05%) ⬇️
plugins-vm_winston_ws 55.29% <100.00%> (-0.05%) ⬇️
profiling 58.22% <100.00%> (-0.04%) ⬇️
serverless-aws-sdk-aws-sdk 50.67% <100.00%> (-0.04%) ⬇️
serverless-aws-sdk-bedrockruntime 50.69% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-client 51.96% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-dynamodb 51.76% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-eventbridge 46.22% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-kinesis 54.71% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-lambda 52.79% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-s3 51.53% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.74% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-sns 55.49% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-sqs 55.92% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-stepfunctions 51.26% <100.00%> (-0.05%) ⬇️
serverless-aws-sdk-util 48.46% <100.00%> (-0.05%) ⬇️
serverless-bucket-0 55.24% <100.00%> (-0.01%) ⬇️
serverless-bucket-1 56.03% <100.00%> (-0.05%) ⬇️
test-optimization-cucumber 72.92% <100.00%> (-0.06%) ⬇️
test-optimization-cypress 66.45% <6.25%> (+0.06%) ⬆️
test-optimization-jest 73.91% <100.00%> (-0.05%) ⬇️
test-optimization-mocha 74.32% <100.00%> (+0.05%) ⬆️
test-optimization-playwright-playwright-atr 61.59% <100.00%> (-0.01%) ⬇️
test-optimization-playwright-playwright-efd 61.78% <100.00%> (+<0.01%) ⬆️
test-optimization-playwright-playwright-final-status 61.73% <100.00%> (-0.01%) ⬇️
test-optimization-playwright-playwright-impacted-tests 61.46% <100.00%> (+0.16%) ⬆️
test-optimization-playwright-playwright-reporting 61.36% <100.00%> (-0.20%) ⬇️
test-optimization-playwright-playwright-test-management 62.27% <100.00%> (-0.12%) ⬇️
test-optimization-playwright-playwright-test-span 61.50% <100.00%> (-0.06%) ⬇️
test-optimization-selenium 60.70% <100.00%> (-0.17%) ⬇️
test-optimization-testopt 59.15% <100.00%> (+0.08%) ⬆️
test-optimization-vitest 72.76% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter

pr-commenter Bot commented Jul 8, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-08 10:24:42

Comparing candidate commit cf78a9a in PR branch BridgeAR/2026-07-08-otel-sdk-trace-provider-hook with baseline commit a619775 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2312 metrics, 46 unstable metrics.

Explanation

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.

More details about the CI and significant changes

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 ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-171.527ms; +224.829ms] or [-6.544%; +8.578%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-231.846ms; +172.436ms] or [-9.248%; +6.878%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-152.256ms; +166.854ms] or [-4.926%; +5.399%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-153.171ms; +206.248ms] or [-5.311%; +7.151%]

scenario:appsec-control-20

  • unstable execution_time [-118.097ms; +131.837ms] or [-7.254%; +8.098%]

scenario:appsec-control-24

  • unstable execution_time [-114.801ms; +117.899ms] or [-9.260%; +9.510%]

scenario:appsec-control-26

  • unstable execution_time [-124.404ms; +132.739ms] or [-10.102%; +10.778%]

scenario:appsec-iast-with-vulnerability-control-20

  • unstable execution_time [-25.387ms; +30.305ms] or [-4.585%; +5.473%]

scenario:debugger-line-probe-with-snapshot-default-24

  • unstable cpu_user_time [-2737.062ms; +2582.768ms] or [-30.224%; +28.520%]
  • unstable execution_time [-2857.246ms; +2731.035ms] or [-29.267%; +27.974%]
  • unstable instructions [-23319.9M instructions; +22027.4M instructions] or [-31.426%; +29.684%]
  • unstable max_rss_usage [-11677.154KB; +11201.954KB] or [-7.335%; +7.036%]
  • unstable throughput [-700.793op/s; +769.608op/s] or [-20.428%; +22.433%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-3625.795ms; +2457.467ms] or [-34.246%; +23.211%]
  • unstable execution_time [-3641.943ms; +2483.576ms] or [-32.155%; +21.928%]
  • unstable instructions [-32.3G instructions; +21.4G instructions] or [-36.290%; +24.055%]
  • unstable max_rss_usage [-11.350MB; +7.274MB] or [-6.982%; +4.474%]
  • unstable throughput [-539.344op/s; +786.012op/s] or [-18.065%; +26.328%]

scenario:debugger-line-probe-with-snapshot-minimal-24

  • unstable cpu_user_time [-1.248s; +4.164s] or [-13.217%; +44.112%]
  • unstable execution_time [-1.206s; +4.184s] or [-11.882%; +41.226%]
  • unstable instructions [-10.6G instructions; +35.4G instructions] or [-13.745%; +45.802%]
  • unstable max_rss_usage [-5.464MB; +17.884MB] or [-3.395%; +11.111%]
  • unstable throughput [-1158.925op/s; +329.920op/s] or [-35.161%; +10.009%]

scenario:debugger-line-probe-with-snapshot-minimal-26

  • unstable cpu_user_time [-3.543s; +0.470s] or [-34.346%; +4.556%]
  • unstable execution_time [-3.548s; +0.486s] or [-32.145%; +4.400%]
  • unstable instructions [-31.6G instructions; +4.3G instructions] or [-36.622%; +4.932%]
  • unstable throughput [-99.776op/s; +697.866op/s] or [-3.244%; +22.688%]

scenario:debugger-line-probe-without-snapshot-24

  • unstable cpu_user_time [-2925.601ms; +2807.133ms] or [-29.594%; +28.395%]
  • unstable execution_time [-3007.638ms; +2858.593ms] or [-28.347%; +26.942%]
  • unstable instructions [-24740.0M instructions; +23689.2M instructions] or [-30.337%; +29.048%]
  • unstable max_rss_usage [-11946.184KB; +11132.584KB] or [-7.342%; +6.842%]
  • unstable throughput [-795.588op/s; +838.856op/s] or [-24.965%; +26.323%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-2995.525ms; +2968.229ms] or [-29.991%; +29.718%]
  • unstable execution_time [-3126502.817µs; +3126748.417µs] or [-29.207%; +29.210%]
  • unstable instructions [-25771.2M instructions; +25593.7M instructions] or [-30.854%; +30.641%]
  • unstable max_rss_usage [-8432.500KB; +8644.500KB] or [-5.247%; +5.379%]
  • unstable throughput [-660.227op/s; +677.072op/s] or [-21.083%; +21.621%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-236.065ms; +393.024ms] or [-4.758%; +7.921%]
  • unstable execution_time [-232.880ms; +391.833ms] or [-4.622%; +7.777%]
  • unstable throughput [-135362.466op/s; +76760.853op/s] or [-8.128%; +4.609%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-26

  • unstable cpu_usage_percentage [-6.619%; +5.983%]

scenario:plugin-graphql-long-with-depth-off-20

  • unstable max_rss_usage [-4.654MB; +8.502MB] or [-3.639%; +6.647%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable cpu_user_time [-714.525ms; +688.697ms] or [-5.574%; +5.373%]
  • unstable execution_time [-717.998ms; +677.741ms] or [-5.479%; +5.172%]
  • unstable throughput [-3.139op/s; +3.313op/s] or [-5.112%; +5.394%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-5604.672KB; +5369.338KB] or [-6.905%; +6.615%]

The hook-registration tests re-encoded the source: stubbed datadog-shimmer,
pinned the addHook file/version literals, and counted the calls, so a refactor
that merged the two hooks or renamed a hooked path broke them without any
behavior change. Run the real shimmer over the captured transforms and assert
each SDK provider export becomes the dd-trace TracerProvider instead. Coupling
stays on the OTel packages' public export names, not our internal wiring.
@BridgeAR
BridgeAR marked this pull request as ready for review July 8, 2026 10:19
@BridgeAR
BridgeAR requested a review from a team as a code owner July 8, 2026 10:19
@BridgeAR
BridgeAR requested review from tlhunter and removed request for a team July 8, 2026 10:19
@BridgeAR
BridgeAR merged commit 45d6d19 into master Jul 8, 2026
688 of 689 checks passed
@BridgeAR
BridgeAR deleted the BridgeAR/2026-07-08-otel-sdk-trace-provider-hook branch July 8, 2026 18:37
This was referenced Jul 9, 2026
juan-fernandez pushed a commit that referenced this pull request Jul 10, 2026
…#9255)

@opentelemetry/sdk-node 0.220.0 builds its provider from
@opentelemetry/sdk-trace's TracerProvider instead of sdk-trace-node's
NodeTracerProvider, so the existing hook no longer intercepts it and
DD_TRACE_OTEL_ENABLED spans are silently dropped. Hook the new export too.
juan-fernandez pushed a commit that referenced this pull request Jul 10, 2026
…#9255)

@opentelemetry/sdk-node 0.220.0 builds its provider from
@opentelemetry/sdk-trace's TracerProvider instead of sdk-trace-node's
NodeTracerProvider, so the existing hook no longer intercepts it and
DD_TRACE_OTEL_ENABLED spans are silently dropped. Hook the new export too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants