dd-trace 5.82.0 → 5.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE-3rdparty.csv +78 -79
  2. package/ci/init.js +6 -6
  3. package/index.d.ts +152 -3
  4. package/loader-hook.mjs +1 -1
  5. package/package.json +58 -55
  6. package/packages/datadog-core/src/storage.js +7 -7
  7. package/packages/datadog-esbuild/index.js +6 -0
  8. package/packages/datadog-instrumentations/src/ai.js +7 -3
  9. package/packages/datadog-instrumentations/src/child_process.js +1 -1
  10. package/packages/datadog-instrumentations/src/cucumber.js +1 -1
  11. package/packages/datadog-instrumentations/src/graphql.js +1 -1
  12. package/packages/datadog-instrumentations/src/helpers/instrumentations.js +4 -3
  13. package/packages/datadog-instrumentations/src/helpers/register.js +3 -7
  14. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +1 -1
  15. package/packages/datadog-instrumentations/src/http/client.js +2 -2
  16. package/packages/datadog-instrumentations/src/jest.js +35 -14
  17. package/packages/datadog-instrumentations/src/koa.js +2 -1
  18. package/packages/datadog-instrumentations/src/light-my-request.js +2 -2
  19. package/packages/datadog-instrumentations/src/mocha/main.js +2 -2
  20. package/packages/datadog-instrumentations/src/mocha/worker.js +1 -1
  21. package/packages/datadog-instrumentations/src/mocha.js +1 -1
  22. package/packages/datadog-instrumentations/src/mysql.js +1 -1
  23. package/packages/datadog-instrumentations/src/mysql2.js +2 -2
  24. package/packages/datadog-instrumentations/src/net.js +13 -5
  25. package/packages/datadog-instrumentations/src/nyc.js +1 -1
  26. package/packages/datadog-instrumentations/src/otel-sdk-trace.js +4 -4
  27. package/packages/datadog-instrumentations/src/pg.js +4 -2
  28. package/packages/datadog-instrumentations/src/playwright.js +3 -3
  29. package/packages/datadog-instrumentations/src/selenium.js +2 -2
  30. package/packages/datadog-instrumentations/src/undici.js +12 -1
  31. package/packages/datadog-plugin-aws-sdk/src/base.js +4 -4
  32. package/packages/datadog-plugin-azure-event-hubs/src/producer.js +2 -2
  33. package/packages/datadog-plugin-azure-service-bus/src/producer.js +2 -2
  34. package/packages/datadog-plugin-cucumber/src/index.js +2 -2
  35. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +2 -2
  36. package/packages/datadog-plugin-dd-trace-api/src/index.js +2 -2
  37. package/packages/datadog-plugin-express/src/code_origin.js +21 -15
  38. package/packages/datadog-plugin-fastify/src/code_origin.js +17 -4
  39. package/packages/datadog-plugin-jest/src/index.js +2 -2
  40. package/packages/datadog-plugin-mocha/src/index.js +2 -2
  41. package/packages/datadog-plugin-mongodb-core/src/index.js +2 -2
  42. package/packages/datadog-plugin-playwright/src/index.js +3 -3
  43. package/packages/datadog-plugin-undici/src/index.js +305 -2
  44. package/packages/datadog-plugin-vitest/src/index.js +5 -5
  45. package/packages/dd-trace/index.js +19 -0
  46. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +1 -1
  47. package/packages/dd-trace/src/appsec/rasp/index.js +2 -4
  48. package/packages/dd-trace/src/azure_metadata.js +8 -3
  49. package/packages/dd-trace/src/baggage.js +36 -11
  50. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +5 -1
  51. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +2 -2
  52. package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -2
  53. package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +2 -2
  54. package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -2
  55. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +3 -2
  56. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -3
  57. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +4 -4
  58. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +1 -1
  59. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -2
  60. package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +4 -4
  61. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +4 -4
  62. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +2 -2
  63. package/packages/dd-trace/src/{config_defaults.js → config/defaults.js} +3 -3
  64. package/packages/dd-trace/src/{config-helper.js → config/helper.js} +88 -15
  65. package/packages/dd-trace/src/{config.js → config/index.js} +92 -45
  66. package/packages/dd-trace/src/config/remote_config.js +187 -19
  67. package/packages/dd-trace/src/{config_stable.js → config/stable.js} +20 -32
  68. package/packages/dd-trace/src/{supported-configurations.json → config/supported-configurations.json} +2 -0
  69. package/packages/dd-trace/src/crashtracking/crashtracker.js +1 -1
  70. package/packages/dd-trace/src/datastreams/processor.js +1 -1
  71. package/packages/dd-trace/src/datastreams/writer.js +1 -1
  72. package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
  73. package/packages/dd-trace/src/debugger/devtools_client/config.js +1 -1
  74. package/packages/dd-trace/src/debugger/devtools_client/send.js +3 -3
  75. package/packages/dd-trace/src/debugger/devtools_client/snapshot/constants.js +1 -1
  76. package/packages/dd-trace/src/debugger/index.js +83 -15
  77. package/packages/dd-trace/src/dogstatsd.js +2 -2
  78. package/packages/dd-trace/src/encode/0.4.js +2 -2
  79. package/packages/dd-trace/src/exporter.js +1 -1
  80. package/packages/dd-trace/src/exporters/agent/index.js +2 -4
  81. package/packages/dd-trace/src/exporters/agent/writer.js +9 -14
  82. package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +1 -1
  83. package/packages/dd-trace/src/exporters/common/docker.js +2 -2
  84. package/packages/dd-trace/src/exporters/common/request.js +1 -1
  85. package/packages/dd-trace/src/exporters/common/util.js +2 -2
  86. package/packages/dd-trace/src/exporters/span-stats/index.js +1 -1
  87. package/packages/dd-trace/src/flare/index.js +1 -1
  88. package/packages/dd-trace/src/guardrails/telemetry.js +1 -1
  89. package/packages/dd-trace/src/index.js +4 -4
  90. package/packages/dd-trace/src/lambda/handler.js +2 -2
  91. package/packages/dd-trace/src/lambda/index.js +2 -2
  92. package/packages/dd-trace/src/lambda/runtime/patch.js +2 -2
  93. package/packages/dd-trace/src/lambda/runtime/ritm.js +2 -2
  94. package/packages/dd-trace/src/llmobs/constants/tags.js +8 -1
  95. package/packages/dd-trace/src/llmobs/index.js +2 -2
  96. package/packages/dd-trace/src/llmobs/noop.js +2 -0
  97. package/packages/dd-trace/src/llmobs/plugins/openai/index.js +3 -4
  98. package/packages/dd-trace/src/llmobs/sdk.js +33 -6
  99. package/packages/dd-trace/src/llmobs/span_processor.js +17 -7
  100. package/packages/dd-trace/src/llmobs/tagger.js +175 -1
  101. package/packages/dd-trace/src/llmobs/writers/base.js +116 -37
  102. package/packages/dd-trace/src/llmobs/writers/spans.js +4 -3
  103. package/packages/dd-trace/src/log/index.js +5 -5
  104. package/packages/dd-trace/src/noop/proxy.js +3 -3
  105. package/packages/dd-trace/src/openfeature/writers/base.js +7 -8
  106. package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +2 -2
  107. package/packages/dd-trace/src/opentelemetry/tracer.js +48 -6
  108. package/packages/dd-trace/src/opentracing/propagation/text_map.js +45 -21
  109. package/packages/dd-trace/src/opentracing/span.js +4 -4
  110. package/packages/dd-trace/src/plugin_manager.js +8 -6
  111. package/packages/dd-trace/src/plugins/util/ci.js +5 -8
  112. package/packages/dd-trace/src/plugins/util/git-cache.js +3 -3
  113. package/packages/dd-trace/src/plugins/util/test.js +1 -1
  114. package/packages/dd-trace/src/plugins/util/user-provided-git.js +41 -43
  115. package/packages/dd-trace/src/profiler.js +4 -39
  116. package/packages/dd-trace/src/profiling/config.js +74 -31
  117. package/packages/dd-trace/src/profiling/exporter_cli.js +5 -5
  118. package/packages/dd-trace/src/profiling/exporters/agent.js +1 -1
  119. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +9 -2
  120. package/packages/dd-trace/src/profiling/index.js +1 -1
  121. package/packages/dd-trace/src/profiling/libuv-size.js +1 -1
  122. package/packages/dd-trace/src/profiling/profiler.js +57 -2
  123. package/packages/dd-trace/src/proxy.js +34 -5
  124. package/packages/dd-trace/src/remote_config/capabilities.js +3 -0
  125. package/packages/dd-trace/src/remote_config/index.js +1 -1
  126. package/packages/dd-trace/src/ritm.js +8 -4
  127. package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +2 -2
  128. package/packages/dd-trace/src/serverless.js +2 -2
  129. package/packages/dd-trace/src/span_processor.js +2 -2
  130. package/packages/dd-trace/src/startup-log.js +6 -15
  131. package/packages/dd-trace/src/telemetry/endpoints.js +67 -5
  132. package/packages/dd-trace/src/telemetry/send-data.js +103 -4
  133. package/packages/dd-trace/src/telemetry/telemetry.js +229 -110
  134. /package/packages/dd-trace/src/{git_properties.js → config/git_properties.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "5.82.0",
3
+ "version": "5.83.0",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -18,61 +18,64 @@
18
18
  "lint:inspect": "npx @eslint/config-inspector@latest",
19
19
  "release:proposal": "node scripts/release/proposal",
20
20
  "services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services",
21
- "test": "SERVICES=* yarn services && mocha --expose-gc 'packages/dd-trace/test/setup/node.js' 'packages/*/test/**/*.spec.js'",
22
- "test:aiguard": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/aiguard/**/*.spec.js\"",
21
+ "test": "echo '\nError: The root \"npm test\" command is intentionally disabled.\n\nInstead, run specific test suites:\n - npm run test:trace:core\n - npm run test:appsec\n - etc.\n\nOr run individual test files:\n npx mocha path/to/test.spec.js\n\nSee CONTRIBUTING.md (Testing section) for more details.\n' && exit 1",
22
+ "test:aiguard": "mocha packages/dd-trace/test/aiguard/**/*.spec.js",
23
23
  "test:aiguard:ci": "nyc --no-clean --include \"packages/dd-trace/src/aiguard/**/*.js\" -- npm run test:aiguard",
24
- "test:appsec": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" --exclude \"packages/dd-trace/test/appsec/**/*.plugin.spec.js\" \"packages/dd-trace/test/appsec/**/*.spec.js\"",
24
+ "test:appsec": "mocha --exclude \"packages/dd-trace/test/appsec/**/*.plugin.spec.js\" \"packages/dd-trace/test/appsec/**/*.spec.js\"",
25
25
  "test:appsec:ci": "nyc --no-clean --include \"packages/dd-trace/src/appsec/**/*.js\" --exclude \"packages/dd-trace/test/appsec/**/*.plugin.spec.js\" -- npm run test:appsec",
26
- "test:appsec:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/appsec/**/*.@($(echo $PLUGINS)).plugin.spec.js\"",
26
+ "test:appsec:plugins": "mocha \"packages/dd-trace/test/appsec/**/*.@(${PLUGINS}).plugin.spec.js\"",
27
27
  "test:appsec:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/src/appsec/**/*.js\" -- npm run test:appsec:plugins",
28
- "test:debugger": "mocha -r 'packages/dd-trace/test/setup/mocha.js' 'packages/dd-trace/test/debugger/**/*.spec.js'",
29
- "test:debugger:ci": "nyc --no-clean --include 'packages/dd-trace/src/debugger/**/*.js' -- npm run test:debugger",
28
+ "test:debugger": "mocha packages/dd-trace/test/debugger/**/*.spec.js",
29
+ "test:debugger:ci": "nyc --no-clean --include \"packages/dd-trace/src/debugger/**/*.js\" -- npm run test:debugger",
30
30
  "test:eslint-rules": "node eslint-rules/*.test.mjs",
31
- "test:trace:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 --require packages/dd-trace/test/setup/mocha.js -- \"packages/dd-trace/test/*.spec.js\" \"packages/dd-trace/test/{ci-visibility,config,datastreams,encode,exporters,opentelemetry,opentracing,plugins,remote_config,service-naming,standalone,telemetry,external-logger}/**/*.spec.js\"",
31
+ "test:trace:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/dd-trace/test/*.spec.js\" \"packages/dd-trace/test/{ci-visibility,config,crashtracking,datastreams,encode,exporters,msgpack,opentelemetry,opentracing,payload-tagging,plugins,remote_config,service-naming,standalone,telemetry,external-logger}/**/*.spec.js\"",
32
32
  "test:trace:core:ci": "nyc --no-clean --include \"packages/dd-trace/src/**/*.js\" -- npm run test:trace:core",
33
- "test:trace:guardrails": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/guardrails/**/*.spec.js\"",
33
+ "test:trace:guardrails": "mocha packages/dd-trace/test/guardrails/**/*.spec.js",
34
34
  "test:trace:guardrails:ci": "nyc --no-clean --include \"packages/dd-trace/src/guardrails/**/*.js\" -- npm run test:trace:guardrails",
35
- "test:esbuild": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-esbuild/test/**/*.spec.js\"",
35
+ "test:esbuild": "mocha packages/datadog-esbuild/test/**/*.spec.js",
36
36
  "test:esbuild:ci": "nyc --no-clean --include \"packages/datadog-esbuild/test/**/*.js\" -- npm run test:esbuild",
37
- "test:instrumentations": "mocha -r 'packages/dd-trace/test/setup/mocha.js' \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\"",
38
- "test:instrumentations:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS)).js\" --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS))/**/*.js\" -- npm run test:instrumentations",
39
- "test:instrumentations:misc": "mocha -r 'packages/dd-trace/test/setup/mocha.js' 'packages/datadog-instrumentations/test/*/**/*.spec.js'",
40
- "test:instrumentations:misc:ci": "nyc --no-clean --include 'packages/datadog-instrumentations/src/**/*.js' -- npm run test:instrumentations:misc",
41
- "test:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/datadog-core/test/**/*.spec.js\"",
37
+ "test:instrumentations": "mocha \"packages/datadog-instrumentations/test/@(${PLUGINS}).spec.js\"",
38
+ "test:instrumentations:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@(${PLUGINS}).js\" --include \"packages/datadog-instrumentations/src/@(${PLUGINS})/**/*.js\" -- npm run test:instrumentations",
39
+ "test:instrumentations:misc": "mocha packages/datadog-instrumentations/test/*/**/*.spec.js",
40
+ "test:instrumentations:misc:ci": "nyc --no-clean --include \"packages/datadog-instrumentations/src/**/*.js\" -- npm run test:instrumentations:misc",
41
+ "test:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- packages/datadog-core/test/**/*.spec.js",
42
42
  "test:core:ci": "nyc --no-clean --include \"packages/datadog-core/src/**/*.js\" -- npm run test:core",
43
- "test:lambda": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/lambda/**/*.spec.js\"",
43
+ "test:code-origin": "mocha packages/datadog-code-origin/test/**/*.spec.js",
44
+ "test:code-origin:ci": "nyc --no-clean --include \"packages/datadog-code-origin/**/*.js\" -- npm run test:code-origin",
45
+ "test:lambda": "mocha packages/dd-trace/test/lambda/**/*.spec.js",
44
46
  "test:lambda:ci": "nyc --no-clean --include \"packages/dd-trace/src/lambda/**/*.js\" -- npm run test:lambda",
45
- "test:llmobs:sdk": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" --exclude \"packages/dd-trace/test/llmobs/plugins/**/*.spec.js\" \"packages/dd-trace/test/llmobs/**/*.spec.js\" ",
47
+ "test:llmobs:sdk": "mocha --exclude \"packages/dd-trace/test/llmobs/plugins/**/*.spec.js\" \"packages/dd-trace/test/llmobs/**/*.spec.js\"",
46
48
  "test:llmobs:sdk:ci": "nyc --no-clean --include \"packages/dd-trace/src/llmobs/**/*.js\" -- npm run test:llmobs:sdk",
47
- "test:llmobs:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/llmobs/plugins/@($(echo $PLUGINS))/*.spec.js\"",
49
+ "test:llmobs:plugins": "mocha \"packages/dd-trace/test/llmobs/plugins/@(${PLUGINS})/*.spec.js\"",
48
50
  "test:llmobs:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/src/llmobs/**/*.js\" -- npm run test:llmobs:plugins",
49
- "test:openfeature": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/openfeature/*.spec.js\"",
51
+ "test:openfeature": "mocha packages/dd-trace/test/openfeature/**/*.spec.js",
50
52
  "test:openfeature:ci": "nyc --no-clean --include \"packages/dd-trace/src/openfeature/**/*.js\" -- npm run test:openfeature",
51
- "test:plugins": "mocha --expose-gc -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/@($(echo ${SPEC:-'*'}))*.spec.js\"",
52
- "test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins",
53
- "test:plugins:ci:flaky": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins -- --bail --retries 2",
53
+ "test:plugins": "node --expose-gc ./node_modules/mocha/bin/mocha.js \"packages/datadog-plugin-@(${PLUGINS})/test/**/${SPEC:-*}*.spec.js\"",
54
+ "test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@(${PLUGINS})/src/**/*.js\" -- npm run test:plugins",
55
+ "test:plugins:ci:flaky": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@(${PLUGINS})/src/**/*.js\" -- npm run test:plugins -- --bail --retries 2",
54
56
  "test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
55
- "test:profiler": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 --require packages/dd-trace/test/setup/mocha.js -- \"packages/dd-trace/test/profiling/**/*.spec.js\"",
57
+ "test:profiler": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- packages/dd-trace/test/profiling/**/*.spec.js",
56
58
  "test:profiler:ci": "nyc --no-clean --include \"packages/dd-trace/src/profiling/**/*.js\" -- npm run test:profiler",
57
- "test:integration": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/*.spec.js\"",
58
- "test:integration:aiguard": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/aiguard/*.spec.js\"",
59
- "test:integration:appsec": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/appsec/*.spec.js\"",
60
- "test:integration:cucumber": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/cucumber/*.spec.js\"",
61
- "test:integration:cypress": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/cypress/*.spec.js\"",
62
- "test:integration:debugger": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/debugger/*.spec.js\"",
63
- "test:integration:esbuild": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/esbuild/*.spec.js\"",
64
- "test:integration:openfeature": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/openfeature/*.spec.js\"",
65
- "test:integration:jest": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/jest/*.spec.js\"",
66
- "test:integration:mocha": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/mocha/*.spec.js\"",
67
- "test:integration:playwright": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/playwright/*.spec.js\"",
68
- "test:integration:selenium": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/selenium/*.spec.js\"",
69
- "test:integration:vitest": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/vitest/*.spec.js\"",
70
- "test:integration:testopt": "mocha --timeout 120000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/ci-visibility/*.spec.js\"",
71
- "test:integration:profiler": "mocha --timeout 180000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/profiler/*.spec.js\"",
72
- "test:integration:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
73
- "test:unit:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\" --exclude \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
74
- "test:shimmer": "mocha 'packages/datadog-shimmer/test/**/*.spec.js'",
75
- "test:shimmer:ci": "nyc --no-clean --include 'packages/datadog-shimmer/src/**/*.js' -- npm run test:shimmer"
59
+ "test:integration": "mocha --timeout 60000 \"integration-tests/*.spec.js\"",
60
+ "test:integration:aiguard": "mocha --timeout 60000 \"integration-tests/aiguard/*.spec.js\"",
61
+ "test:integration:appsec": "mocha --timeout 60000 \"integration-tests/appsec/*.spec.js\"",
62
+ "test:integration:cucumber": "mocha --timeout 60000 \"integration-tests/cucumber/*.spec.js\"",
63
+ "test:integration:cypress": "mocha --timeout 60000 \"integration-tests/cypress/*.spec.js\"",
64
+ "test:integration:debugger": "mocha --timeout 60000 \"integration-tests/debugger/*.spec.js\"",
65
+ "test:integration:esbuild": "mocha --timeout 60000 \"integration-tests/esbuild/*.spec.js\"",
66
+ "test:integration:openfeature": "mocha --timeout 60000 \"integration-tests/openfeature/*.spec.js\"",
67
+ "test:integration:jest": "mocha --timeout 60000 \"integration-tests/jest/*.spec.js\"",
68
+ "test:integration:mocha": "mocha --timeout 60000 \"integration-tests/mocha/*.spec.js\"",
69
+ "test:integration:playwright": "mocha --timeout 60000 \"integration-tests/playwright/*.spec.js\"",
70
+ "test:integration:selenium": "mocha --timeout 60000 \"integration-tests/selenium/*.spec.js\"",
71
+ "test:integration:vitest": "mocha --timeout 60000 \"integration-tests/vitest/*.spec.js\"",
72
+ "test:integration:testopt": "mocha --timeout 120000 \"integration-tests/ci-visibility/*.spec.js\"",
73
+ "test:integration:profiler": "mocha --timeout 180000 \"integration-tests/profiler/*.spec.js\"",
74
+ "test:integration:plugins": "mocha \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
75
+ "test:unit:plugins": "mocha \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\" --exclude \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
76
+ "test:shimmer": "mocha \"packages/datadog-shimmer/test/**/*.spec.js\"",
77
+ "test:shimmer:ci": "nyc --no-clean --include \"packages/datadog-shimmer/src/**/*.js\" -- npm run test:shimmer",
78
+ "verify-exercised-tests": "node scripts/verify-exercised-tests.js"
76
79
  },
77
80
  "repository": {
78
81
  "type": "git",
@@ -127,7 +130,7 @@
127
130
  ],
128
131
  "dependencies": {
129
132
  "dc-polyfill": "^0.1.10",
130
- "import-in-the-middle": "2.0.0"
133
+ "import-in-the-middle": "2.0.3"
131
134
  },
132
135
  "optionalDependencies": {
133
136
  "@datadog/libdatadog": "0.7.0",
@@ -135,37 +138,37 @@
135
138
  "@datadog/native-iast-taint-tracking": "4.1.0",
136
139
  "@datadog/native-metrics": "3.1.1",
137
140
  "@datadog/openfeature-node-server": "^0.2.0",
138
- "@datadog/pprof": "5.13.1",
141
+ "@datadog/pprof": "5.13.2",
139
142
  "@datadog/wasm-js-rewriter": "5.0.1",
140
143
  "@opentelemetry/api": ">=1.0.0 <1.10.0",
141
144
  "@opentelemetry/api-logs": "<1.0.0"
142
145
  },
143
146
  "devDependencies": {
144
- "@babel/helpers": "^7.28.4",
147
+ "@babel/helpers": "^7.28.6",
145
148
  "@eslint/eslintrc": "^3.3.1",
146
- "@eslint/js": "^9.39.0",
147
- "@msgpack/msgpack": "^3.1.2",
149
+ "@eslint/js": "^9.39.2",
150
+ "@msgpack/msgpack": "^3.1.3",
148
151
  "@openfeature/core": "^1.8.1",
149
152
  "@openfeature/server-sdk": "~1.20.0",
150
- "@stylistic/eslint-plugin": "^5.5.0",
153
+ "@stylistic/eslint-plugin": "^5.7.0",
151
154
  "@types/mocha": "^10.0.10",
152
155
  "@types/node": "^18.19.106",
153
156
  "@types/sinon": "^21.0.0",
154
157
  "axios": "^1.12.2",
155
158
  "benchmark": "^2.1.4",
156
- "body-parser": "^2.2.0",
157
- "bun": "1.3.3",
158
- "eslint": "^9.39.0",
159
- "eslint-plugin-cypress": "^5.2.0",
159
+ "body-parser": "^2.2.2",
160
+ "bun": "1.3.6",
161
+ "eslint": "^9.39.2",
162
+ "eslint-plugin-cypress": "^5.2.1",
160
163
  "eslint-plugin-import": "^2.32.0",
161
- "eslint-plugin-jsdoc": "^61.1.12",
164
+ "eslint-plugin-jsdoc": "^62.0.0",
162
165
  "eslint-plugin-mocha": "^11.2.0",
163
- "eslint-plugin-n": "^17.23.1",
166
+ "eslint-plugin-n": "^17.23.2",
164
167
  "eslint-plugin-promise": "^7.2.1",
165
168
  "eslint-plugin-unicorn": "^62.0.0",
166
169
  "express": "^5.1.0",
167
170
  "glob": "^10.4.5",
168
- "globals": "^16.3.0",
171
+ "globals": "^17.0.0",
169
172
  "graphql": "*",
170
173
  "jszip": "^3.10.1",
171
174
  "mocha": "^11.6.0",
@@ -10,12 +10,12 @@ const { AsyncLocalStorage } = require('async_hooks')
10
10
  * a "handle" object, which is used as a key in a WeakMap, where the values
11
11
  * are the real store objects.
12
12
  *
13
- * @typedef {Record<string, unknown>} Store
13
+ * @template T
14
+ * @typedef {Record<string, T>} Store
14
15
  */
15
16
  class DatadogStorage extends AsyncLocalStorage {
16
17
  /**
17
- *
18
- * @param {Store} [store]
18
+ * @param {Store<unknown>} [store]
19
19
  * @override
20
20
  */
21
21
  enterWith (store) {
@@ -35,7 +35,7 @@ class DatadogStorage extends AsyncLocalStorage {
35
35
  *
36
36
  * TODO: Refactor the Scope class to use a span-only store and remove this.
37
37
  *
38
- * @returns {Store}
38
+ * @returns {Store<unknown>}
39
39
  */
40
40
  getHandle () {
41
41
  return super.getStore()
@@ -48,7 +48,7 @@ class DatadogStorage extends AsyncLocalStorage {
48
48
  * key. This is useful if you've stashed a handle somewhere and want to
49
49
  * retrieve the store with it.
50
50
  * @param {object} [handle]
51
- * @returns {Store | undefined}
51
+ * @returns {Store<unknown> | undefined}
52
52
  * @override
53
53
  */
54
54
  getStore (handle) {
@@ -68,7 +68,7 @@ class DatadogStorage extends AsyncLocalStorage {
68
68
  * WeakMap.
69
69
  * @template R
70
70
  * @template TArgs = unknown[]
71
- * @param {Store} store
71
+ * @param {Store<unknown>} store
72
72
  * @param {() => R} fn
73
73
  * @param {...TArgs} args
74
74
  * @returns {R}
@@ -87,7 +87,7 @@ class DatadogStorage extends AsyncLocalStorage {
87
87
 
88
88
  /**
89
89
  * This is the map from handles to real stores, used in the class above.
90
- * @type {WeakMap<WeakKey, Store|undefined>}
90
+ * @type {WeakMap<WeakKey, Store<unknown>|undefined>}
91
91
  */
92
92
  const stores = new WeakMap()
93
93
 
@@ -97,6 +97,12 @@ function getGitMetadata () {
97
97
  }
98
98
 
99
99
  module.exports.setup = function (build) {
100
+ if (build.initialOptions.minify && !build.initialOptions.keepNames) {
101
+ throw new Error(
102
+ 'Using --minify without --keep-names will break some dd-trace behavior. Refusing to bundle.'
103
+ )
104
+ }
105
+
100
106
  if (DD_IAST_ENABLED) {
101
107
  const iastRewriter = require('../dd-trace/src/appsec/iast/taint-tracking/rewriter')
102
108
  rewriter = iastRewriter.getRewriter()
@@ -41,8 +41,14 @@ const noopTracer = {
41
41
  }
42
42
  }
43
43
 
44
+ const tracers = new WeakSet()
45
+
44
46
  function wrapTracer (tracer) {
45
- if (Object.hasOwn(tracer, Symbol.for('_dd.wrapped'))) return
47
+ if (tracers.has(tracer)) {
48
+ return
49
+ }
50
+
51
+ tracers.add(tracer)
46
52
 
47
53
  shimmer.wrap(tracer, 'startActiveSpan', function (startActiveSpan) {
48
54
  return function () {
@@ -90,8 +96,6 @@ function wrapTracer (tracer) {
90
96
  })
91
97
  }
92
98
  })
93
-
94
- Object.defineProperty(tracer, Symbol.for('_dd.wrapped'), { value: true })
95
99
  }
96
100
 
97
101
  function wrapWithTracer (fn) {
@@ -214,7 +214,7 @@ function wrapChildProcessAsyncMethod (ChildProcess, shell = false) {
214
214
  childProcessChannel.error.publish(context)
215
215
  })
216
216
 
217
- childProcess.on('close', (code = 0) => {
217
+ childProcess.once('close', (code = 0) => {
218
218
  if (!errorExecuted && code !== 0) {
219
219
  childProcessChannel.error.publish(context)
220
220
  }
@@ -3,7 +3,7 @@
3
3
  const { createCoverageMap } = require('../../../vendor/dist/istanbul-lib-coverage')
4
4
  const shimmer = require('../../datadog-shimmer')
5
5
  const log = require('../../dd-trace/src/log')
6
- const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
6
+ const { getEnvironmentVariable } = require('../../dd-trace/src/config/helper')
7
7
  const {
8
8
  getCoveredFilenamesFromCoverage,
9
9
  resetCoverage,
@@ -6,7 +6,7 @@ const {
6
6
  channel
7
7
  } = require('./helpers/instrument')
8
8
 
9
- const ddGlobal = globalThis[Symbol.for('dd-trace')] ??= {}
9
+ const ddGlobal = globalThis[Symbol.for('dd-trace')]
10
10
 
11
11
  /** cached objects */
12
12
 
@@ -1,7 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ // Use a global symbol to prevent stealthy-require to interfere.
4
+ // TODO: Use the symbol from dd-trace instead and remove this file.
3
5
  const sym = Symbol.for('_ddtrace_instrumentations')
6
+ globalThis[sym] ??= {}
4
7
 
5
- global[sym] = global[sym] || {}
6
-
7
- module.exports = global[sym]
8
+ module.exports = globalThis[sym]
@@ -7,18 +7,14 @@ const requirePackageJson = require('../../../dd-trace/src/require-package-json')
7
7
  const log = require('../../../dd-trace/src/log')
8
8
  const telemetry = require('../../../dd-trace/src/guardrails/telemetry')
9
9
  const { isInServerlessEnvironment } = require('../../../dd-trace/src/serverless')
10
- const { getEnvironmentVariables } = require('../../../dd-trace/src/config-helper')
10
+ const { getValueFromEnvSources } = require('../../../dd-trace/src/config/helper')
11
11
  const checkRequireCache = require('./check-require-cache')
12
12
  const Hook = require('./hook')
13
13
  const { isRelativeRequire } = require('./shared-utils')
14
14
  const rewriter = require('./rewriter')
15
15
 
16
- const envs = getEnvironmentVariables()
17
-
18
- const {
19
- DD_TRACE_DISABLED_INSTRUMENTATIONS = '',
20
- DD_TRACE_DEBUG = ''
21
- } = envs
16
+ const DD_TRACE_DISABLED_INSTRUMENTATIONS = getValueFromEnvSources('DD_TRACE_DISABLED_INSTRUMENTATIONS') || ''
17
+ const DD_TRACE_DEBUG = getValueFromEnvSources('DD_TRACE_DEBUG') || ''
22
18
 
23
19
  const hooks = require('./hooks')
24
20
  const instrumentations = require('./instrumentations')
@@ -35,7 +35,7 @@ const { readFileSync } = require('fs')
35
35
  const { join } = require('path')
36
36
  const semifies = require('../../../../../vendor/dist/semifies')
37
37
  const log = require('../../../../dd-trace/src/log')
38
- const { getEnvironmentVariable } = require('../../../../dd-trace/src/config-helper')
38
+ const { getEnvironmentVariable } = require('../../../../dd-trace/src/config/helper')
39
39
  const transforms = require('./transforms')
40
40
  const { generate, parse, traverse } = require('./compiler')
41
41
  const instrumentations = require('./instrumentations')
@@ -101,8 +101,8 @@ function patch (http, methodName) {
101
101
  case 'response': {
102
102
  const res = arg
103
103
  ctx.res = res
104
- res.on('end', finish)
105
- res.on(errorMonitor, finish)
104
+ res.once('end', finish)
105
+ res.once(errorMonitor, finish)
106
106
  break
107
107
  }
108
108
  case 'connect':
@@ -93,6 +93,8 @@ const testsToBeRetried = new Set()
93
93
  const testSuiteAbsolutePathsWithFastCheck = new Set()
94
94
 
95
95
  const BREAKPOINT_HIT_GRACE_PERIOD_MS = 200
96
+ const ATR_RETRY_SUPPRESSION_FLAG = '_ddDisableAtrRetry'
97
+ const atrSuppressedErrors = new Map()
96
98
 
97
99
  // based on https://github.com/facebook/jest/blob/main/packages/jest-circus/src/formatNodeAssertErrors.ts#L41
98
100
  function formatJestError (errors) {
@@ -378,7 +380,10 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
378
380
  isNewTest = retriedTestsToNumAttempts.has(testName)
379
381
  }
380
382
 
381
- if (this.isEarlyFlakeDetectionEnabled && (isNewTest || isModified)) {
383
+ const willRunEfd = this.isEarlyFlakeDetectionEnabled && (isNewTest || isModified)
384
+ event.test[ATR_RETRY_SUPPRESSION_FLAG] = Boolean(isAttemptToFix || willRunEfd)
385
+
386
+ if (!isAttemptToFix && willRunEfd) {
382
387
  numEfdRetry = retriedTestsToNumAttempts.get(testName)
383
388
  retriedTestsToNumAttempts.set(testName, numEfdRetry + 1)
384
389
  }
@@ -434,19 +439,22 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
434
439
 
435
440
  const testFullName = this.getTestNameFromAddTestEvent(event, state)
436
441
  const isSkipped = event.mode === 'todo' || event.mode === 'skip'
437
- if (this.isTestManagementTestsEnabled) {
438
- const isAttemptToFix = this.testManagementTestsForThisSuite?.attemptToFix?.includes(testFullName)
439
- if (isAttemptToFix && !isSkipped && !retriedTestsToNumAttempts.has(testFullName)) {
440
- retriedTestsToNumAttempts.set(testFullName, 0)
441
- testsToBeRetried.add(testFullName)
442
- this.retryTest({
443
- jestEvent: event,
444
- retryCount: testManagementAttemptToFixRetries,
445
- retryType: 'Test Management (Attempt to Fix)'
446
- })
447
- }
442
+ const isAttemptToFix = this.isTestManagementTestsEnabled &&
443
+ this.testManagementTestsForThisSuite?.attemptToFix?.includes(testFullName)
444
+ if (
445
+ isAttemptToFix &&
446
+ !isSkipped &&
447
+ !retriedTestsToNumAttempts.has(testFullName)
448
+ ) {
449
+ retriedTestsToNumAttempts.set(testFullName, 0)
450
+ testsToBeRetried.add(testFullName)
451
+ this.retryTest({
452
+ jestEvent: event,
453
+ retryCount: testManagementAttemptToFixRetries,
454
+ retryType: 'Test Management (Attempt to Fix)'
455
+ })
448
456
  }
449
- if (this.isImpactedTestsEnabled) {
457
+ if (!isAttemptToFix && this.isImpactedTestsEnabled) {
450
458
  const testStartLine = getTestLineStart(event.asyncError, this.testSuite)
451
459
  const testEndLine = getTestEndLine(event.fn, testStartLine)
452
460
  const isModified = isModifiedTest(
@@ -466,7 +474,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
466
474
  })
467
475
  }
468
476
  }
469
- if (this.isKnownTestsEnabled) {
477
+ if (!isAttemptToFix && this.isKnownTestsEnabled) {
470
478
  const isNew = !this.knownTestsForThisSuite.includes(testFullName)
471
479
  if (isNew && !isSkipped && !retriedTestsToNumAttempts.has(testFullName)) {
472
480
  retriedTestsToNumAttempts.set(testFullName, 0)
@@ -488,6 +496,13 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
488
496
  }
489
497
  // restore in case it is retried
490
498
  event.test.fn = originalTestFns.get(event.test)
499
+ // If ATR retry is being suppressed for this test (due to EFD or Attempt to Fix taking precedence)
500
+ // and the test has errors for this attempt, store the errors temporarily and clear them
501
+ // so Jest won't treat this attempt as failed (the real status will be reported after retries).
502
+ if (event.test?.[ATR_RETRY_SUPPRESSION_FLAG] && event.test.errors?.length) {
503
+ atrSuppressedErrors.set(event.test, event.test.errors)
504
+ event.test.errors = []
505
+ }
491
506
 
492
507
  let attemptToFixPassed = false
493
508
  let attemptToFixFailed = false
@@ -581,6 +596,12 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
581
596
  await promises.isProbeReady
582
597
  }
583
598
  }
599
+ if (event.name === 'run_finish') {
600
+ for (const [test, errors] of atrSuppressedErrors) {
601
+ test.errors = errors
602
+ }
603
+ atrSuppressedErrors.clear()
604
+ }
584
605
  if (event.name === 'test_skip' || event.name === 'test_todo') {
585
606
  const testName = getJestTestName(event.test, this.getShouldStripSeedFromTestName())
586
607
  testSkippedCh.publish({
@@ -90,7 +90,8 @@ function wrapMiddleware (fn, layer) {
90
90
  const req = ctx.req
91
91
 
92
92
  const path = layer && layer.path
93
- const route = typeof path === 'string' && !path.endsWith('(.*)') && !path.endsWith('([^/]*)') && path
93
+ const route = typeof path === 'string' && !path.endsWith('(.*)') && !path.endsWith('([^/]*)') &&
94
+ !path.includes('(?:') && path
94
95
 
95
96
  enterChannel.publish({ req, name, route })
96
97
 
@@ -62,8 +62,8 @@ function wrapDispatchFunc (dispatchFunc) {
62
62
 
63
63
  // light-my-request Response emits 'finish' when done
64
64
  if (res.on && typeof res.on === 'function') {
65
- res.on('finish', onFinish)
66
- res.on('close', onFinish)
65
+ res.once('finish', onFinish)
66
+ res.once('close', onFinish)
67
67
  }
68
68
 
69
69
  // Also wrap end() as fallback
@@ -5,7 +5,7 @@ const { addHook, channel } = require('../helpers/instrument')
5
5
  const shimmer = require('../../../datadog-shimmer')
6
6
  const { isMarkedAsUnskippable } = require('../../../datadog-plugin-jest/src/util')
7
7
  const log = require('../../../dd-trace/src/log')
8
- const { getEnvironmentVariable } = require('../../../dd-trace/src/config-helper')
8
+ const { getEnvironmentVariable } = require('../../../dd-trace/src/config/helper')
9
9
  const {
10
10
  getTestSuitePath,
11
11
  MOCHA_WORKER_TRACE_PAYLOAD_CODE,
@@ -282,7 +282,7 @@ function getExecutionConfiguration (runner, isParallel, frameworkVersion, onFini
282
282
  if (config.isTestManagementTestsEnabled) {
283
283
  ctx.onDone = onReceivedTestManagementTests
284
284
  testManagementTestsCh.runStores(ctx, () => {})
285
- } if (config.isImpactedTestsEnabled) {
285
+ } else if (config.isImpactedTestsEnabled) {
286
286
  ctx.onDone = onReceivedImpactedTests
287
287
  modifiedFilesCh.runStores(ctx, () => {})
288
288
  } else if (config.isSuitesSkippingEnabled) {
@@ -67,7 +67,7 @@ addHook({
67
67
  return run.apply(this, arguments)
68
68
  }
69
69
  // We flush when the worker ends with its test file (a mocha instance in a worker runs a single test file)
70
- this.on('end', () => {
70
+ this.once('end', () => {
71
71
  workerFinishCh.publish()
72
72
  })
73
73
  this.on('test', getOnTestHandler(false))
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
3
+ const { getEnvironmentVariable } = require('../../dd-trace/src/config/helper')
4
4
 
5
5
  if (getEnvironmentVariable('MOCHA_WORKER_ID')) {
6
6
  require('./mocha/worker')
@@ -39,7 +39,7 @@ addHook({ name: 'mysql', file: 'lib/Connection.js', versions: ['>=2'] }, Connect
39
39
  return finishCh.runStores(ctx, cb, this, error, result)
40
40
  })
41
41
  } else {
42
- res.on('end', () => finishCh.publish(ctx))
42
+ res.once('end', () => finishCh.publish(ctx))
43
43
  }
44
44
 
45
45
  return res
@@ -141,11 +141,11 @@ function wrapConnection (Connection, version) {
141
141
  finishCh.runStores(ctx, onResult, this, ...arguments)
142
142
  })
143
143
  } else {
144
- this.on(errorMonitor, error => {
144
+ this.once(errorMonitor, error => {
145
145
  ctx.error = error
146
146
  errorCh.publish(ctx)
147
147
  })
148
- this.on('end', () => finishCh.publish(ctx))
148
+ this.once('end', () => finishCh.publish(ctx))
149
149
  }
150
150
 
151
151
  this.execute = execute
@@ -101,7 +101,7 @@ function getOptions (args) {
101
101
  }
102
102
 
103
103
  function setupListeners (socket, protocol, ctx, finishCh, errorCh) {
104
- const events = ['connect', errorMonitor, 'close', 'timeout']
104
+ const events = [errorMonitor, 'close', 'timeout']
105
105
 
106
106
  const wrapListener = function (error) {
107
107
  if (error) {
@@ -109,27 +109,35 @@ function setupListeners (socket, protocol, ctx, finishCh, errorCh) {
109
109
  errorCh.publish(ctx)
110
110
  }
111
111
  finishCh.runStores(ctx, () => {})
112
+ cleanupOtherListeners()
112
113
  }
113
114
 
114
- const localListener = function () {
115
+ const localListener = function (error) {
115
116
  ctx.socket = socket
116
117
  connectionCh.publish(ctx)
118
+ if (error) {
119
+ ctx.error = error
120
+ errorCh.publish(ctx)
121
+ }
122
+ finishCh.runStores(ctx, () => {})
123
+ cleanupOtherListeners()
117
124
  }
118
125
 
119
- const cleanupListener = function () {
126
+ const cleanupOtherListeners = function () {
120
127
  socket.removeListener('connect', localListener)
121
128
  events.forEach(event => {
122
129
  socket.removeListener(event, wrapListener)
123
- socket.removeListener(event, cleanupListener)
124
130
  })
125
131
  }
126
132
 
133
+ // TODO: Identify why the connect listener should remove the other listeners.
127
134
  if (protocol === 'tcp') {
128
135
  socket.once('connect', localListener)
136
+ } else {
137
+ events.push('connect')
129
138
  }
130
139
 
131
140
  events.forEach(event => {
132
141
  socket.once(event, wrapListener)
133
- socket.once(event, cleanupListener)
134
142
  })
135
143
  }
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const shimmer = require('../../datadog-shimmer')
4
- const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
4
+ const { getEnvironmentVariable } = require('../../dd-trace/src/config/helper')
5
5
  const { addHook, channel } = require('./helpers/instrument')
6
6
 
7
7
  const codeCoverageWrapCh = channel('ci:nyc:wrap')
@@ -2,12 +2,12 @@
2
2
 
3
3
  const shimmer = require('../../datadog-shimmer')
4
4
  const tracer = require('../../dd-trace')
5
- const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
5
+ const { getValueFromEnvSources } = require('../../dd-trace/src/config/helper')
6
6
  const { addHook } = require('./helpers/instrument')
7
7
 
8
- const otelSdkEnabled = getEnvironmentVariable('DD_TRACE_OTEL_ENABLED') ||
9
- getEnvironmentVariable('OTEL_SDK_DISABLED')
10
- ? !getEnvironmentVariable('OTEL_SDK_DISABLED')
8
+ const otelSdkEnabled = getValueFromEnvSources('DD_TRACE_OTEL_ENABLED') ||
9
+ getValueFromEnvSources('OTEL_SDK_DISABLED')
10
+ ? !getValueFromEnvSources('OTEL_SDK_DISABLED')
11
11
  : undefined
12
12
 
13
13
  if (otelSdkEnabled) {