dd-trace 5.57.1 → 5.59.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 (206) hide show
  1. package/LICENSE-3rdparty.csv +3 -1
  2. package/ci/cypress/after-run.js +2 -0
  3. package/ci/cypress/after-spec.js +2 -0
  4. package/ci/cypress/plugin.js +2 -0
  5. package/ci/cypress/polyfills.js +2 -0
  6. package/ci/cypress/support.js +2 -0
  7. package/ci/init.js +2 -0
  8. package/index.d.ts +7 -0
  9. package/init.js +1 -6
  10. package/initialize.mjs +2 -0
  11. package/package.json +40 -9
  12. package/packages/datadog-code-origin/index.js +14 -9
  13. package/packages/datadog-instrumentations/src/apollo.js +7 -10
  14. package/packages/datadog-instrumentations/src/avsc.js +2 -0
  15. package/packages/datadog-instrumentations/src/azure-functions.js +1 -1
  16. package/packages/datadog-instrumentations/src/child_process.js +22 -43
  17. package/packages/datadog-instrumentations/src/cucumber.js +10 -8
  18. package/packages/datadog-instrumentations/src/cypress.js +2 -0
  19. package/packages/datadog-instrumentations/src/fastify.js +19 -1
  20. package/packages/datadog-instrumentations/src/graphql.js +9 -0
  21. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  22. package/packages/datadog-instrumentations/src/helpers/register.js +2 -2
  23. package/packages/datadog-instrumentations/src/hono.js +102 -0
  24. package/packages/datadog-instrumentations/src/jest.js +1 -1
  25. package/packages/datadog-instrumentations/src/langchain.js +21 -0
  26. package/packages/datadog-instrumentations/src/mocha/common.js +2 -0
  27. package/packages/datadog-instrumentations/src/mocha.js +2 -0
  28. package/packages/datadog-instrumentations/src/mysql2.js +6 -6
  29. package/packages/datadog-instrumentations/src/next.js +3 -1
  30. package/packages/datadog-instrumentations/src/nyc.js +2 -0
  31. package/packages/datadog-instrumentations/src/oracledb.js +24 -2
  32. package/packages/datadog-instrumentations/src/orchestrion-config/index.js +32 -0
  33. package/packages/datadog-instrumentations/src/playwright.js +5 -1
  34. package/packages/datadog-instrumentations/src/protobufjs.js +2 -0
  35. package/packages/datadog-instrumentations/src/selenium.js +2 -0
  36. package/packages/datadog-instrumentations/src/tedious.js +12 -17
  37. package/packages/datadog-instrumentations/src/vitest.js +2 -0
  38. package/packages/datadog-plugin-avsc/src/index.js +2 -0
  39. package/packages/datadog-plugin-avsc/src/schema_iterator.js +2 -0
  40. package/packages/datadog-plugin-aws-sdk/src/base.js +51 -1
  41. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +2 -0
  42. package/packages/datadog-plugin-child_process/src/index.js +30 -10
  43. package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +1 -1
  44. package/packages/datadog-plugin-cypress/src/after-run.js +2 -0
  45. package/packages/datadog-plugin-cypress/src/after-spec.js +2 -0
  46. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +8 -3
  47. package/packages/datadog-plugin-cypress/src/index.js +2 -0
  48. package/packages/datadog-plugin-cypress/src/plugin.js +2 -0
  49. package/packages/datadog-plugin-cypress/src/support.js +21 -25
  50. package/packages/datadog-plugin-google-cloud-vertexai/src/utils.js +2 -0
  51. package/packages/datadog-plugin-graphql/src/tools/index.js +0 -2
  52. package/packages/datadog-plugin-graphql/src/tools/signature.js +0 -2
  53. package/packages/datadog-plugin-graphql/src/tools/transforms.js +0 -2
  54. package/packages/datadog-plugin-graphql/src/utils.js +2 -0
  55. package/packages/datadog-plugin-hono/src/index.js +28 -0
  56. package/packages/datadog-plugin-http/src/client.js +3 -4
  57. package/packages/datadog-plugin-http2/src/client.js +9 -8
  58. package/packages/datadog-plugin-jest/src/index.js +2 -0
  59. package/packages/datadog-plugin-jest/src/util.js +2 -0
  60. package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +2 -0
  61. package/packages/datadog-plugin-langchain/src/handlers/chain.js +1 -1
  62. package/packages/datadog-plugin-langchain/src/handlers/language_models/chat_model.js +1 -1
  63. package/packages/datadog-plugin-langchain/src/handlers/language_models/llm.js +1 -1
  64. package/packages/datadog-plugin-langchain/src/tracing.js +36 -4
  65. package/packages/datadog-plugin-nyc/src/index.js +2 -0
  66. package/packages/datadog-plugin-oracledb/src/connection-parser.js +37 -0
  67. package/packages/datadog-plugin-oracledb/src/index.js +15 -17
  68. package/packages/datadog-plugin-protobufjs/src/index.js +2 -0
  69. package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +2 -0
  70. package/packages/datadog-plugin-selenium/src/index.js +2 -0
  71. package/packages/datadog-plugin-tedious/src/index.js +10 -9
  72. package/packages/datadog-plugin-vitest/src/index.js +2 -0
  73. package/packages/dd-trace/src/appsec/iast/analyzers/injection-analyzer.js +6 -4
  74. package/packages/dd-trace/src/appsec/iast/analyzers/ssrf-analyzer.js +9 -0
  75. package/packages/dd-trace/src/appsec/iast/iast-context.js +5 -1
  76. package/packages/dd-trace/src/appsec/iast/index.js +2 -0
  77. package/packages/dd-trace/src/appsec/iast/overhead-controller.js +1 -1
  78. package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +5 -2
  79. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +0 -2
  80. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +2 -0
  81. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-regex.js +2 -0
  82. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +1 -0
  83. package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +2 -0
  84. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +3 -3
  85. package/packages/dd-trace/src/appsec/rasp/fs-plugin.js +18 -11
  86. package/packages/dd-trace/src/appsec/rasp/utils.js +1 -1
  87. package/packages/dd-trace/src/appsec/recommended.json +88 -2
  88. package/packages/dd-trace/src/appsec/reporter.js +68 -14
  89. package/packages/dd-trace/src/appsec/rule_manager.js +63 -171
  90. package/packages/dd-trace/src/appsec/sdk/track_event.js +3 -5
  91. package/packages/dd-trace/src/appsec/stack_trace.js +11 -11
  92. package/packages/dd-trace/src/appsec/telemetry/common.js +2 -2
  93. package/packages/dd-trace/src/appsec/telemetry/index.js +8 -0
  94. package/packages/dd-trace/src/appsec/telemetry/waf.js +5 -3
  95. package/packages/dd-trace/src/appsec/waf/diagnostics.js +15 -0
  96. package/packages/dd-trace/src/appsec/waf/index.js +47 -6
  97. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +2 -2
  98. package/packages/dd-trace/src/appsec/waf/waf_manager.js +22 -12
  99. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +3 -3
  100. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +2 -0
  101. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -1
  102. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -0
  103. package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +2 -0
  104. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -0
  105. package/packages/dd-trace/src/ci-visibility/telemetry.js +2 -0
  106. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +2 -0
  107. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +7 -3
  108. package/packages/dd-trace/src/config.js +15 -4
  109. package/packages/dd-trace/src/config_stable.js +2 -0
  110. package/packages/dd-trace/src/constants.js +1 -2
  111. package/packages/dd-trace/src/datastreams/checkpointer.js +2 -0
  112. package/packages/dd-trace/src/datastreams/context.js +2 -0
  113. package/packages/dd-trace/src/datastreams/encoding.js +2 -0
  114. package/packages/dd-trace/src/datastreams/fnv.js +2 -0
  115. package/packages/dd-trace/src/datastreams/pathway.js +11 -9
  116. package/packages/dd-trace/src/datastreams/processor.js +8 -7
  117. package/packages/dd-trace/src/datastreams/schemas/schema.js +2 -0
  118. package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +45 -36
  119. package/packages/dd-trace/src/datastreams/schemas/schema_sampler.js +2 -0
  120. package/packages/dd-trace/src/datastreams/writer.js +2 -0
  121. package/packages/dd-trace/src/debugger/devtools_client/index.js +12 -4
  122. package/packages/dd-trace/src/debugger/devtools_client/inspector_promises_polyfill.js +2 -0
  123. package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +8 -5
  124. package/packages/dd-trace/src/debugger/devtools_client/snapshot/symbols.js +1 -1
  125. package/packages/dd-trace/src/debugger/index.js +36 -9
  126. package/packages/dd-trace/src/encode/tags-processors.js +2 -0
  127. package/packages/dd-trace/src/exporters/common/agent-info-exporter.js +2 -0
  128. package/packages/dd-trace/src/exporters/common/request.js +1 -1
  129. package/packages/dd-trace/src/exporters/common/util.js +2 -0
  130. package/packages/dd-trace/src/exporters/span-stats/index.js +2 -0
  131. package/packages/dd-trace/src/exporters/span-stats/writer.js +2 -0
  132. package/packages/dd-trace/src/external-logger/src/index.js +2 -0
  133. package/packages/dd-trace/src/git_metadata_tagger.js +2 -0
  134. package/packages/dd-trace/src/git_properties.js +2 -0
  135. package/packages/dd-trace/src/guardrails/index.js +3 -4
  136. package/packages/dd-trace/src/guardrails/log.js +2 -2
  137. package/packages/dd-trace/src/guardrails/telemetry.js +16 -14
  138. package/packages/dd-trace/src/guardrails/util.js +0 -2
  139. package/packages/dd-trace/src/heap_snapshots.js +58 -0
  140. package/packages/dd-trace/src/llmobs/noop.js +1 -1
  141. package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +2 -0
  142. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +5 -0
  143. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/tool.js +15 -0
  144. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +36 -0
  145. package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +47 -4
  146. package/packages/dd-trace/src/llmobs/span_processor.js +1 -1
  147. package/packages/dd-trace/src/llmobs/tagger.js +10 -1
  148. package/packages/dd-trace/src/log/log.js +1 -1
  149. package/packages/dd-trace/src/noop/dogstatsd.js +2 -0
  150. package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +2 -0
  151. package/packages/dd-trace/src/opentracing/span.js +1 -1
  152. package/packages/dd-trace/src/payload-tagging/config/index.js +2 -0
  153. package/packages/dd-trace/src/payload-tagging/index.js +3 -1
  154. package/packages/dd-trace/src/payload-tagging/tagging.js +4 -2
  155. package/packages/dd-trace/src/plugins/apollo.js +2 -0
  156. package/packages/dd-trace/src/plugins/ci_plugin.js +8 -3
  157. package/packages/dd-trace/src/plugins/index.js +1 -0
  158. package/packages/dd-trace/src/plugins/outbound.js +7 -0
  159. package/packages/dd-trace/src/plugins/util/ci.js +2 -0
  160. package/packages/dd-trace/src/plugins/util/env.js +2 -0
  161. package/packages/dd-trace/src/plugins/util/git.js +40 -5
  162. package/packages/dd-trace/src/plugins/util/inferred_proxy.js +2 -0
  163. package/packages/dd-trace/src/plugins/util/llm.js +2 -0
  164. package/packages/dd-trace/src/plugins/util/serverless.js +2 -0
  165. package/packages/dd-trace/src/plugins/util/stacktrace.js +178 -50
  166. package/packages/dd-trace/src/plugins/util/tags.js +17 -1
  167. package/packages/dd-trace/src/plugins/util/test.js +9 -4
  168. package/packages/dd-trace/src/plugins/util/url.js +2 -0
  169. package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -0
  170. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +4 -0
  171. package/packages/dd-trace/src/profiling/profiler.js +89 -70
  172. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns.js +2 -0
  173. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookup.js +2 -0
  174. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_lookupservice.js +2 -0
  175. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_resolve.js +2 -0
  176. package/packages/dd-trace/src/profiling/profilers/event_plugins/dns_reverse.js +2 -0
  177. package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +2 -0
  178. package/packages/dd-trace/src/profiling/profilers/event_plugins/fs.js +2 -0
  179. package/packages/dd-trace/src/profiling/profilers/event_plugins/net.js +2 -0
  180. package/packages/dd-trace/src/profiling/profilers/events.js +2 -0
  181. package/packages/dd-trace/src/profiling/profilers/wall.js +2 -2
  182. package/packages/dd-trace/src/profiling/webspan-utils.js +2 -0
  183. package/packages/dd-trace/src/proxy.js +4 -0
  184. package/packages/dd-trace/src/remote_config/capabilities.js +3 -1
  185. package/packages/dd-trace/src/remote_config/index.js +4 -0
  186. package/packages/dd-trace/src/service-naming/index.js +2 -0
  187. package/packages/dd-trace/src/service-naming/schemas/definition.js +4 -9
  188. package/packages/dd-trace/src/service-naming/schemas/util.js +2 -0
  189. package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +2 -0
  190. package/packages/dd-trace/src/service-naming/schemas/v0/index.js +2 -0
  191. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +2 -0
  192. package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +2 -0
  193. package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +2 -0
  194. package/packages/dd-trace/src/service-naming/schemas/v0/web.js +2 -0
  195. package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +2 -0
  196. package/packages/dd-trace/src/service-naming/schemas/v1/index.js +2 -0
  197. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +2 -0
  198. package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +2 -0
  199. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +4 -1
  200. package/packages/dd-trace/src/service-naming/schemas/v1/web.js +2 -0
  201. package/packages/dd-trace/src/span_stats.js +2 -0
  202. package/packages/dd-trace/src/supported-configurations.json +5 -0
  203. package/packages/dd-trace/src/telemetry/send-data.js +2 -0
  204. package/register.js +4 -0
  205. package/version.js +0 -3
  206. package/packages/dd-trace/src/payload-tagging/jsonpath-plus.js +0 -2094
@@ -15,6 +15,7 @@ require,ignore,MIT,Copyright 2013 Kael Zhang and contributors
15
15
  require,import-in-the-middle,Apache license 2.0,Copyright 2021 Datadog Inc.
16
16
  require,istanbul-lib-coverage,BSD-3-Clause,Copyright 2012-2015 Yahoo! Inc.
17
17
  require,jest-docblock,MIT,Copyright Meta Platforms, Inc. and affiliates.
18
+ require,jsonpath-plus,MIT,Copyright (c) 2011-2019 Stefan Goessner, Subbu Allamaraju, Mike Brevoort, Robert Krahn, Brett Zamir, Richard Schneider
18
19
  require,koalas,MIT,Copyright 2013-2017 Brian Woodward
19
20
  require,limiter,MIT,Copyright 2011 John Hurliman
20
21
  require,lodash.sortby,MIT,Copyright JS Foundation and other contributors
@@ -43,7 +44,7 @@ dev,benchmark,MIT,Copyright 2010-2016 Mathias Bynens Robert Kieffer John-David D
43
44
  dev,body-parser,MIT,Copyright 2014 Jonathan Ong 2014-2015 Douglas Christopher Wilson
44
45
  dev,chai,MIT,Copyright 2017 Chai.js Assertion Library
45
46
  dev,eslint,MIT,Copyright JS Foundation and other contributors https://js.foundation
46
- dev,eslint-config-standard,MIT,Copyright Feross Aboukhadijeh
47
+ dev,eslint-plugin-cypress,MIT,Copyright (c) 2019 Cypress.io
47
48
  dev,eslint-plugin-import,MIT,Copyright 2015 Ben Mosher
48
49
  dev,eslint-plugin-mocha,MIT,Copyright 2014 Mathias Schreck
49
50
  dev,eslint-plugin-n,MIT,Copyright 2015 Toru Nagashima
@@ -67,6 +68,7 @@ dev,sinon,BSD-3-Clause,Copyright 2010-2017 Christian Johansen
67
68
  dev,sinon-chai,WTFPL and BSD-2-Clause,Copyright 2004 Sam Hocevar 2012–2017 Domenic Denicola
68
69
  dev,tap,ISC,Copyright 2011-2022 Isaac Z. Schlueter and Contributors
69
70
  dev,tiktoken,MIT,Copyright (c) 2022 OpenAI, Shantanu Jain
71
+ dev,workerpool,Apache license 2.0,Copyright (C) 2014-2024 Jos de Jong wjosdejong@gmail.com
70
72
  dev,yaml,ISC,Copyright Eemeli Aro <eemeli@gmail.com>
71
73
  dev,yarn-deduplicate,Apache license 2.0,Copyright [yyyy] [name of copyright owner]
72
74
  file,aws-lambda-nodejs-runtime-interface-client,Apache 2.0,Copyright 2019 Amazon.com Inc. or its affiliates. All Rights Reserved.
@@ -1 +1,3 @@
1
+ 'use strict'
2
+
1
3
  module.exports = require('../../packages/datadog-plugin-cypress/src/after-run')
@@ -1 +1,3 @@
1
+ 'use strict'
2
+
1
3
  module.exports = require('../../packages/datadog-plugin-cypress/src/after-spec')
@@ -1,3 +1,5 @@
1
+ 'use strict'
2
+
1
3
  const { NODE_MAJOR } = require('../../version')
2
4
 
3
5
  // These polyfills are here because cypress@6.7.0, which we still support for v5, runs its plugin code
@@ -1,3 +1,5 @@
1
+ 'use strict'
2
+
1
3
  if (!Object.hasOwn) {
2
4
  Object.defineProperty(Object, 'hasOwn', {
3
5
  // eslint-disable-next-line prefer-object-has-own
@@ -1 +1,3 @@
1
+ 'use strict'
2
+
1
3
  require('../../packages/datadog-plugin-cypress/src/support')
package/ci/init.js CHANGED
@@ -1,3 +1,5 @@
1
+ 'use strict'
2
+
1
3
  /* eslint-disable no-console */
2
4
  const tracer = require('../packages/dd-trace')
3
5
  const { isTrue, isFalse } = require('../packages/dd-trace/src/util')
package/index.d.ts CHANGED
@@ -186,6 +186,7 @@ interface Plugins {
186
186
  "graphql": tracer.plugins.graphql;
187
187
  "grpc": tracer.plugins.grpc;
188
188
  "hapi": tracer.plugins.hapi;
189
+ "hono": tracer.plugins.hono;
189
190
  "http": tracer.plugins.http;
190
191
  "http2": tracer.plugins.http2;
191
192
  "ioredis": tracer.plugins.ioredis;
@@ -1603,6 +1604,12 @@ declare namespace tracer {
1603
1604
  */
1604
1605
  interface hapi extends HttpServer {}
1605
1606
 
1607
+ /**
1608
+ * This plugin automatically instruments the
1609
+ * [hono](https://hono.dev/) module.
1610
+ */
1611
+ interface hono extends HttpServer {}
1612
+
1606
1613
  /**
1607
1614
  * This plugin automatically instruments the
1608
1615
  * [http](https://nodejs.org/api/http.html) module.
package/init.js CHANGED
@@ -1,12 +1,7 @@
1
1
  'use strict'
2
2
 
3
- /* eslint-disable no-var */
4
-
5
3
  var guard = require('./packages/dd-trace/src/guardrails')
6
4
 
7
5
  module.exports = guard(function () {
8
- var INSTRUMENTED_BY_SSI = require('./packages/dd-trace/src/constants').INSTRUMENTED_BY_SSI
9
- var obj = {}
10
- obj[INSTRUMENTED_BY_SSI] = 'ssi'
11
- return require('.').init(obj)
6
+ return require('.').init()
12
7
  })
package/initialize.mjs CHANGED
@@ -10,6 +10,8 @@
10
10
  * hook will always be active for ESM support.
11
11
  */
12
12
 
13
+ /* eslint n/no-unsupported-features/node-builtins: ['error', { ignores: ['module.register'] }] */
14
+
13
15
  import { isMainThread } from 'worker_threads'
14
16
 
15
17
  import * as Module from 'node:module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "5.57.1",
3
+ "version": "5.59.0",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -24,8 +24,11 @@
24
24
  "test:appsec:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/src/appsec/**/*.js\" -- npm run test:appsec:plugins",
25
25
  "test:debugger": "mocha -r 'packages/dd-trace/test/setup/mocha.js' 'packages/dd-trace/test/debugger/**/*.spec.js'",
26
26
  "test:debugger:ci": "nyc --no-clean --include 'packages/dd-trace/src/debugger/**/*.js' -- npm run test:debugger",
27
- "test:trace:core": "tap packages/dd-trace/test/*.spec.js \"packages/dd-trace/test/{ci-visibility,datastreams,encode,exporters,opentelemetry,opentracing,plugins,service-naming,standalone,telemetry}/**/*.spec.js\"",
27
+ "test:eslint-rules": "node eslint-rules/*.test.mjs",
28
+ "test:trace:core": "tap packages/dd-trace/test/*.spec.js \"packages/dd-trace/test/{ci-visibility,datastreams,encode,exporters,opentelemetry,opentracing,plugins,remote_config,service-naming,standalone,telemetry}/**/*.spec.js\"",
28
29
  "test:trace:core:ci": "npm run test:trace:core -- --coverage --nyc-arg=--include=\"packages/dd-trace/src/**/*.js\"",
30
+ "test:trace:guardrails": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/guardrails/**/*.spec.js\"",
31
+ "test:trace:guardrails:ci": "nyc --no-clean --include \"packages/dd-trace/src/guardrails/**/*.js\" -- npm run test:trace:guardrails",
29
32
  "test:instrumentations": "mocha -r 'packages/dd-trace/test/setup/mocha.js' \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\"",
30
33
  "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",
31
34
  "test:instrumentations:misc": "mocha -r 'packages/dd-trace/test/setup/mocha.js' 'packages/datadog-instrumentations/test/*/**/*.spec.js'",
@@ -54,6 +57,7 @@
54
57
  "test:integration:playwright": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/playwright/*.spec.js\"",
55
58
  "test:integration:selenium": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/selenium/*.spec.js\"",
56
59
  "test:integration:vitest": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/vitest/*.spec.js\"",
60
+ "test:integration:testopt": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/ci-visibility/*.spec.js\"",
57
61
  "test:integration:profiler": "mocha --timeout 180000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/profiler/*.spec.js\"",
58
62
  "test:integration:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/integration-test/**/*.spec.js\"",
59
63
  "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\"",
@@ -83,9 +87,34 @@
83
87
  "engines": {
84
88
  "node": ">=18"
85
89
  },
90
+ "files": [
91
+ "ci/**/*",
92
+ "cypress/**/*",
93
+ "esbuild.js",
94
+ "ext/**/*",
95
+ "index.d.ts",
96
+ "index.js",
97
+ "init.js",
98
+ "initialize.mjs",
99
+ "LICENSE-3rdparty.csv",
100
+ "LICENSE",
101
+ "LICENSE.Apache",
102
+ "LICENSE.BSD3",
103
+ "loader-hook.mjs",
104
+ "package.json",
105
+ "packages/*/index.js",
106
+ "packages/*/lib/**/*",
107
+ "packages/*/src/**/*",
108
+ "packages/datadog-instrumentations/orchestrion.yml",
109
+ "README.md",
110
+ "register.js",
111
+ "scripts/preinstall.js",
112
+ "vendor/**/*",
113
+ "version.js"
114
+ ],
86
115
  "dependencies": {
87
116
  "@datadog/libdatadog": "0.7.0",
88
- "@datadog/native-appsec": "8.5.2",
117
+ "@datadog/native-appsec": "10.0.0",
89
118
  "@datadog/native-iast-taint-tracking": "4.0.0",
90
119
  "@datadog/native-metrics": "3.1.1",
91
120
  "@datadog/pprof": "5.9.0",
@@ -96,17 +125,18 @@
96
125
  "@opentelemetry/core": "^1.14.0",
97
126
  "crypto-randomuuid": "^1.0.0",
98
127
  "dc-polyfill": "^0.1.9",
99
- "ignore": "^5.2.4",
128
+ "ignore": "^7.0.5",
100
129
  "import-in-the-middle": "^1.14.2",
101
130
  "istanbul-lib-coverage": "^3.2.2",
102
131
  "jest-docblock": "^29.7.0",
132
+ "jsonpath-plus": "^10.3.0",
103
133
  "koalas": "^1.0.2",
104
134
  "limiter": "^1.1.5",
105
135
  "lodash.sortby": "^4.7.0",
106
- "lru-cache": "^7.18.3",
136
+ "lru-cache": "^10.4.3",
107
137
  "module-details-from-path": "^1.0.4",
108
138
  "mutexify": "^1.4.0",
109
- "opentracing": ">=0.12.1",
139
+ "opentracing": ">=0.14.7",
110
140
  "path-to-regexp": "^0.1.12",
111
141
  "pprof-format": "^2.1.0",
112
142
  "protobufjs": "^7.5.3",
@@ -130,13 +160,13 @@
130
160
  "body-parser": "^2.2.0",
131
161
  "chai": "^4.5.0",
132
162
  "eslint": "^9.29.0",
133
- "eslint-config-standard": "^17.1.0",
163
+ "eslint-plugin-cypress": "^5.1.0",
134
164
  "eslint-plugin-import": "^2.32.0",
135
165
  "eslint-plugin-mocha": "^10.5.0",
136
166
  "eslint-plugin-n": "^17.20.0",
137
167
  "eslint-plugin-promise": "^7.2.1",
138
- "eslint-plugin-unicorn": "^57.0.0",
139
- "express": "^4.21.2",
168
+ "eslint-plugin-unicorn": "^59.0.1",
169
+ "express": "^5.1.0",
140
170
  "get-port": "^5.1.1",
141
171
  "glob": "^7.2.3",
142
172
  "globals": "^15.15.0",
@@ -154,6 +184,7 @@
154
184
  "sinon-chai": "^3.7.0",
155
185
  "tap": "^16.3.10",
156
186
  "tiktoken": "^1.0.21",
187
+ "workerpool": "^9.2.0",
157
188
  "yaml": "^2.8.0",
158
189
  "yarn-deduplicate": "^6.0.2"
159
190
  }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const { getUserLandFrames } = require('../dd-trace/src/plugins/util/stacktrace')
3
+ const { parseUserLandFrames } = require('../dd-trace/src/plugins/util/stacktrace')
4
4
 
5
5
  const ENTRY_SPAN_STACK_FRAMES_LIMIT = 1
6
6
  const EXIT_SPAN_STACK_FRAMES_LIMIT = Number(process.env._DD_CODE_ORIGIN_FOR_SPANS_EXIT_SPAN_MAX_USER_FRAMES) || 8
@@ -36,20 +36,25 @@ function exitTags (topOfStackFunc) {
36
36
  * @returns {Record<string, string>}
37
37
  */
38
38
  function tag (type, topOfStackFunc, limit) {
39
- const frames = getUserLandFrames(topOfStackFunc, limit)
39
+ // The `Error.prepareStackTrace` API doesn't support resolving source maps.
40
+ // Fall back to manually parsing the stack trace.
41
+ const dummy = {}
42
+ Error.captureStackTrace(dummy, topOfStackFunc)
43
+ const frames = parseUserLandFrames(dummy.stack, limit)
44
+
40
45
  const tags = {
41
46
  '_dd.code_origin.type': type
42
47
  }
43
48
  for (let i = 0; i < frames.length; i++) {
44
49
  const frame = frames[i]
45
- tags[`_dd.code_origin.frames.${i}.file`] = frame.file
46
- tags[`_dd.code_origin.frames.${i}.line`] = String(frame.line)
47
- tags[`_dd.code_origin.frames.${i}.column`] = String(frame.column)
48
- if (frame.method) {
49
- tags[`_dd.code_origin.frames.${i}.method`] = frame.method
50
+ tags[`_dd.code_origin.frames.${i}.file`] = frame.fileName
51
+ tags[`_dd.code_origin.frames.${i}.line`] = frame.lineNumber
52
+ tags[`_dd.code_origin.frames.${i}.column`] = frame.columnNumber
53
+ if (frame.methodName || frame.functionName) {
54
+ tags[`_dd.code_origin.frames.${i}.method`] = frame.methodName || frame.functionName
50
55
  }
51
- if (frame.type) {
52
- tags[`_dd.code_origin.frames.${i}.type`] = frame.type
56
+ if (frame.typeName) {
57
+ tags[`_dd.code_origin.frames.${i}.type`] = frame.typeName
53
58
  }
54
59
  }
55
60
  return tags
@@ -1,3 +1,5 @@
1
+ 'use strict'
2
+
1
3
  const {
2
4
  addHook,
3
5
  channel
@@ -16,20 +18,15 @@ const CHANNELS = {
16
18
 
17
19
  const generalErrorCh = channel('apm:apollo:gateway:general:error')
18
20
 
19
- function wrapExecutor (executor) {
20
- return function (...args) {
21
- const channel = CHANNELS['gateway.request']
22
- const ctx = { requestContext: args[0], gateway: this }
23
-
24
- return channel.tracePromise(executor, ctx, this, ...args)
25
- }
26
- }
27
-
28
21
  function wrapApolloGateway (ApolloGateway) {
29
22
  class ApolloGatewayWrapper extends ApolloGateway {
30
23
  constructor (...args) {
31
24
  super(...args)
32
- shimmer.wrap(this, 'executor', wrapExecutor)
25
+ shimmer.wrap(this, 'executor', (originalExecutor) => (...args) => {
26
+ const channel = CHANNELS['gateway.request']
27
+ const ctx = { requestContext: args[0], gateway: this }
28
+ return channel.tracePromise(originalExecutor, ctx, this, ...args)
29
+ })
33
30
  }
34
31
  }
35
32
  return ApolloGatewayWrapper
@@ -1,3 +1,5 @@
1
+ 'use strict'
2
+
1
3
  const shimmer = require('../../datadog-shimmer')
2
4
  const { addHook } = require('./helpers/instrument')
3
5
 
@@ -25,7 +25,7 @@ addHook({ name: '@azure/functions', versions: ['>=4'] }, azureFunction => {
25
25
  // The arguments are either an object with a handler property or the handler function itself
26
26
  function wrapHandler (method) {
27
27
  return function (name, arg) {
28
- if (typeof arg === 'object' && arg.hasOwnProperty('handler')) {
28
+ if (arg !== null && typeof arg === 'object' && arg.hasOwnProperty('handler')) {
29
29
  const options = arg
30
30
  shimmer.wrap(options, 'handler', handler => traceHandler(handler, name, method.name))
31
31
  } else if (typeof arg === 'function') {
@@ -4,8 +4,7 @@ const { errorMonitor } = require('events')
4
4
  const util = require('util')
5
5
 
6
6
  const {
7
- addHook,
8
- AsyncResource
7
+ addHook
9
8
  } = require('./helpers/instrument')
10
9
  const shimmer = require('../../datadog-shimmer')
11
10
  const dc = require('dc-polyfill')
@@ -80,7 +79,8 @@ function createContextFromChildProcessInfo (childProcessInfo) {
80
79
  const context = {
81
80
  command: childProcessInfo.command,
82
81
  file: childProcessInfo.file,
83
- shell: childProcessInfo.shell
82
+ shell: childProcessInfo.shell,
83
+ abortController: new AbortController()
84
84
  }
85
85
 
86
86
  if (childProcessInfo.fileArgs) {
@@ -98,17 +98,12 @@ function wrapChildProcessSyncMethod (returnError, shell = false) {
98
98
  }
99
99
 
100
100
  const childProcessInfo = normalizeArgs(arguments, shell)
101
+ const context = createContextFromChildProcessInfo(childProcessInfo)
101
102
 
102
- const innerResource = new AsyncResource('bound-anonymous-fn')
103
- return innerResource.runInAsyncScope(() => {
104
- const context = createContextFromChildProcessInfo(childProcessInfo)
105
- const abortController = new AbortController()
106
-
107
- childProcessChannel.start.publish({ ...context, abortController })
108
-
103
+ return childProcessChannel.start.runStores(context, () => {
109
104
  try {
110
- if (abortController.signal.aborted) {
111
- const error = abortController.signal.reason || new Error('Aborted')
105
+ if (context.abortController.signal.aborted) {
106
+ const error = context.abortController.signal.reason || new Error('Aborted')
112
107
  // expected behaviors on error are different
113
108
  return returnError(error, context)
114
109
  }
@@ -141,21 +136,17 @@ function wrapChildProcessCustomPromisifyMethod (customPromisifyMethod, shell) {
141
136
  const context = createContextFromChildProcessInfo(childProcessInfo)
142
137
 
143
138
  const { start, end, asyncStart, asyncEnd, error } = childProcessChannel
144
- const abortController = new AbortController()
145
-
146
- start.publish({
147
- ...context,
148
- abortController
149
- })
139
+ start.publish(context)
150
140
 
151
141
  let result
152
- if (abortController.signal.aborted) {
153
- result = Promise.reject(abortController.signal.reason || new Error('Aborted'))
142
+ if (context.abortController.signal.aborted) {
143
+ result = Promise.reject(context.abortController.signal.reason || new Error('Aborted'))
154
144
  } else {
155
145
  try {
156
146
  result = customPromisifyMethod.apply(this, arguments)
157
147
  } catch (error) {
158
- error.publish({ ...context, error })
148
+ context.error = error
149
+ error.publish(context)
159
150
  throw error
160
151
  } finally {
161
152
  end.publish(context)
@@ -179,7 +170,7 @@ function wrapChildProcessCustomPromisifyMethod (customPromisifyMethod, shell) {
179
170
  return result
180
171
  }
181
172
 
182
- return Promise.prototype.then.call(result, resolve, reject)
173
+ return Promise.resolve(result).then(resolve, reject)
183
174
  }
184
175
  }
185
176
 
@@ -192,26 +183,15 @@ function wrapChildProcessAsyncMethod (ChildProcess, shell = false) {
192
183
 
193
184
  const childProcessInfo = normalizeArgs(arguments, shell)
194
185
 
195
- const cb = arguments[arguments.length - 1]
196
- if (typeof cb === 'function') {
197
- const callbackResource = new AsyncResource('bound-anonymous-fn')
198
- arguments[arguments.length - 1] = callbackResource.bind(cb)
199
- }
200
-
201
- const innerResource = new AsyncResource('bound-anonymous-fn')
202
- return innerResource.runInAsyncScope(() => {
203
- const context = createContextFromChildProcessInfo(childProcessInfo)
204
- const abortController = new AbortController()
205
-
206
- childProcessChannel.start.publish({ ...context, abortController })
207
-
186
+ const context = createContextFromChildProcessInfo(childProcessInfo)
187
+ return childProcessChannel.start.runStores(context, () => {
208
188
  let childProcess
209
- if (abortController.signal.aborted) {
189
+ if (context.abortController.signal.aborted) {
210
190
  childProcess = new ChildProcess()
211
191
  childProcess.on('error', () => {}) // Original method does not crash when non subscribers
212
192
 
213
193
  process.nextTick(() => {
214
- const error = abortController.signal.reason || new Error('Aborted')
194
+ const error = context.abortController.signal.reason || new Error('Aborted')
215
195
  childProcess.emit('error', error)
216
196
 
217
197
  const cb = arguments[arguments.length - 1]
@@ -230,17 +210,16 @@ function wrapChildProcessAsyncMethod (ChildProcess, shell = false) {
230
210
 
231
211
  childProcess.on(errorMonitor, (e) => {
232
212
  errorExecuted = true
233
- childProcessChannel.error.publish(e)
213
+ context.error = e
214
+ childProcessChannel.error.publish(context)
234
215
  })
235
216
 
236
217
  childProcess.on('close', (code = 0) => {
237
218
  if (!errorExecuted && code !== 0) {
238
- childProcessChannel.error.publish()
219
+ childProcessChannel.error.publish(context)
239
220
  }
240
- childProcessChannel.asyncEnd.publish({
241
- ...context,
242
- result: code
243
- })
221
+ context.result = code
222
+ childProcessChannel.asyncEnd.publish(context)
244
223
  })
245
224
  }
246
225
 
@@ -43,6 +43,7 @@ const {
43
43
  CUCUMBER_WORKER_TRACE_PAYLOAD_CODE,
44
44
  getIsFaultyEarlyFlakeDetection
45
45
  } = require('../../dd-trace/src/plugins/util/test')
46
+ const satisfies = require('semifies')
46
47
 
47
48
  const isMarkedAsUnskippable = (pickle) => {
48
49
  return pickle.tags.some(tag => tag.name === '@datadog:unskippable')
@@ -224,7 +225,7 @@ function getPickleByFile (runtimeOrCoodinator) {
224
225
  }, {})
225
226
  }
226
227
 
227
- function wrapRun (pl, isLatestVersion) {
228
+ function wrapRun (pl, isLatestVersion, version) {
228
229
  if (patched.has(pl)) return
229
230
 
230
231
  patched.add(pl)
@@ -398,9 +399,10 @@ function wrapRun (pl, isLatestVersion) {
398
399
  const promise = runStep.apply(this, arguments)
399
400
 
400
401
  promise.then((result) => {
401
- const { status, skipReason, errorMessage } = isLatestVersion
402
- ? getStatusFromResultLatest(result)
403
- : getStatusFromResult(result)
402
+ const finalResult = satisfies(version, '>=12.0.0') ? result.result : result
403
+ const getStatus = satisfies(version, '>=7.3.0') ? getStatusFromResultLatest : getStatusFromResult
404
+
405
+ const { status, skipReason, errorMessage } = getStatus(finalResult)
404
406
 
405
407
  testFinishCh.publish({ isStep: true, status, skipReason, errorMessage, ...ctx.currentStore })
406
408
  })
@@ -415,18 +417,18 @@ function wrapRun (pl, isLatestVersion) {
415
417
  })
416
418
  }
417
419
 
418
- function pickleHook (PickleRunner) {
420
+ function pickleHook (PickleRunner, version) {
419
421
  const pl = PickleRunner.default
420
422
 
421
- wrapRun(pl, false)
423
+ wrapRun(pl, false, version)
422
424
 
423
425
  return PickleRunner
424
426
  }
425
427
 
426
- function testCaseHook (TestCaseRunner) {
428
+ function testCaseHook (TestCaseRunner, version) {
427
429
  const pl = TestCaseRunner.default
428
430
 
429
- wrapRun(pl, true)
431
+ wrapRun(pl, true, version)
430
432
 
431
433
  return TestCaseRunner
432
434
  }
@@ -1,3 +1,5 @@
1
+ 'use strict'
2
+
1
3
  const { addHook } = require('./helpers/instrument')
2
4
  const { DD_MAJOR } = require('../../../version')
3
5
 
@@ -14,6 +14,7 @@ const pathParamsReadCh = channel('datadog:fastify:path-params:finish')
14
14
 
15
15
  const parsingResources = new WeakMap()
16
16
  const cookiesPublished = new WeakSet()
17
+ const bodyPublished = new WeakSet()
17
18
 
18
19
  function wrapFastify (fastify, hasParsingEvents) {
19
20
  if (typeof fastify !== 'function') return fastify
@@ -124,6 +125,20 @@ function preHandler (request, reply, done) {
124
125
  if (!reply || typeof reply.send !== 'function') return done()
125
126
 
126
127
  const req = getReq(request)
128
+ const res = getRes(reply)
129
+
130
+ const hasBody = request.body && Object.keys(request.body).length > 0
131
+
132
+ // For multipart/form-data, the body is not available until after preValidation hook
133
+ if (bodyParserReadCh.hasSubscribers && hasBody && !bodyPublished.has(req)) {
134
+ const abortController = new AbortController()
135
+
136
+ bodyParserReadCh.publish({ req, res, body: request.body, abortController })
137
+
138
+ bodyPublished.add(req)
139
+
140
+ if (abortController.signal.aborted) return
141
+ }
127
142
 
128
143
  reply.send = wrapSend(reply.send, req)
129
144
 
@@ -151,11 +166,14 @@ function preValidation (request, reply, done) {
151
166
  if (abortController.signal.aborted) return
152
167
  }
153
168
 
154
- if (bodyParserReadCh.hasSubscribers && request.body) {
169
+ // Analyze body before schema validation
170
+ if (bodyParserReadCh.hasSubscribers && request.body && !bodyPublished.has(req)) {
155
171
  abortController ??= new AbortController()
156
172
 
157
173
  bodyParserReadCh.publish({ req, res, body: request.body, abortController })
158
174
 
175
+ bodyPublished.add(req)
176
+
159
177
  if (abortController.signal.aborted) return
160
178
  }
161
179
 
@@ -359,6 +359,15 @@ function finishResolvers ({ fields }) {
359
359
  })
360
360
  }
361
361
 
362
+ addHook({ name: '@graphql-tools/executor', versions: ['>=0.0.14'] }, executor => {
363
+ // graphql-yoga uses the normalizedExecutor function, so we need to wrap both. There is no risk in wrapping both
364
+ // since the functions are closely related, and our wrappedExecute function prevents double calls with the
365
+ // contexts.has(contextValue) check.
366
+ shimmer.wrap(executor, 'execute', wrapExecute(executor))
367
+ shimmer.wrap(executor, 'normalizedExecutor', wrapExecute(executor))
368
+ return executor
369
+ })
370
+
362
371
  addHook({ name: '@graphql-tools/executor', file: 'cjs/execution/execute.js', versions: ['>=0.0.14'] }, execute => {
363
372
  shimmer.wrap(execute, 'execute', wrapExecute(execute))
364
373
  return execute
@@ -58,6 +58,7 @@ module.exports = {
58
58
  grpc: () => require('../grpc'),
59
59
  handlebars: () => require('../handlebars'),
60
60
  hapi: () => require('../hapi'),
61
+ hono: { esmFirst: true, fn: () => require('../hono') },
61
62
  http: () => require('../http'),
62
63
  http2: () => require('../http2'),
63
64
  https: () => require('../http'),
@@ -72,7 +72,7 @@ for (const packageName of names) {
72
72
 
73
73
  let hook = hooks[packageName]
74
74
 
75
- if (typeof hook === 'object') {
75
+ if (hook !== null && typeof hook === 'object') {
76
76
  if (hook.serverless === false && isInServerlessEnvironment()) continue
77
77
 
78
78
  // some integrations are disabled by default, but can be enabled by setting
@@ -207,7 +207,7 @@ function filename (name, file) {
207
207
  // This function captures the instrumentation file name for a given package by parsing the hook require
208
208
  // function given the module name. It is used to ensure that instrumentations such as redis
209
209
  // that have several different modules being hooked, ie: 'redis' main package, and @redis/client submodule
210
- // return a consistent instrumentation name. This is used later to ensure that atleast some portion of
210
+ // return a consistent instrumentation name. This is used later to ensure that at least some portion of
211
211
  // the integration was successfully instrumented. Prevents incorrect `Found incompatible integration version: ` messages
212
212
  // Example:
213
213
  // redis -> "() => require('../redis')" -> redis