Skip to content

fix(types): import opentracing from the consumer's installed package - #8525

Merged
BridgeAR merged 2 commits into
masterfrom
BridgeAR/2026-05-18-fix-vendored-opentracing-types
May 19, 2026
Merged

fix(types): import opentracing from the consumer's installed package#8525
BridgeAR merged 2 commits into
masterfrom
BridgeAR/2026-05-18-fix-vendored-opentracing-types

Conversation

@BridgeAR

@BridgeAR BridgeAR commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

opentracing.initGlobalTracer(tracer) fails to type-check because dd-trace's public types reach into ./vendor/dist/opentracing while consumers reach into their own node_modules/opentracing. opentracing's Reference / Tracer / Span declare protected members, so the two copies are nominally distinct classes and the dd-trace Tracer is not a subtype of the consumer's opentracing.Tracer.

index.d.ts imports from "opentracing" directly and the package becomes a regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both dd-trace and the consumer resolve to, and TypeScript dedupes the nominal class identity by name@version Package ID, so initGlobalTracer(tracer) accepts dd-trace's Tracer. The range is >=0.14.0 rather than >=0.14.7 to widen the hoist window for consumers pinned to an older patch — the repository was archived on 2023-05-23 and the type surface is identical across 0.14.0–0.14.7.

The vendored type copy and its rspack build step are dropped; dd-trace's runtime never required the package.

Test plan

  • cd docs && yarn testtsc -p . against the user-facing import 'opentracing' is the regression assertion; fails on master, passes here.
  • mocha packages/dd-trace/test/scope.spec.js packages/dd-trace/test/opentracing/**/*.spec.js — 228 passing / 2 pending (pre-existing).
  • yarn lint — green (license check, eslint, docker checks).
  • Sandbox install (bun add file:dd-trace.tgz --linker=hoisted) hoists a single opentracing next to dd-trace; tsc --target ES6 ... noop.ts compiles cleanly without a consumer-level opentracing install — confirms the dep auto-installs and resolves at the consumer's tree.
  • Regression check that an optional peer dependency would not work: with peerDependenciesMeta.optional: true and no top-level opentracing install, tsc fails with TS2307: Cannot find module 'opentracing' on the consumer's index.d.ts resolution — confirming the bot's pushback and motivating the move to a regular dep.

Fixes: #8523
Refs: #6958

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.29%. Comparing base (806f177) to head (d6edf39).
⚠️ Report is 27 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #8525       +/-   ##
===========================================
- Coverage   89.70%   46.29%   -43.41%     
===========================================
  Files         844      271      -573     
  Lines       45432    16094    -29338     
  Branches     8453     3664     -4789     
===========================================
- Hits        40754     7451    -33303     
- Misses       4678     8643     +3965     
Flag Coverage Δ
aiguard-integration-active ?
aiguard-integration-latest ?
aiguard-integration-maintenance ?
aiguard-macos ?
aiguard-ubuntu ?
aiguard-windows ?
apm-capabilities-tracing-macos ?
apm-capabilities-tracing-ubuntu-active ?
apm-capabilities-tracing-ubuntu-latest ?
apm-capabilities-tracing-ubuntu-oldest ?
apm-capabilities-tracing-windows ?
apm-integrations-aerospike-18-gte.5.2.0 ?
apm-integrations-aerospike-20-gte.5.5.0 ?
apm-integrations-aerospike-22-gte.5.12.1 ?
apm-integrations-aerospike-22-gte.6.0.0 ?
apm-integrations-aerospike-eol- ?
apm-integrations-child-process ?
apm-integrations-confluentinc-kafka-javascript-18 ?
apm-integrations-confluentinc-kafka-javascript-20 ?
apm-integrations-confluentinc-kafka-javascript-22 ?
apm-integrations-confluentinc-kafka-javascript-24 ?
apm-integrations-couchbase-18 ?
apm-integrations-couchbase-eol ?
apm-integrations-dns ?
apm-integrations-elasticsearch ?
apm-integrations-http-latest ?
apm-integrations-http-maintenance ?
apm-integrations-http-oldest ?
apm-integrations-http2 ?
apm-integrations-kafkajs-latest ?
apm-integrations-kafkajs-oldest ?
apm-integrations-net ?
apm-integrations-next-11.1.4 ?
apm-integrations-next-12.3.7 ?
apm-integrations-next-13.0.0 ?
apm-integrations-next-13.2.0 ?
apm-integrations-next-13.5.11 ?
apm-integrations-next-14.0.0 ?
apm-integrations-next-14.2.35 ?
apm-integrations-next-14.2.6 ?
apm-integrations-next-14.2.7 ?
apm-integrations-next-15.0.0 ?
apm-integrations-next-15.4.0 ?
apm-integrations-oracledb ?
apm-integrations-prisma-latest-all ?
apm-integrations-restify ?
apm-integrations-sharedb ?
apm-integrations-tedious ?
appsec-express ?
appsec-fastify ?
appsec-graphql ?
appsec-integration-active ?
appsec-integration-latest ?
appsec-integration-maintenance ?
appsec-integration-oldest ?
appsec-kafka ?
appsec-ldapjs ?
appsec-lodash ?
appsec-macos ?
appsec-mongodb-core ?
appsec-mongoose ?
appsec-mysql ?
appsec-next-latest-11.1.4 ?
appsec-next-latest-12.3.7 ?
appsec-next-latest-13.0.0 ?
appsec-next-latest-13.2.0 ?
appsec-next-latest-13.5.11 ?
appsec-next-latest-14.0.0 ?
appsec-next-latest-14.2.35 ?
appsec-next-latest-14.2.6 ?
appsec-next-latest-14.2.7 ?
appsec-next-latest-15.0.0 ?
appsec-next-latest-latest ?
appsec-next-oldest-11.1.4 ?
appsec-next-oldest-12.3.7 ?
appsec-next-oldest-13.0.0 ?
appsec-next-oldest-13.2.0 ?
appsec-next-oldest-13.5.11 ?
appsec-next-oldest-14.0.0 ?
appsec-next-oldest-14.2.35 ?
appsec-next-oldest-14.2.6 ?
appsec-next-oldest-14.2.7 ?
appsec-next-oldest-15.0.0 ?
appsec-next-oldest-latest ?
appsec-node-serialize ?
appsec-passport ?
appsec-postgres ?
appsec-sourcing ?
appsec-stripe ?
appsec-template ?
appsec-ubuntu ?
appsec-windows ?
debugger-ubuntu-active ?
debugger-ubuntu-latest ?
debugger-ubuntu-maintenance ?
debugger-ubuntu-oldest ?
instrumentations-instrumentation-bluebird ?
instrumentations-instrumentation-body-parser ?
instrumentations-instrumentation-child_process ?
instrumentations-instrumentation-cookie-parser ?
instrumentations-instrumentation-express ?
instrumentations-instrumentation-express-mongo-sanitize ?
instrumentations-instrumentation-express-session ?
instrumentations-instrumentation-fs ?
instrumentations-instrumentation-generic-pool ?
instrumentations-instrumentation-http ?
instrumentations-instrumentation-knex ?
instrumentations-instrumentation-light-my-request ?
instrumentations-instrumentation-mongoose ?
instrumentations-instrumentation-multer ?
instrumentations-instrumentation-mysql2 ?
instrumentations-instrumentation-passport ?
instrumentations-instrumentation-passport-http ?
instrumentations-instrumentation-passport-local ?
instrumentations-instrumentation-pg ?
instrumentations-instrumentation-promise ?
instrumentations-instrumentation-promise-js ?
instrumentations-instrumentation-q ?
instrumentations-instrumentation-url ?
instrumentations-instrumentation-when ?
instrumentations-integration-esbuild-0.16.12-active ?
instrumentations-integration-esbuild-0.16.12-latest ?
instrumentations-integration-esbuild-0.16.12-maintenance ?
instrumentations-integration-esbuild-0.16.12-oldest ?
instrumentations-integration-esbuild-latest-active ?
instrumentations-integration-esbuild-latest-latest ?
instrumentations-integration-esbuild-latest-maintenance ?
instrumentations-integration-esbuild-latest-oldest ?
llmobs-ai ?
llmobs-anthropic ?
llmobs-bedrock ?
llmobs-google-genai ?
llmobs-langchain ?
llmobs-openai-latest ?
llmobs-openai-oldest ?
llmobs-sdk-active ?
llmobs-sdk-latest ?
llmobs-sdk-maintenance ?
llmobs-sdk-oldest ?
llmobs-vertex-ai ?
master-coverage 46.29% <ø> (?)
openfeature-macos ?
openfeature-ubuntu ?
openfeature-unit-active ?
openfeature-unit-latest ?
openfeature-unit-maintenance ?
openfeature-unit-oldest ?
openfeature-windows ?
platform-core ?
platform-esbuild ?
platform-instrumentations-misc ?
platform-integration-active ?
platform-integration-latest ?
platform-integration-maintenance ?
platform-integration-oldest ?
platform-shimmer ?
platform-unit-guardrails ?
platform-webpack ?
plugins-azure-durable-functions ?
plugins-azure-event-hubs ?
plugins-azure-service-bus ?
plugins-bullmq ?
plugins-cassandra ?
plugins-cookie ?
plugins-cookie-parser ?
plugins-crypto ?
plugins-dd-trace-api ?
plugins-express-mongo-sanitize ?
plugins-express-session ?
plugins-fastify ?
plugins-fetch ?
plugins-fs ?
plugins-generic-pool ?
plugins-google-cloud-pubsub ?
plugins-grpc ?
plugins-handlebars ?
plugins-hapi ?
plugins-hono ?
plugins-ioredis ?
plugins-knex ?
plugins-langgraph ?
plugins-ldapjs ?
plugins-light-my-request ?
plugins-limitd-client ?
plugins-lodash ?
plugins-mariadb ?
plugins-memcached ?
plugins-microgateway-core ?
plugins-modelcontextprotocol-sdk ?
plugins-moleculer ?
plugins-mongodb ?
plugins-mongodb-core ?
plugins-mongoose ?
plugins-multer ?
plugins-mysql ?
plugins-mysql2 ?
plugins-node-serialize ?
plugins-opensearch ?
plugins-passport-http ?
plugins-pino ?
plugins-postgres ?
plugins-process ?
plugins-pug ?
plugins-redis ?
plugins-router ?
plugins-sequelize ?
plugins-test-and-upstream-amqp10 ?
plugins-test-and-upstream-amqplib ?
plugins-test-and-upstream-apollo ?
plugins-test-and-upstream-avsc ?
plugins-test-and-upstream-bunyan ?
plugins-test-and-upstream-connect ?
plugins-test-and-upstream-graphql ?
plugins-test-and-upstream-koa ?
plugins-test-and-upstream-protobufjs ?
plugins-test-and-upstream-rhea ?
plugins-undici ?
plugins-url ?
plugins-valkey ?
plugins-vm ?
plugins-winston ?
plugins-ws ?
profiling-macos ?
profiling-ubuntu ?
profiling-windows ?
serverless-aws-sdk-latest-aws-sdk ?
serverless-aws-sdk-latest-bedrockruntime ?
serverless-aws-sdk-latest-client ?
serverless-aws-sdk-latest-dynamodb ?
serverless-aws-sdk-latest-eventbridge ?
serverless-aws-sdk-latest-kinesis ?
serverless-aws-sdk-latest-lambda ?
serverless-aws-sdk-latest-s3 ?
serverless-aws-sdk-latest-serverless-peer-service ?
serverless-aws-sdk-latest-sns ?
serverless-aws-sdk-latest-sqs ?
serverless-aws-sdk-latest-stepfunctions ?
serverless-aws-sdk-latest-util ?
serverless-aws-sdk-oldest-aws-sdk ?
serverless-aws-sdk-oldest-bedrockruntime ?
serverless-aws-sdk-oldest-dynamodb ?
serverless-aws-sdk-oldest-kinesis ?
serverless-aws-sdk-oldest-lambda ?
serverless-aws-sdk-oldest-serverless-peer-service ?
serverless-aws-sdk-oldest-sns ?
serverless-aws-sdk-oldest-sqs ?
serverless-aws-sdk-oldest-stepfunctions ?
serverless-aws-sdk-oldest-util ?
serverless-azure-functions-eventhubs ?
serverless-azure-functions-servicebus ?
serverless-lambda ?
test-optimization-cucumber-latest-7.0.0 ?
test-optimization-cucumber-latest-latest ?
test-optimization-cucumber-oldest-7.0.0 ?
test-optimization-cypress-latest-12.0.0-commonJS ?
test-optimization-cypress-latest-12.0.0-esm ?
test-optimization-cypress-latest-14.5.4-commonJS ?
test-optimization-cypress-latest-14.5.4-esm ?
test-optimization-cypress-latest-latest-commonJS ?
test-optimization-cypress-latest-latest-esm 46.29% <ø> (-2.61%) ⬇️
test-optimization-cypress-oldest-12.0.0-commonJS ?
test-optimization-cypress-oldest-12.0.0-esm ?
test-optimization-cypress-oldest-14.5.4-commonJS ?
test-optimization-cypress-oldest-14.5.4-esm ?
test-optimization-jest-latest-latest ?
test-optimization-jest-latest-oldest ?
test-optimization-jest-oldest-latest ?
test-optimization-jest-oldest-oldest ?
test-optimization-mocha-latest-latest ?
test-optimization-mocha-oldest-latest ?
test-optimization-mocha-oldest-oldest ?
test-optimization-playwright-latest-latest-playwright-active-test-span ?
test-optimization-playwright-latest-latest-playwright-atr ?
test-optimization-playwright-latest-latest-playwright-efd ?
test-optimization-playwright-latest-latest-playwright-final-status ?
test-optimization-playwright-latest-latest-playwright-impacted-tests ?
test-optimization-playwright-latest-latest-playwright-reporting ?
test-optimization-playwright-latest-latest-playwright-test-management ?
test-optimization-playwright-latest-oldest-playwright-active-test-span ?
test-optimization-playwright-latest-oldest-playwright-atr ?
test-optimization-playwright-latest-oldest-playwright-efd ?
test-optimization-playwright-latest-oldest-playwright-impacted-tests ?
test-optimization-playwright-latest-oldest-playwright-reporting ?
test-optimization-playwright-latest-oldest-playwright-test-management ?
test-optimization-playwright-oldest-latest-playwright-active-test-span ?
test-optimization-playwright-oldest-latest-playwright-atr ?
test-optimization-playwright-oldest-latest-playwright-final-status ?
test-optimization-playwright-oldest-latest-playwright-impacted-tests ?
test-optimization-playwright-oldest-latest-playwright-reporting ?
test-optimization-playwright-oldest-latest-playwright-test-management ?
test-optimization-playwright-oldest-oldest-playwright-active-test-span ?
test-optimization-playwright-oldest-oldest-playwright-atr ?
test-optimization-playwright-oldest-oldest-playwright-efd ?
test-optimization-playwright-oldest-oldest-playwright-final-status ?
test-optimization-playwright-oldest-oldest-playwright-reporting ?
test-optimization-playwright-oldest-oldest-playwright-test-management ?
test-optimization-selenium-latest ?
test-optimization-selenium-oldest ?
test-optimization-testopt-active ?
test-optimization-testopt-latest ?
test-optimization-testopt-maintenance ?
test-optimization-testopt-oldest ?
test-optimization-vitest-latest ?
test-optimization-vitest-oldest ?

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

☔ View full report in Codecov by Sentry.
📢 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.

@dd-octo-sts

dd-octo-sts Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 5.83 MB
Deduped: 6.87 MB
No deduping: 6.87 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 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-4

datadog-prod-us1-4 Bot commented May 18, 2026

Copy link
Copy Markdown

Tests

Fix all issues with BitsAI

⚠️ Warnings

🧪 1 Test failed in 1 job

Instrumentation | instrumentation-passport-local   GitHub Actions

with passport-local &gt;=1.0.0 (1.0.0) passport-local instrumentation &#34;before all&#34; hook for &#34;should not call subscriber when an error occurs&#34; from passport-local instrumentation   View in Datadog (Fix with Cursor)
Timeout of 5000ms exceeded. For async tests and hooks, ensure &#34;done()&#34; is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/datadog-instrumentations/test/passport-local.spec.js)

Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure &#34;done()&#34; is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/datadog-instrumentations/test/passport-local.spec.js)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 86.43% (-0.00%)

Useful? React with 👍 / 👎

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

@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-05-18-fix-vendored-opentracing-types branch from c0959cf to 2e0edc5 Compare May 18, 2026 14:41
@pr-commenter

pr-commenter Bot commented May 18, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-19 13:43:12

Comparing candidate commit d6edf39 in PR branch BridgeAR/2026-05-18-fix-vendored-opentracing-types with baseline commit 806f177 in branch master.

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

@BridgeAR
BridgeAR marked this pull request as ready for review May 18, 2026 15:14
@BridgeAR
BridgeAR requested review from a team as code owners May 18, 2026 15:14
@BridgeAR
BridgeAR requested review from khanayan123 and tlhunter and removed request for a team May 18, 2026 15:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e0edc540c

ℹ️ 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".

Comment thread index.d.ts
tlhunter
tlhunter previously approved these changes May 18, 2026
@BridgeAR
BridgeAR marked this pull request as draft May 18, 2026 18:52
`opentracing.initGlobalTracer(tracer)` fails to type-check because dd-trace's
public types reach into `./vendor/dist/opentracing` while consumers reach into
their own `node_modules/opentracing`. `Reference` / `Tracer` / `Span` declare
`protected` members, so the two copies are nominally distinct classes and the
dd-trace `Tracer` is not a subtype of the consumer's `opentracing.Tracer`.

`index.d.ts` imports from `"opentracing"` directly and the package becomes a
regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both
dd-trace and the consumer resolve to, and TypeScript dedupes the nominal
class identity by `name@version` Package ID, so `initGlobalTracer(tracer)`
accepts dd-trace's `Tracer`. The range is `>=0.14.0` rather than `>=0.14.7`
to widen the hoist window for consumers pinned to an older patch — the
repository was archived on 2023-05-23 and the type surface is identical
across 0.14.0–0.14.7.

The vendored type copy and its rspack build step are dropped; dd-trace's
runtime never required the package.

Fixes: #8523
Refs: #6958
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-05-18-fix-vendored-opentracing-types branch from 2e0edc5 to fc23ba0 Compare May 19, 2026 13:28
Comment thread package.json Outdated
Comment thread yarn.lock Outdated
Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR
BridgeAR marked this pull request as ready for review May 19, 2026 13:51
@BridgeAR
BridgeAR merged commit 8feb9ce into master May 19, 2026
958 of 959 checks passed
@BridgeAR
BridgeAR deleted the BridgeAR/2026-05-18-fix-vendored-opentracing-types branch May 19, 2026 21:13
@dd-octo-sts dd-octo-sts Bot mentioned this pull request May 20, 2026
dd-octo-sts Bot pushed a commit that referenced this pull request May 20, 2026
…8525)

`opentracing.initGlobalTracer(tracer)` fails to type-check because dd-trace's
public types reach into `./vendor/dist/opentracing` while consumers reach into
their own `node_modules/opentracing`. `Reference` / `Tracer` / `Span` declare
`protected` members, so the two copies are nominally distinct classes and the
dd-trace `Tracer` is not a subtype of the consumer's `opentracing.Tracer`.

`index.d.ts` imports from `"opentracing"` directly and the package becomes a
regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both
dd-trace and the consumer resolve to, and TypeScript dedupes the nominal
class identity by `name@version` Package ID, so `initGlobalTracer(tracer)`
accepts dd-trace's `Tracer`.

The vendored type copy and its rspack build step are dropped; dd-trace's
runtime never required the package.

Fixes: #8523
Refs: #6958
pabloerhard pushed a commit that referenced this pull request May 20, 2026
…8525)

`opentracing.initGlobalTracer(tracer)` fails to type-check because dd-trace's
public types reach into `./vendor/dist/opentracing` while consumers reach into
their own `node_modules/opentracing`. `Reference` / `Tracer` / `Span` declare
`protected` members, so the two copies are nominally distinct classes and the
dd-trace `Tracer` is not a subtype of the consumer's `opentracing.Tracer`.

`index.d.ts` imports from `"opentracing"` directly and the package becomes a
regular runtime dependency. npm, yarn, and pnpm hoist a single copy that both
dd-trace and the consumer resolve to, and TypeScript dedupes the nominal
class identity by `name@version` Package ID, so `initGlobalTracer(tracer)`
accepts dd-trace's `Tracer`.

The vendored type copy and its rspack build step are dropped; dd-trace's
runtime never required the package.

Fixes: #8523
Refs: #6958
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.

Vendoring broke opentracing types / uses different libs

2 participants