Skip to content

fix: stop tracing HTTPS traffic to the agent#7545

Merged
watson merged 1 commit intomasterfrom
watson/fix-export
Feb 16, 2026
Merged

fix: stop tracing HTTPS traffic to the agent#7545
watson merged 1 commit intomasterfrom
watson/fix-export

Conversation

@watson
Copy link
Collaborator

@watson watson commented Feb 16, 2026

What does this PR do?

Fixes a bug introduced in #2920: the HTTPS agent export in packages/dd-trace/src/exporters/common/agents.js is renamed from HttpsAgent to httpsAgent so that request.js, which destructures { httpAgent, httpsAgent } from ./agents, receives the HTTPS agent instead of undefined.

Motivation

#2920 moved agent creation into agents.js and had request.js consume httpAgent and httpsAgent from there. The new module exported HttpsAgent (PascalCase), so the destructuring in request.js left httpsAgent undefined. This PR corrects the export name to match the consumer.

Impact

When are users affected? Only when the tracer is configured to use HTTPS to reach the Datadog agent (e.g. DD_TRACE_AGENT_URL=https://agent.example.com:8126 or a remote HTTPS agent). Users using the default HTTP agent URL (e.g. http://localhost:8126) were not affected.

Before (bug): For HTTPS agent URLs, options.agent was never set (because httpsAgent was undefined). Requests used the default https.globalAgent. As a result, the tracer would incorrectly start tracing its own HTTPS connections to the agent (see below), and connection pooling did not use the dedicated agent intended by #2920.

The tracer's HTTP instrumentation would create spans for its own requests to the agent, so export traffic shows up in your traces. #2920's custom agent runs that connection work in a noop context so it isn't traced; with httpsAgent undefined, HTTPS requests skipped that and were traced again.

After (fix): HTTPS requests to the agent use the shared httpsAgent from agents.js. Those connections are no longer traced, and connection pooling matches the design from #2920.

PR 2920 made request.js destructure { httpAgent, httpsAgent } from
./agents, but agents.js exported HttpsAgent (PascalCase). Rename the
export to httpsAgent so the consumer gets the agent instead of
undefined.
Copy link
Collaborator Author

watson commented Feb 16, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

Overall package size

Self size: 4.62 MB
Deduped: 5.46 MB
No deduping: 5.46 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 813.08 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@watson watson self-assigned this Feb 16, 2026
@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.15%. Comparing base (d5c7efd) to head (0c1a14e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7545   +/-   ##
=======================================
  Coverage   80.15%   80.15%           
=======================================
  Files         730      730           
  Lines       31217    31217           
=======================================
  Hits        25023    25023           
  Misses       6194     6194           
Flag Coverage Δ
aiguard-macos 39.00% <ø> (-0.11%) ⬇️
aiguard-ubuntu 39.12% <ø> (-0.11%) ⬇️
aiguard-windows 38.86% <ø> (-0.11%) ⬇️
apm-capabilities-tracing-macos 48.74% <ø> (+0.04%) ⬆️
apm-capabilities-tracing-ubuntu 48.77% <ø> (ø)
apm-capabilities-tracing-windows 48.46% <ø> (+0.03%) ⬆️
apm-integrations-child-process 38.57% <ø> (-0.11%) ⬇️
apm-integrations-couchbase-18 37.47% <ø> (-0.10%) ⬇️
apm-integrations-couchbase-eol 37.96% <ø> (-0.10%) ⬇️
apm-integrations-oracledb 38.00% <ø> (-0.10%) ⬇️
appsec-express 55.37% <ø> (-0.08%) ⬇️
appsec-fastify 51.99% <ø> (-0.08%) ⬇️
appsec-graphql 52.34% <ø> (-0.07%) ⬇️
appsec-kafka 44.57% <ø> (-0.09%) ⬇️
appsec-ldapjs 44.33% <ø> (-0.09%) ⬇️
appsec-lodash 44.01% <ø> (-0.08%) ⬇️
appsec-macos 58.43% <ø> (-0.07%) ⬇️
appsec-mongodb-core 49.25% <ø> (-0.08%) ⬇️
appsec-mongoose 49.94% <ø> (-0.07%) ⬇️
appsec-mysql 51.33% <ø> (-0.08%) ⬇️
appsec-node-serialize 43.52% <ø> (-0.09%) ⬇️
appsec-passport 48.09% <ø> (-0.09%) ⬇️
appsec-postgres 51.06% <ø> (-0.10%) ⬇️
appsec-sourcing 42.87% <ø> (-0.09%) ⬇️
appsec-template 43.69% <ø> (-0.09%) ⬇️
appsec-ubuntu 58.51% <ø> (-0.07%) ⬇️
appsec-windows 58.30% <ø> (-0.07%) ⬇️
instrumentations-instrumentation-bluebird 32.27% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-body-parser 40.80% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-child_process 37.88% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-cookie-parser 34.49% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express 34.83% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.63% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express-session 40.41% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-fs 31.87% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-generic-pool 30.19% <ø> (ø)
instrumentations-instrumentation-http 39.59% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-knex 32.27% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-mongoose 33.63% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-multer 40.54% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-mysql2 38.37% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-passport 44.40% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-http 44.05% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-local 44.61% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-pg 37.79% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-promise 32.20% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-promise-js 32.20% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-q 32.25% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-url 32.17% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-when 32.22% <ø> (-0.11%) ⬇️
llmobs-ai 41.41% <ø> (-0.10%) ⬇️
llmobs-anthropic 40.60% <ø> (-0.10%) ⬇️
llmobs-bedrock 39.49% <ø> (-0.09%) ⬇️
llmobs-google-genai 40.10% <ø> (-0.09%) ⬇️
llmobs-langchain 39.64% <ø> (-0.08%) ⬇️
llmobs-openai 44.45% <ø> (-0.09%) ⬇️
llmobs-vertex-ai 40.38% <ø> (-0.02%) ⬇️
platform-core 29.71% <ø> (ø)
platform-esbuild 32.89% <ø> (ø)
platform-instrumentations-misc 40.53% <ø> (ø)
platform-shimmer 36.14% <ø> (ø)
platform-unit-guardrails 31.27% <ø> (ø)
plugins-azure-event-hubs 24.02% <ø> (ø)
plugins-azure-service-bus 23.42% <ø> (ø)
plugins-bullmq 43.71% <ø> (-0.10%) ⬇️
plugins-cassandra 38.04% <ø> (-0.10%) ⬇️
plugins-cookie 25.08% <ø> (ø)
plugins-cookie-parser 24.87% <ø> (ø)
plugins-crypto 24.72% <ø> (ø)
plugins-dd-trace-api 38.42% <ø> (-0.11%) ⬇️
plugins-express-mongo-sanitize 25.04% <ø> (ø)
plugins-express-session 24.83% <ø> (ø)
plugins-fastify 42.52% <ø> (-0.10%) ⬇️
plugins-fetch 38.58% <ø> (-0.10%) ⬇️
plugins-fs 38.68% <ø> (-0.11%) ⬇️
plugins-generic-pool 24.06% <ø> (ø)
plugins-google-cloud-pubsub 45.73% <ø> (-0.09%) ⬇️
plugins-grpc 41.25% <ø> (-0.10%) ⬇️
plugins-handlebars 25.08% <ø> (ø)
plugins-hapi 40.43% <ø> (-0.10%) ⬇️
plugins-hono 40.70% <ø> (-0.10%) ⬇️
plugins-ioredis 38.48% <ø> (-0.11%) ⬇️
plugins-knex 24.80% <ø> (ø)
plugins-ldapjs 22.61% <ø> (ø)
plugins-light-my-request 24.48% <ø> (ø)
plugins-limitd-client 32.57% <ø> (-0.11%) ⬇️
plugins-lodash 24.13% <ø> (ø)
plugins-mariadb 39.58% <ø> (-0.10%) ⬇️
plugins-memcached 38.21% <ø> (-0.11%) ⬇️
plugins-microgateway-core 39.45% <ø> (-0.10%) ⬇️
plugins-moleculer 40.81% <ø> (-0.10%) ⬇️
plugins-mongodb 39.46% <ø> (-0.10%) ⬇️
plugins-mongodb-core 39.08% <ø> (-0.10%) ⬇️
plugins-mongoose 39.13% <ø> (-0.10%) ⬇️
plugins-multer 24.83% <ø> (ø)
plugins-mysql 39.23% <ø> (-0.11%) ⬇️
plugins-mysql2 39.33% <ø> (-0.10%) ⬇️
plugins-node-serialize 25.12% <ø> (ø)
plugins-opensearch 37.87% <ø> (-0.10%) ⬇️
plugins-passport-http 24.91% <ø> (ø)
plugins-postgres 35.73% <ø> (-0.09%) ⬇️
plugins-process 24.72% <ø> (ø)
plugins-pug 25.08% <ø> (ø)
plugins-redis 38.96% <ø> (-0.10%) ⬇️
plugins-router 43.30% <ø> (-0.10%) ⬇️
plugins-sequelize 23.66% <ø> (ø)
plugins-test-and-upstream-amqp10 38.55% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-amqplib 43.89% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.28% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-avsc 38.82% <ø> (-0.11%) ⬇️
plugins-test-and-upstream-bunyan 33.88% <ø> (-0.11%) ⬇️
plugins-test-and-upstream-connect 41.11% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-graphql 40.23% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.68% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-protobufjs 39.05% <ø> (-0.11%) ⬇️
plugins-test-and-upstream-rhea 44.17% <ø> (-0.07%) ⬇️
plugins-undici 39.37% <ø> (-0.10%) ⬇️
plugins-url 24.72% <ø> (ø)
plugins-valkey 38.10% <ø> (-0.14%) ⬇️
plugins-vm 24.72% <ø> (ø)
plugins-winston 34.26% <ø> (-0.10%) ⬇️
plugins-ws 42.22% <ø> (-0.10%) ⬇️
profiling-macos 39.97% <ø> (-0.10%) ⬇️
profiling-ubuntu 40.10% <ø> (-0.10%) ⬇️
profiling-windows 41.34% <ø> (-0.10%) ⬇️
serverless-azure-functions-client 23.75% <ø> (ø)
serverless-azure-functions-eventhubs 23.75% <ø> (ø)
serverless-azure-functions-servicebus 23.75% <ø> (ø)

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.

@watson watson changed the title fix(exporters): export httpsAgent so request.js receives it fix: prevent tracer from tracing its own HTTPS connections to the agent Feb 16, 2026
@watson watson changed the title fix: prevent tracer from tracing its own HTTPS connections to the agent fix: stop tracing HTTPS traffic to the agent Feb 16, 2026
@pr-commenter
Copy link

pr-commenter bot commented Feb 16, 2026

Benchmarks

Benchmark execution time: 2026-02-16 15:58:50

Comparing candidate commit 0c1a14e in PR branch watson/fix-export with baseline commit d5c7efd in branch master.

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

@watson watson marked this pull request as ready for review February 16, 2026 15:59
@watson watson requested a review from a team as a code owner February 16, 2026 15:59
Copy link
Collaborator

@juan-fernandez juan-fernandez left a comment

Choose a reason for hiding this comment

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

thanks!

@watson watson merged commit 7dad226 into master Feb 16, 2026
792 of 793 checks passed
@watson watson deleted the watson/fix-export branch February 16, 2026 16:33
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