dd-trace 5.83.0 → 5.85.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 (630) hide show
  1. package/LICENSE-3rdparty.csv +0 -1
  2. package/ci/cypress/polyfills.js +1 -1
  3. package/ci/init.js +5 -5
  4. package/ext/exporters.js +1 -1
  5. package/ext/formats.js +1 -1
  6. package/ext/index.js +1 -1
  7. package/ext/kinds.js +1 -1
  8. package/ext/priority.js +1 -1
  9. package/ext/scopes.js +1 -1
  10. package/ext/tags.js +1 -1
  11. package/ext/types.js +1 -1
  12. package/index.d.ts +115 -2
  13. package/initialize.mjs +47 -31
  14. package/loader-hook.mjs +35 -22
  15. package/package.json +36 -33
  16. package/packages/datadog-code-origin/index.js +12 -10
  17. package/packages/datadog-core/src/utils/src/pick.js +2 -2
  18. package/packages/datadog-esbuild/index.js +75 -79
  19. package/packages/datadog-esbuild/src/log.js +32 -0
  20. package/packages/datadog-esbuild/src/utils.js +12 -8
  21. package/packages/datadog-instrumentations/src/aerospike.js +3 -3
  22. package/packages/datadog-instrumentations/src/ai.js +5 -5
  23. package/packages/datadog-instrumentations/src/amqp10.js +1 -1
  24. package/packages/datadog-instrumentations/src/amqplib.js +1 -1
  25. package/packages/datadog-instrumentations/src/anthropic.js +3 -3
  26. package/packages/datadog-instrumentations/src/apollo-server.js +4 -4
  27. package/packages/datadog-instrumentations/src/apollo.js +2 -2
  28. package/packages/datadog-instrumentations/src/avsc.js +1 -1
  29. package/packages/datadog-instrumentations/src/aws-sdk.js +4 -4
  30. package/packages/datadog-instrumentations/src/azure-event-hubs.js +2 -2
  31. package/packages/datadog-instrumentations/src/azure-functions.js +1 -1
  32. package/packages/datadog-instrumentations/src/azure-service-bus.js +1 -1
  33. package/packages/datadog-instrumentations/src/body-parser.js +2 -2
  34. package/packages/datadog-instrumentations/src/bunyan.js +1 -1
  35. package/packages/datadog-instrumentations/src/cassandra-driver.js +1 -1
  36. package/packages/datadog-instrumentations/src/child_process.js +7 -7
  37. package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +17 -16
  38. package/packages/datadog-instrumentations/src/cookie-parser.js +1 -1
  39. package/packages/datadog-instrumentations/src/couchbase.js +8 -6
  40. package/packages/datadog-instrumentations/src/crypto.js +1 -1
  41. package/packages/datadog-instrumentations/src/cucumber.js +19 -19
  42. package/packages/datadog-instrumentations/src/cypress.js +1 -1
  43. package/packages/datadog-instrumentations/src/dns.js +2 -2
  44. package/packages/datadog-instrumentations/src/elasticsearch.js +2 -2
  45. package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +2 -2
  46. package/packages/datadog-instrumentations/src/express-session.js +1 -1
  47. package/packages/datadog-instrumentations/src/express.js +4 -4
  48. package/packages/datadog-instrumentations/src/fastify.js +1 -1
  49. package/packages/datadog-instrumentations/src/fetch.js +2 -2
  50. package/packages/datadog-instrumentations/src/fs.js +7 -7
  51. package/packages/datadog-instrumentations/src/generic-pool.js +2 -2
  52. package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +8 -8
  53. package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +4 -4
  54. package/packages/datadog-instrumentations/src/google-genai.js +1 -1
  55. package/packages/datadog-instrumentations/src/graphql.js +10 -10
  56. package/packages/datadog-instrumentations/src/grpc/client.js +9 -13
  57. package/packages/datadog-instrumentations/src/grpc/types.js +1 -1
  58. package/packages/datadog-instrumentations/src/helpers/bundler-register.js +1 -1
  59. package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +1 -1
  60. package/packages/datadog-instrumentations/src/helpers/extract-package-and-module-path.js +2 -2
  61. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -1
  62. package/packages/datadog-instrumentations/src/helpers/register.js +7 -7
  63. package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +6 -0
  64. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +1 -0
  65. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +1 -1
  66. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langchain.js +55 -55
  67. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +74 -17
  68. package/packages/datadog-instrumentations/src/helpers/router-helper.js +7 -7
  69. package/packages/datadog-instrumentations/src/helpers/shared-utils.js +1 -1
  70. package/packages/datadog-instrumentations/src/hono.js +6 -6
  71. package/packages/datadog-instrumentations/src/http/client.js +1 -1
  72. package/packages/datadog-instrumentations/src/http/server.js +4 -4
  73. package/packages/datadog-instrumentations/src/http2/server.js +1 -1
  74. package/packages/datadog-instrumentations/src/ioredis.js +1 -1
  75. package/packages/datadog-instrumentations/src/iovalkey.js +1 -1
  76. package/packages/datadog-instrumentations/src/jest.js +250 -106
  77. package/packages/datadog-instrumentations/src/kafkajs.js +9 -8
  78. package/packages/datadog-instrumentations/src/knex.js +2 -2
  79. package/packages/datadog-instrumentations/src/koa.js +3 -1
  80. package/packages/datadog-instrumentations/src/ldapjs.js +1 -1
  81. package/packages/datadog-instrumentations/src/light-my-request.js +1 -1
  82. package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
  83. package/packages/datadog-instrumentations/src/mariadb.js +1 -1
  84. package/packages/datadog-instrumentations/src/memcached.js +1 -1
  85. package/packages/datadog-instrumentations/src/mocha/common.js +3 -3
  86. package/packages/datadog-instrumentations/src/mocha/main.js +24 -24
  87. package/packages/datadog-instrumentations/src/mocha/utils.js +15 -11
  88. package/packages/datadog-instrumentations/src/mocha/worker.js +4 -4
  89. package/packages/datadog-instrumentations/src/moleculer/server.js +1 -1
  90. package/packages/datadog-instrumentations/src/mongodb-core.js +3 -3
  91. package/packages/datadog-instrumentations/src/mongodb.js +7 -7
  92. package/packages/datadog-instrumentations/src/mongoose.js +10 -10
  93. package/packages/datadog-instrumentations/src/mquery.js +6 -6
  94. package/packages/datadog-instrumentations/src/multer.js +1 -1
  95. package/packages/datadog-instrumentations/src/mysql.js +1 -1
  96. package/packages/datadog-instrumentations/src/net.js +6 -6
  97. package/packages/datadog-instrumentations/src/next.js +6 -6
  98. package/packages/datadog-instrumentations/src/nyc.js +34 -2
  99. package/packages/datadog-instrumentations/src/openai.js +24 -24
  100. package/packages/datadog-instrumentations/src/oracledb.js +2 -2
  101. package/packages/datadog-instrumentations/src/otel-sdk-trace.js +1 -1
  102. package/packages/datadog-instrumentations/src/passport-http.js +1 -1
  103. package/packages/datadog-instrumentations/src/passport-local.js +1 -1
  104. package/packages/datadog-instrumentations/src/passport-utils.js +1 -1
  105. package/packages/datadog-instrumentations/src/passport.js +1 -1
  106. package/packages/datadog-instrumentations/src/pg.js +3 -3
  107. package/packages/datadog-instrumentations/src/pino.js +2 -2
  108. package/packages/datadog-instrumentations/src/playwright.js +71 -67
  109. package/packages/datadog-instrumentations/src/prisma.js +24 -78
  110. package/packages/datadog-instrumentations/src/promise-js.js +1 -1
  111. package/packages/datadog-instrumentations/src/promise.js +1 -1
  112. package/packages/datadog-instrumentations/src/protobufjs.js +6 -6
  113. package/packages/datadog-instrumentations/src/q.js +2 -2
  114. package/packages/datadog-instrumentations/src/redis.js +2 -2
  115. package/packages/datadog-instrumentations/src/rhea.js +5 -5
  116. package/packages/datadog-instrumentations/src/router.js +8 -8
  117. package/packages/datadog-instrumentations/src/selenium.js +3 -3
  118. package/packages/datadog-instrumentations/src/sequelize.js +1 -1
  119. package/packages/datadog-instrumentations/src/sharedb.js +2 -2
  120. package/packages/datadog-instrumentations/src/tedious.js +1 -1
  121. package/packages/datadog-instrumentations/src/undici.js +2 -2
  122. package/packages/datadog-instrumentations/src/url.js +5 -5
  123. package/packages/datadog-instrumentations/src/vitest.js +56 -45
  124. package/packages/datadog-instrumentations/src/when.js +1 -1
  125. package/packages/datadog-instrumentations/src/winston.js +1 -1
  126. package/packages/datadog-instrumentations/src/ws.js +128 -41
  127. package/packages/datadog-plugin-aerospike/src/index.js +4 -4
  128. package/packages/datadog-plugin-ai/src/index.js +1 -1
  129. package/packages/datadog-plugin-ai/src/tracing.js +2 -2
  130. package/packages/datadog-plugin-ai/src/utils.js +1 -1
  131. package/packages/datadog-plugin-amqp10/src/consumer.js +2 -2
  132. package/packages/datadog-plugin-amqp10/src/index.js +1 -1
  133. package/packages/datadog-plugin-amqp10/src/producer.js +2 -2
  134. package/packages/datadog-plugin-amqplib/src/client.js +2 -2
  135. package/packages/datadog-plugin-amqplib/src/consumer.js +2 -2
  136. package/packages/datadog-plugin-amqplib/src/index.js +1 -1
  137. package/packages/datadog-plugin-amqplib/src/producer.js +2 -2
  138. package/packages/datadog-plugin-amqplib/src/util.js +1 -1
  139. package/packages/datadog-plugin-anthropic/src/index.js +1 -1
  140. package/packages/datadog-plugin-anthropic/src/tracing.js +2 -2
  141. package/packages/datadog-plugin-apollo/src/gateway/fetch.js +1 -1
  142. package/packages/datadog-plugin-apollo/src/gateway/index.js +1 -1
  143. package/packages/datadog-plugin-apollo/src/gateway/request.js +5 -5
  144. package/packages/datadog-plugin-apollo/src/index.js +1 -1
  145. package/packages/datadog-plugin-avsc/src/schema_iterator.js +3 -3
  146. package/packages/datadog-plugin-aws-sdk/src/base.js +11 -10
  147. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +1 -1
  148. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +1 -1
  149. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +24 -24
  150. package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
  151. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -1
  152. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +6 -6
  153. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +3 -3
  154. package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -1
  155. package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
  156. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +5 -5
  157. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +12 -12
  158. package/packages/datadog-plugin-aws-sdk/src/util.js +1 -1
  159. package/packages/datadog-plugin-azure-event-hubs/src/index.js +1 -1
  160. package/packages/datadog-plugin-azure-event-hubs/src/producer.js +3 -3
  161. package/packages/datadog-plugin-azure-functions/src/index.js +11 -10
  162. package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
  163. package/packages/datadog-plugin-azure-service-bus/src/producer.js +3 -3
  164. package/packages/datadog-plugin-bullmq/src/consumer.js +2 -2
  165. package/packages/datadog-plugin-bullmq/src/index.js +1 -1
  166. package/packages/datadog-plugin-bullmq/src/producer.js +11 -11
  167. package/packages/datadog-plugin-cassandra-driver/src/index.js +2 -2
  168. package/packages/datadog-plugin-child_process/src/index.js +2 -2
  169. package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +5 -5
  170. package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +1 -1
  171. package/packages/datadog-plugin-couchbase/src/index.js +3 -3
  172. package/packages/datadog-plugin-cucumber/src/index.js +46 -45
  173. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +68 -55
  174. package/packages/datadog-plugin-cypress/src/plugin.js +1 -1
  175. package/packages/datadog-plugin-cypress/src/support.js +56 -9
  176. package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -1
  177. package/packages/datadog-plugin-dns/src/index.js +1 -1
  178. package/packages/datadog-plugin-dns/src/lookup.js +2 -2
  179. package/packages/datadog-plugin-dns/src/lookup_service.js +3 -3
  180. package/packages/datadog-plugin-dns/src/resolve.js +2 -2
  181. package/packages/datadog-plugin-dns/src/reverse.js +2 -2
  182. package/packages/datadog-plugin-elasticsearch/src/index.js +2 -2
  183. package/packages/datadog-plugin-express/src/index.js +1 -1
  184. package/packages/datadog-plugin-fastify/src/index.js +1 -1
  185. package/packages/datadog-plugin-fs/src/index.js +2 -2
  186. package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +2 -2
  187. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +8 -6
  188. package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -1
  189. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +11 -10
  190. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +6 -6
  191. package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +1 -1
  192. package/packages/datadog-plugin-google-cloud-vertexai/src/tracing.js +2 -2
  193. package/packages/datadog-plugin-google-cloud-vertexai/src/utils.js +1 -1
  194. package/packages/datadog-plugin-google-genai/src/index.js +1 -1
  195. package/packages/datadog-plugin-google-genai/src/tracing.js +2 -2
  196. package/packages/datadog-plugin-graphql/src/execute.js +2 -2
  197. package/packages/datadog-plugin-graphql/src/index.js +2 -2
  198. package/packages/datadog-plugin-graphql/src/parse.js +1 -1
  199. package/packages/datadog-plugin-graphql/src/resolve.js +6 -6
  200. package/packages/datadog-plugin-graphql/src/utils.js +1 -1
  201. package/packages/datadog-plugin-graphql/src/validate.js +2 -2
  202. package/packages/datadog-plugin-grpc/src/client.js +3 -3
  203. package/packages/datadog-plugin-grpc/src/index.js +1 -1
  204. package/packages/datadog-plugin-grpc/src/server.js +3 -3
  205. package/packages/datadog-plugin-grpc/src/util.js +2 -2
  206. package/packages/datadog-plugin-http/src/client.js +10 -10
  207. package/packages/datadog-plugin-http/src/index.js +1 -1
  208. package/packages/datadog-plugin-http2/src/client.js +6 -6
  209. package/packages/datadog-plugin-http2/src/index.js +1 -1
  210. package/packages/datadog-plugin-http2/src/server.js +1 -1
  211. package/packages/datadog-plugin-jest/src/index.js +39 -22
  212. package/packages/datadog-plugin-jest/src/util.js +1 -1
  213. package/packages/datadog-plugin-kafkajs/src/consumer.js +5 -5
  214. package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
  215. package/packages/datadog-plugin-kafkajs/src/producer.js +5 -5
  216. package/packages/datadog-plugin-kafkajs/src/utils.js +1 -1
  217. package/packages/datadog-plugin-langchain/src/tokens.js +2 -2
  218. package/packages/datadog-plugin-langchain/src/tracing.js +4 -4
  219. package/packages/datadog-plugin-memcached/src/index.js +2 -2
  220. package/packages/datadog-plugin-mocha/src/index.js +12 -12
  221. package/packages/datadog-plugin-moleculer/src/client.js +1 -1
  222. package/packages/datadog-plugin-moleculer/src/index.js +1 -1
  223. package/packages/datadog-plugin-moleculer/src/server.js +2 -2
  224. package/packages/datadog-plugin-moleculer/src/util.js +1 -1
  225. package/packages/datadog-plugin-mongodb-core/src/index.js +5 -5
  226. package/packages/datadog-plugin-mysql/src/index.js +2 -2
  227. package/packages/datadog-plugin-net/src/ipc.js +2 -2
  228. package/packages/datadog-plugin-net/src/tcp.js +4 -4
  229. package/packages/datadog-plugin-next/src/index.js +4 -4
  230. package/packages/datadog-plugin-nyc/src/index.js +60 -0
  231. package/packages/datadog-plugin-openai/src/index.js +1 -1
  232. package/packages/datadog-plugin-openai/src/services.js +3 -3
  233. package/packages/datadog-plugin-openai/src/stream-helpers.js +1 -1
  234. package/packages/datadog-plugin-openai/src/tracing.js +10 -10
  235. package/packages/datadog-plugin-oracledb/src/connection-parser.js +1 -1
  236. package/packages/datadog-plugin-oracledb/src/index.js +1 -1
  237. package/packages/datadog-plugin-pg/src/index.js +2 -2
  238. package/packages/datadog-plugin-playwright/src/index.js +42 -42
  239. package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +95 -0
  240. package/packages/datadog-plugin-prisma/src/index.js +129 -10
  241. package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +3 -3
  242. package/packages/datadog-plugin-redis/src/index.js +2 -2
  243. package/packages/datadog-plugin-restify/src/index.js +1 -1
  244. package/packages/datadog-plugin-rhea/src/consumer.js +2 -2
  245. package/packages/datadog-plugin-rhea/src/index.js +1 -1
  246. package/packages/datadog-plugin-rhea/src/producer.js +2 -2
  247. package/packages/datadog-plugin-router/src/index.js +3 -3
  248. package/packages/datadog-plugin-selenium/src/index.js +2 -2
  249. package/packages/datadog-plugin-sharedb/src/index.js +2 -2
  250. package/packages/datadog-plugin-tedious/src/index.js +2 -2
  251. package/packages/datadog-plugin-undici/src/index.js +5 -5
  252. package/packages/datadog-plugin-vitest/src/index.js +39 -18
  253. package/packages/datadog-plugin-ws/src/close.js +10 -11
  254. package/packages/datadog-plugin-ws/src/index.js +1 -1
  255. package/packages/datadog-plugin-ws/src/producer.js +8 -9
  256. package/packages/datadog-plugin-ws/src/receiver.js +8 -9
  257. package/packages/datadog-plugin-ws/src/server.js +17 -12
  258. package/packages/datadog-plugin-ws/src/util.js +48 -16
  259. package/packages/datadog-shimmer/src/shimmer.js +5 -8
  260. package/packages/dd-trace/index.js +2 -2
  261. package/packages/dd-trace/src/agent/info.js +57 -0
  262. package/packages/dd-trace/src/agent/url.js +28 -0
  263. package/packages/dd-trace/src/aiguard/client.js +3 -3
  264. package/packages/dd-trace/src/aiguard/sdk.js +6 -6
  265. package/packages/dd-trace/src/aiguard/tags.js +1 -1
  266. package/packages/dd-trace/src/analytics_sampler.js +1 -1
  267. package/packages/dd-trace/src/appsec/activation.js +1 -1
  268. package/packages/dd-trace/src/appsec/addresses.js +1 -1
  269. package/packages/dd-trace/src/appsec/api_security_sampler.js +1 -1
  270. package/packages/dd-trace/src/appsec/blocked_templates.js +1 -1
  271. package/packages/dd-trace/src/appsec/blocking.js +5 -5
  272. package/packages/dd-trace/src/appsec/channels.js +1 -1
  273. package/packages/dd-trace/src/appsec/graphql.js +13 -13
  274. package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +1 -1
  275. package/packages/dd-trace/src/appsec/iast/analyzers/cookie-analyzer.js +1 -1
  276. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-base-analyzer.js +6 -5
  277. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +2 -2
  278. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-rule-type.js +1 -1
  279. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +148 -148
  280. package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +148 -148
  281. package/packages/dd-trace/src/appsec/iast/analyzers/index.js +1 -1
  282. package/packages/dd-trace/src/appsec/iast/analyzers/missing-header-analyzer.js +1 -1
  283. package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +7 -8
  284. package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +2 -2
  285. package/packages/dd-trace/src/appsec/iast/analyzers/set-cookies-header-interceptor.js +2 -2
  286. package/packages/dd-trace/src/appsec/iast/analyzers/unvalidated-redirect-analyzer.js +2 -2
  287. package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +3 -3
  288. package/packages/dd-trace/src/appsec/iast/analyzers/weak-cipher-analyzer.js +1 -1
  289. package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +2 -2
  290. package/packages/dd-trace/src/appsec/iast/context/context-plugin.js +3 -3
  291. package/packages/dd-trace/src/appsec/iast/iast-context.js +6 -3
  292. package/packages/dd-trace/src/appsec/iast/iast-plugin.js +17 -9
  293. package/packages/dd-trace/src/appsec/iast/index.js +2 -2
  294. package/packages/dd-trace/src/appsec/iast/overhead-controller.js +9 -9
  295. package/packages/dd-trace/src/appsec/iast/path-line.js +6 -6
  296. package/packages/dd-trace/src/appsec/iast/security-controls/index.js +11 -11
  297. package/packages/dd-trace/src/appsec/iast/security-controls/parser.js +49 -17
  298. package/packages/dd-trace/src/appsec/iast/tags.js +1 -1
  299. package/packages/dd-trace/src/appsec/iast/taint-tracking/constants.js +1 -1
  300. package/packages/dd-trace/src/appsec/iast/taint-tracking/csi-methods.js +2 -2
  301. package/packages/dd-trace/src/appsec/iast/taint-tracking/filter.js +1 -1
  302. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +2 -2
  303. package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +3 -6
  304. package/packages/dd-trace/src/appsec/iast/taint-tracking/operations.js +2 -2
  305. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +5 -5
  306. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +4 -4
  307. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +5 -5
  308. package/packages/dd-trace/src/appsec/iast/taint-tracking/secure-marks.js +6 -4
  309. package/packages/dd-trace/src/appsec/iast/taint-tracking/source-types.js +1 -1
  310. package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +8 -8
  311. package/packages/dd-trace/src/appsec/iast/telemetry/iast-metric.js +4 -4
  312. package/packages/dd-trace/src/appsec/iast/telemetry/namespaces.js +2 -2
  313. package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +6 -6
  314. package/packages/dd-trace/src/appsec/iast/telemetry/verbosity.js +2 -2
  315. package/packages/dd-trace/src/appsec/iast/utils.js +3 -3
  316. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/constants.js +1 -1
  317. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/range-utils.js +1 -1
  318. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/hardcoded-password-analyzer.js +1 -1
  319. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +6 -6
  320. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/tainted-range-based-sensitive-analyzer.js +1 -1
  321. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +8 -8
  322. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-regex.js +1 -1
  323. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +12 -11
  324. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +5 -5
  325. package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +1 -1
  326. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +4 -4
  327. package/packages/dd-trace/src/appsec/index.js +65 -27
  328. package/packages/dd-trace/src/appsec/rasp/command_injection.js +3 -3
  329. package/packages/dd-trace/src/appsec/rasp/fs-plugin.js +4 -4
  330. package/packages/dd-trace/src/appsec/rasp/index.js +2 -2
  331. package/packages/dd-trace/src/appsec/rasp/lfi.js +5 -5
  332. package/packages/dd-trace/src/appsec/rasp/sql_injection.js +2 -2
  333. package/packages/dd-trace/src/appsec/rasp/ssrf.js +1 -1
  334. package/packages/dd-trace/src/appsec/rasp/utils.js +4 -4
  335. package/packages/dd-trace/src/appsec/rc-products.js +1 -1
  336. package/packages/dd-trace/src/appsec/remote_config.js +3 -3
  337. package/packages/dd-trace/src/appsec/reporter.js +11 -11
  338. package/packages/dd-trace/src/appsec/rule_manager.js +1 -1
  339. package/packages/dd-trace/src/appsec/sdk/index.js +1 -1
  340. package/packages/dd-trace/src/appsec/sdk/set_user.js +2 -2
  341. package/packages/dd-trace/src/appsec/sdk/track_event.js +7 -7
  342. package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -1
  343. package/packages/dd-trace/src/appsec/sdk/utils.js +1 -1
  344. package/packages/dd-trace/src/appsec/stack_trace.js +5 -5
  345. package/packages/dd-trace/src/appsec/telemetry/common.js +3 -3
  346. package/packages/dd-trace/src/appsec/telemetry/index.js +5 -5
  347. package/packages/dd-trace/src/appsec/telemetry/rasp.js +3 -3
  348. package/packages/dd-trace/src/appsec/telemetry/user.js +4 -4
  349. package/packages/dd-trace/src/appsec/telemetry/waf.js +3 -3
  350. package/packages/dd-trace/src/appsec/user_tracking.js +7 -7
  351. package/packages/dd-trace/src/appsec/waf/diagnostics.js +2 -2
  352. package/packages/dd-trace/src/appsec/waf/index.js +1 -1
  353. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +2 -2
  354. package/packages/dd-trace/src/azure_metadata.js +16 -9
  355. package/packages/dd-trace/src/baggage.js +1 -1
  356. package/packages/dd-trace/src/ci-visibility/coverage-report-discovery.js +82 -0
  357. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +5 -5
  358. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +9 -9
  359. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +8 -8
  360. package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +11 -11
  361. package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +4 -3
  362. package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +8 -6
  363. package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +2 -0
  364. package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +4 -3
  365. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +39 -20
  366. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +22 -22
  367. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +1 -1
  368. package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +1 -1
  369. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +8 -8
  370. package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +3 -3
  371. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +17 -12
  372. package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +92 -0
  373. package/packages/dd-trace/src/ci-visibility/telemetry.js +8 -4
  374. package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +1 -1
  375. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +6 -6
  376. package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +61 -0
  377. package/packages/dd-trace/src/config/defaults.js +1 -1
  378. package/packages/dd-trace/src/config/git_properties.js +1 -1
  379. package/packages/dd-trace/src/config/helper.js +2 -2
  380. package/packages/dd-trace/src/config/index.js +645 -641
  381. package/packages/dd-trace/src/config/remote_config.js +2 -1
  382. package/packages/dd-trace/src/config/stable.js +2 -2
  383. package/packages/dd-trace/src/config/supported-configurations.json +2 -1
  384. package/packages/dd-trace/src/constants.js +3 -3
  385. package/packages/dd-trace/src/crashtracking/crashtracker.js +8 -11
  386. package/packages/dd-trace/src/datastreams/checkpointer.js +1 -1
  387. package/packages/dd-trace/src/datastreams/context.js +1 -1
  388. package/packages/dd-trace/src/datastreams/encoding.js +1 -1
  389. package/packages/dd-trace/src/datastreams/fnv.js +1 -1
  390. package/packages/dd-trace/src/datastreams/index.js +8 -8
  391. package/packages/dd-trace/src/datastreams/pathway.js +5 -3
  392. package/packages/dd-trace/src/datastreams/processor.js +14 -12
  393. package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +27 -25
  394. package/packages/dd-trace/src/datastreams/schemas/schema_sampler.js +1 -1
  395. package/packages/dd-trace/src/datastreams/size.js +3 -3
  396. package/packages/dd-trace/src/datastreams/writer.js +5 -11
  397. package/packages/dd-trace/src/debugger/config.js +2 -1
  398. package/packages/dd-trace/src/debugger/constants.js +7 -0
  399. package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +14 -10
  400. package/packages/dd-trace/src/debugger/devtools_client/condition.js +2 -2
  401. package/packages/dd-trace/src/debugger/devtools_client/config.js +6 -12
  402. package/packages/dd-trace/src/debugger/devtools_client/defaults.js +1 -1
  403. package/packages/dd-trace/src/debugger/devtools_client/index.js +32 -25
  404. package/packages/dd-trace/src/debugger/devtools_client/inspector_promises_polyfill.js +1 -1
  405. package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +10 -11
  406. package/packages/dd-trace/src/debugger/devtools_client/log.js +1 -1
  407. package/packages/dd-trace/src/debugger/devtools_client/send.js +54 -10
  408. package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +94 -37
  409. package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +4 -4
  410. package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +7 -7
  411. package/packages/dd-trace/src/debugger/devtools_client/snapshot/redaction.js +2 -2
  412. package/packages/dd-trace/src/debugger/devtools_client/snapshot/symbols.js +1 -1
  413. package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +1 -1
  414. package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +10 -1
  415. package/packages/dd-trace/src/debugger/devtools_client/state.js +65 -8
  416. package/packages/dd-trace/src/debugger/devtools_client/status.js +9 -8
  417. package/packages/dd-trace/src/debugger/index.js +95 -37
  418. package/packages/dd-trace/src/dogstatsd.js +17 -18
  419. package/packages/dd-trace/src/encode/0.4.js +7 -6
  420. package/packages/dd-trace/src/encode/agentless-ci-visibility.js +8 -8
  421. package/packages/dd-trace/src/encode/coverage-ci-visibility.js +3 -3
  422. package/packages/dd-trace/src/encode/span-stats.js +2 -2
  423. package/packages/dd-trace/src/encode/tags-processors.js +1 -1
  424. package/packages/dd-trace/src/exporters/agent/index.js +5 -9
  425. package/packages/dd-trace/src/exporters/agent/writer.js +5 -4
  426. package/packages/dd-trace/src/exporters/common/agents.js +1 -1
  427. package/packages/dd-trace/src/exporters/common/{agent-info-exporter.js → buffering-exporter.js} +12 -39
  428. package/packages/dd-trace/src/exporters/common/docker.js +11 -7
  429. package/packages/dd-trace/src/exporters/common/request.js +28 -8
  430. package/packages/dd-trace/src/exporters/common/url-to-http-options-polyfill.js +2 -2
  431. package/packages/dd-trace/src/exporters/common/writer.js +2 -0
  432. package/packages/dd-trace/src/exporters/span-stats/index.js +4 -11
  433. package/packages/dd-trace/src/exporters/span-stats/writer.js +3 -3
  434. package/packages/dd-trace/src/external-logger/src/index.js +4 -4
  435. package/packages/dd-trace/src/flare/index.js +3 -3
  436. package/packages/dd-trace/src/guardrails/telemetry.js +1 -1
  437. package/packages/dd-trace/src/heap_snapshots.js +1 -1
  438. package/packages/dd-trace/src/id.js +1 -1
  439. package/packages/dd-trace/src/iitm.js +1 -1
  440. package/packages/dd-trace/src/lambda/handler.js +1 -1
  441. package/packages/dd-trace/src/lambda/runtime/errors.js +1 -1
  442. package/packages/dd-trace/src/lambda/runtime/ritm.js +3 -3
  443. package/packages/dd-trace/src/llmobs/constants/tags.js +1 -1
  444. package/packages/dd-trace/src/llmobs/constants/text.js +1 -1
  445. package/packages/dd-trace/src/llmobs/constants/writers.js +1 -1
  446. package/packages/dd-trace/src/llmobs/index.js +2 -4
  447. package/packages/dd-trace/src/llmobs/noop.js +2 -2
  448. package/packages/dd-trace/src/llmobs/plugins/ai/index.js +8 -8
  449. package/packages/dd-trace/src/llmobs/plugins/ai/util.js +2 -2
  450. package/packages/dd-trace/src/llmobs/plugins/anthropic.js +5 -5
  451. package/packages/dd-trace/src/llmobs/plugins/base.js +1 -1
  452. package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +8 -8
  453. package/packages/dd-trace/src/llmobs/plugins/genai/index.js +2 -2
  454. package/packages/dd-trace/src/llmobs/plugins/genai/util.js +15 -15
  455. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +2 -2
  456. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +5 -5
  457. package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +1 -1
  458. package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +3 -3
  459. package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +1 -1
  460. package/packages/dd-trace/src/llmobs/plugins/openai/index.js +17 -17
  461. package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +3 -3
  462. package/packages/dd-trace/src/llmobs/plugins/vertexai.js +6 -6
  463. package/packages/dd-trace/src/llmobs/sdk.js +11 -11
  464. package/packages/dd-trace/src/llmobs/span_processor.js +6 -6
  465. package/packages/dd-trace/src/llmobs/tagger.js +4 -4
  466. package/packages/dd-trace/src/llmobs/telemetry.js +8 -8
  467. package/packages/dd-trace/src/llmobs/util.js +1 -1
  468. package/packages/dd-trace/src/llmobs/writers/base.js +11 -17
  469. package/packages/dd-trace/src/llmobs/writers/evaluations.js +5 -5
  470. package/packages/dd-trace/src/llmobs/writers/spans.js +3 -3
  471. package/packages/dd-trace/src/llmobs/writers/util.js +4 -10
  472. package/packages/dd-trace/src/log/channels.js +2 -2
  473. package/packages/dd-trace/src/log/index.js +46 -31
  474. package/packages/dd-trace/src/log/log.js +1 -1
  475. package/packages/dd-trace/src/log/writer.js +14 -79
  476. package/packages/dd-trace/src/noop/span.js +2 -2
  477. package/packages/dd-trace/src/openfeature/constants/constants.js +1 -1
  478. package/packages/dd-trace/src/openfeature/flagging_provider.js +4 -4
  479. package/packages/dd-trace/src/openfeature/index.js +2 -2
  480. package/packages/dd-trace/src/openfeature/noop.js +3 -3
  481. package/packages/dd-trace/src/openfeature/remote_config.js +1 -1
  482. package/packages/dd-trace/src/openfeature/writers/base.js +14 -20
  483. package/packages/dd-trace/src/openfeature/writers/exposures.js +10 -10
  484. package/packages/dd-trace/src/openfeature/writers/util.js +4 -9
  485. package/packages/dd-trace/src/opentelemetry/context_manager.js +48 -29
  486. package/packages/dd-trace/src/opentelemetry/logs/index.js +2 -2
  487. package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +2 -2
  488. package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +10 -10
  489. package/packages/dd-trace/src/opentelemetry/metrics/constants.js +3 -3
  490. package/packages/dd-trace/src/opentelemetry/metrics/index.js +2 -2
  491. package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +3 -3
  492. package/packages/dd-trace/src/opentelemetry/metrics/meter.js +1 -1
  493. package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +11 -11
  494. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +18 -18
  495. package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +6 -6
  496. package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +10 -7
  497. package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +3 -3
  498. package/packages/dd-trace/src/opentelemetry/span.js +8 -8
  499. package/packages/dd-trace/src/opentelemetry/span_context.js +1 -1
  500. package/packages/dd-trace/src/opentelemetry/span_processor.js +1 -1
  501. package/packages/dd-trace/src/opentelemetry/tracer.js +4 -4
  502. package/packages/dd-trace/src/opentracing/propagation/log.js +2 -2
  503. package/packages/dd-trace/src/opentracing/propagation/text_map.js +14 -12
  504. package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +2 -0
  505. package/packages/dd-trace/src/opentracing/span.js +20 -20
  506. package/packages/dd-trace/src/opentracing/span_context.js +3 -3
  507. package/packages/dd-trace/src/opentracing/tracer.js +3 -3
  508. package/packages/dd-trace/src/payload-tagging/config/index.js +1 -1
  509. package/packages/dd-trace/src/payload-tagging/index.js +1 -1
  510. package/packages/dd-trace/src/payload-tagging/tagging.js +2 -2
  511. package/packages/dd-trace/src/plugin_manager.js +6 -6
  512. package/packages/dd-trace/src/plugins/apollo.js +4 -4
  513. package/packages/dd-trace/src/plugins/ci_plugin.js +101 -36
  514. package/packages/dd-trace/src/plugins/database.js +1 -1
  515. package/packages/dd-trace/src/plugins/index.js +1 -1
  516. package/packages/dd-trace/src/plugins/log_plugin.js +2 -2
  517. package/packages/dd-trace/src/plugins/outbound.js +9 -8
  518. package/packages/dd-trace/src/plugins/plugin.js +17 -7
  519. package/packages/dd-trace/src/plugins/producer.js +6 -5
  520. package/packages/dd-trace/src/plugins/tracing.js +37 -8
  521. package/packages/dd-trace/src/plugins/util/ci.js +40 -40
  522. package/packages/dd-trace/src/plugins/util/env.js +2 -2
  523. package/packages/dd-trace/src/plugins/util/git-cache.js +2 -2
  524. package/packages/dd-trace/src/plugins/util/git.js +20 -18
  525. package/packages/dd-trace/src/plugins/util/inferred_proxy.js +6 -6
  526. package/packages/dd-trace/src/plugins/util/ip_extractor.js +3 -3
  527. package/packages/dd-trace/src/plugins/util/llm.js +1 -1
  528. package/packages/dd-trace/src/plugins/util/stacktrace.js +3 -3
  529. package/packages/dd-trace/src/plugins/util/tags.js +1 -1
  530. package/packages/dd-trace/src/plugins/util/test.js +46 -40
  531. package/packages/dd-trace/src/plugins/util/url.js +1 -1
  532. package/packages/dd-trace/src/plugins/util/urlfilter.js +1 -1
  533. package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -2
  534. package/packages/dd-trace/src/plugins/util/web.js +12 -12
  535. package/packages/dd-trace/src/priority_sampler.js +4 -4
  536. package/packages/dd-trace/src/process-tags/index.js +2 -2
  537. package/packages/dd-trace/src/profiler.js +1 -1
  538. package/packages/dd-trace/src/profiling/config.js +11 -14
  539. package/packages/dd-trace/src/profiling/constants.js +2 -2
  540. package/packages/dd-trace/src/profiling/exporter_cli.js +3 -3
  541. package/packages/dd-trace/src/profiling/exporters/agent.js +5 -5
  542. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +8 -8
  543. package/packages/dd-trace/src/profiling/index.js +1 -1
  544. package/packages/dd-trace/src/profiling/libuv-size.js +1 -1
  545. package/packages/dd-trace/src/profiling/loggers/console.js +1 -1
  546. package/packages/dd-trace/src/profiling/profiler.js +21 -23
  547. package/packages/dd-trace/src/profiling/profilers/event_plugins/event.js +1 -1
  548. package/packages/dd-trace/src/profiling/profilers/event_plugins/fs.js +3 -3
  549. package/packages/dd-trace/src/profiling/profilers/events.js +27 -19
  550. package/packages/dd-trace/src/profiling/profilers/shared.js +2 -2
  551. package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
  552. package/packages/dd-trace/src/profiling/tagger.js +1 -1
  553. package/packages/dd-trace/src/profiling/webspan-utils.js +2 -2
  554. package/packages/dd-trace/src/proxy.js +13 -13
  555. package/packages/dd-trace/src/remote_config/apply_states.js +1 -1
  556. package/packages/dd-trace/src/remote_config/capabilities.js +1 -0
  557. package/packages/dd-trace/src/remote_config/index.js +17 -22
  558. package/packages/dd-trace/src/remote_config/scheduler.js +1 -1
  559. package/packages/dd-trace/src/ritm.js +1 -1
  560. package/packages/dd-trace/src/runtime_metrics/index.js +2 -2
  561. package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +3 -3
  562. package/packages/dd-trace/src/serverless.js +1 -1
  563. package/packages/dd-trace/src/service-naming/extra-services.js +1 -1
  564. package/packages/dd-trace/src/service-naming/index.js +1 -1
  565. package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +3 -3
  566. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +25 -25
  567. package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +3 -3
  568. package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +18 -18
  569. package/packages/dd-trace/src/service-naming/schemas/v0/web.js +23 -23
  570. package/packages/dd-trace/src/service-naming/schemas/v0/websocket.js +9 -9
  571. package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +3 -3
  572. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +21 -21
  573. package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +3 -3
  574. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +17 -17
  575. package/packages/dd-trace/src/service-naming/schemas/v1/web.js +23 -23
  576. package/packages/dd-trace/src/service-naming/schemas/v1/websocket.js +9 -9
  577. package/packages/dd-trace/src/span_format.js +4 -4
  578. package/packages/dd-trace/src/span_sampler.js +1 -1
  579. package/packages/dd-trace/src/span_stats.js +11 -11
  580. package/packages/dd-trace/src/spanleak.js +1 -1
  581. package/packages/dd-trace/src/standalone/index.js +1 -1
  582. package/packages/dd-trace/src/standalone/product.js +2 -2
  583. package/packages/dd-trace/src/standalone/tracesource.js +1 -1
  584. package/packages/dd-trace/src/startup-log.js +4 -4
  585. package/packages/dd-trace/src/tagger.js +3 -1
  586. package/packages/dd-trace/src/telemetry/dependencies.js +4 -4
  587. package/packages/dd-trace/src/telemetry/endpoints.js +4 -4
  588. package/packages/dd-trace/src/telemetry/index.js +1 -1
  589. package/packages/dd-trace/src/telemetry/logs/index.js +2 -2
  590. package/packages/dd-trace/src/telemetry/logs/log-collector.js +2 -2
  591. package/packages/dd-trace/src/telemetry/metrics.js +6 -6
  592. package/packages/dd-trace/src/telemetry/send-data.js +5 -5
  593. package/packages/dd-trace/src/telemetry/telemetry.js +10 -10
  594. package/packages/dd-trace/src/tracer.js +3 -2
  595. package/packages/dd-trace/src/util.js +1 -1
  596. package/scripts/preinstall.js +1 -1
  597. package/vendor/dist/@datadog/sketches-js/index.js +1 -1
  598. package/vendor/dist/@datadog/source-map/index.js +1 -1
  599. package/vendor/dist/@isaacs/ttlcache/index.js +1 -1
  600. package/vendor/dist/@opentelemetry/core/index.js +1 -1
  601. package/vendor/dist/@opentelemetry/resources/index.js +1 -1
  602. package/vendor/dist/astring/index.js +1 -1
  603. package/vendor/dist/crypto-randomuuid/index.js +1 -1
  604. package/vendor/dist/escape-string-regexp/index.js +1 -1
  605. package/vendor/dist/esquery/index.js +1 -1
  606. package/vendor/dist/ignore/index.js +1 -1
  607. package/vendor/dist/istanbul-lib-coverage/index.js +1 -1
  608. package/vendor/dist/jest-docblock/index.js +1 -1
  609. package/vendor/dist/jsonpath-plus/index.js +1 -1
  610. package/vendor/dist/limiter/index.js +1 -1
  611. package/vendor/dist/lodash.sortby/index.js +1 -1
  612. package/vendor/dist/lru-cache/index.js +1 -1
  613. package/vendor/dist/meriyah/index.js +1 -1
  614. package/vendor/dist/module-details-from-path/index.js +1 -1
  615. package/vendor/dist/mutexify/promise/index.js +1 -1
  616. package/vendor/dist/opentracing/index.js +1 -1
  617. package/vendor/dist/path-to-regexp/index.js +1 -1
  618. package/vendor/dist/pprof-format/index.js +1 -1
  619. package/vendor/dist/protobufjs/index.js +1 -1
  620. package/vendor/dist/protobufjs/minimal/index.js +1 -1
  621. package/vendor/dist/retry/index.js +1 -1
  622. package/vendor/dist/rfdc/index.js +1 -1
  623. package/vendor/dist/semifies/index.js +1 -1
  624. package/vendor/dist/shell-quote/index.js +1 -1
  625. package/vendor/dist/source-map/index.js +1 -1
  626. package/vendor/dist/source-map/lib/util/index.js +1 -1
  627. package/vendor/dist/tlhunter-sorted-set/index.js +1 -1
  628. package/vendor/dist/ttl-set/index.js +1 -1
  629. package/packages/datadog-plugin-prisma/src/client.js +0 -60
  630. package/packages/datadog-plugin-prisma/src/engine.js +0 -81
@@ -16,6 +16,8 @@ const log = require('./log')
16
16
 
17
17
  require('./remote_config')
18
18
 
19
+ /** @typedef {import('node:inspector').Debugger.EvaluateOnCallFrameReturnType} EvaluateOnCallFrameResult */
20
+
19
21
  // Expression to run on a call frame of the paused thread to get its active trace and span id.
20
22
  const templateExpressionSetupCode = `
21
23
  const $dd_inspect = global.require('node:util').inspect;
@@ -115,21 +117,23 @@ session.on('Debugger.paused', async ({ params }) => {
115
117
  }
116
118
 
117
119
  snapshotProbeIndex[numberOfProbesWithSnapshots++] = probes.length
118
- maxReferenceDepth = highestOrUndefined(probe.capture.maxReferenceDepth, maxReferenceDepth)
119
- maxCollectionSize = highestOrUndefined(probe.capture.maxCollectionSize, maxCollectionSize)
120
- maxFieldCount = highestOrUndefined(probe.capture.maxFieldCount, maxFieldCount)
121
- maxLength = highestOrUndefined(probe.capture.maxLength, maxLength)
120
+ maxReferenceDepth = highestOrUndefined(probe.capture?.maxReferenceDepth, maxReferenceDepth)
121
+ maxCollectionSize = highestOrUndefined(probe.capture?.maxCollectionSize, maxCollectionSize)
122
+ maxFieldCount = highestOrUndefined(probe.capture?.maxFieldCount, maxFieldCount)
123
+ maxLength = highestOrUndefined(probe.capture?.maxLength, maxLength)
122
124
  }
123
125
 
124
126
  if (probe.condition !== undefined) {
125
127
  // TODO: Bundle all conditions and evaluate them in a single call
126
128
  // TODO: Handle errors
127
- // eslint-disable-next-line no-await-in-loop
128
- const { result } = await session.post('Debugger.evaluateOnCallFrame', {
129
- callFrameId: params.callFrames[0].callFrameId,
130
- expression: probe.condition,
131
- returnByValue: true
132
- })
129
+ const { result } = /** @type {EvaluateOnCallFrameResult} */ (
130
+ // eslint-disable-next-line no-await-in-loop
131
+ await session.post('Debugger.evaluateOnCallFrame', {
132
+ callFrameId: params.callFrames[0].callFrameId,
133
+ expression: probe.condition,
134
+ returnByValue: true,
135
+ })
136
+ )
133
137
  if (result.value !== true) continue
134
138
  }
135
139
 
@@ -151,14 +155,16 @@ session.on('Debugger.paused', async ({ params }) => {
151
155
  const timestamp = Date.now()
152
156
 
153
157
  let evalResults
154
- const { result } = await session.post('Debugger.evaluateOnCallFrame', {
155
- callFrameId: params.callFrames[0].callFrameId,
156
- expression: templateExpressions.length === 0
157
- ? `[${getDDTagsExpression}]`
158
- : `${templateExpressionSetupCode}[${getDDTagsExpression}${templateExpressions}]`,
159
- returnByValue: true,
160
- includeCommandLineAPI: true
161
- })
158
+ const { result } = /** @type {EvaluateOnCallFrameResult} */ (
159
+ await session.post('Debugger.evaluateOnCallFrame', {
160
+ callFrameId: params.callFrames[0].callFrameId,
161
+ expression: templateExpressions.length === 0
162
+ ? `[${getDDTagsExpression}]`
163
+ : `${templateExpressionSetupCode}[${getDDTagsExpression}${templateExpressions}]`,
164
+ returnByValue: true,
165
+ includeCommandLineAPI: true,
166
+ })
167
+ )
162
168
  if (result?.subtype === 'error') {
163
169
  log.error('[debugger:devtools_client] Error evaluating code on call frame: %s', result?.description)
164
170
  evalResults = []
@@ -174,7 +180,7 @@ session.on('Debugger.paused', async ({ params }) => {
174
180
  maxCollectionSize,
175
181
  maxFieldCount,
176
182
  maxLength,
177
- deadlineNs: start + config.dynamicInstrumentation.captureTimeoutNs
183
+ deadlineNs: start + config.dynamicInstrumentation.captureTimeoutNs,
178
184
  }
179
185
  ;({ processLocalState, captureErrors } = await getLocalStateForCallFrame(params.callFrames[0], opts))
180
186
  }
@@ -184,6 +190,7 @@ session.on('Debugger.paused', async ({ params }) => {
184
190
 
185
191
  // This doesn't measure the overhead of the CDP protocol. The actual pause time is slightly larger.
186
192
  // On my machine I'm seeing around 1.7ms of overhead.
193
+ // eslint-disable-next-line eslint-rules/eslint-log-printf-style
187
194
  log.debug(() => `[debugger:devtools_client] Finished processing breakpoints - main thread paused for: ~${
188
195
  Number(diff) / 1_000_000
189
196
  } ms`)
@@ -195,10 +202,10 @@ session.on('Debugger.paused', async ({ params }) => {
195
202
  method: params.callFrames[0].functionName, // name of the method/function emitting the snapshot
196
203
  version,
197
204
  thread_id: threadId,
198
- thread_name: threadName
205
+ thread_name: threadName,
199
206
  }
200
207
 
201
- const stack = getStackFromCallFrames(params.callFrames)
208
+ const stack = await getStackFromCallFrames(params.callFrames)
202
209
  const dd = processDD(evalResults[0]) // the first result is the dd tags, the rest are the probe template results
203
210
  let messageIndex = 1
204
211
 
@@ -210,10 +217,10 @@ session.on('Debugger.paused', async ({ params }) => {
210
217
  probe: {
211
218
  id: probe.id,
212
219
  version: probe.version,
213
- location: probe.location
220
+ location: probe.location,
214
221
  },
215
222
  stack,
216
- language: 'javascript'
223
+ language: 'javascript',
217
224
  }
218
225
 
219
226
  if (config.propagateProcessTags.enabled) {
@@ -226,11 +233,11 @@ session.on('Debugger.paused', async ({ params }) => {
226
233
  probe.captureSnapshot = false
227
234
  probe.permanentEvaluationErrors = captureErrors.map(error => ({
228
235
  expr: '',
229
- message: error.message
236
+ message: error.message,
230
237
  }))
231
238
  }
232
239
  snapshot.captures = {
233
- lines: { [probe.location.lines[0]]: { locals: processLocalState() } }
240
+ lines: { [probe.location.lines[0]]: { locals: processLocalState() } },
234
241
  }
235
242
  }
236
243
 
@@ -22,6 +22,6 @@ if (builtinModules.includes('inspector/promises')) {
22
22
 
23
23
  module.exports = {
24
24
  ...inspector,
25
- Session
25
+ Session,
26
26
  }
27
27
  }
@@ -11,26 +11,25 @@ class JSONBuffer {
11
11
  this.#maxSize = size
12
12
  this.#timeout = timeout
13
13
  this.#onFlush = onFlush
14
- this.#reset()
15
- }
16
-
17
- #reset () {
18
- clearTimeout(this.#timer)
19
- this.#timer = undefined
20
- this.#partialJson = undefined
21
14
  }
22
15
 
23
16
  #flush () {
24
17
  const json = `${this.#partialJson}]`
25
- this.#reset()
18
+ this.#partialJson = undefined
26
19
  this.#onFlush(json)
27
20
  }
28
21
 
29
22
  write (str, size = Buffer.byteLength(str)) {
30
- if (this.#timer === undefined) {
23
+ if (this.#partialJson === undefined) {
31
24
  this.#partialJson = `[${str}`
32
- this.#timer = setTimeout(() => this.#flush(), this.#timeout)
33
- } else if (Buffer.byteLength(/** @type {string} */ (this.#partialJson)) + size + 2 > this.#maxSize) {
25
+ if (this.#timer === undefined) {
26
+ this.#timer = setTimeout(() => this.#flush(), this.#timeout)
27
+ } else {
28
+ this.#timer.refresh()
29
+ }
30
+ } else if (Buffer.byteLength(this.#partialJson) + size + 2 > this.#maxSize) {
31
+ clearTimeout(this.#timer)
32
+ this.#timer = undefined
34
33
  this.#flush()
35
34
  this.write(str, size)
36
35
  } else {
@@ -25,6 +25,6 @@ const threshold = LEVELS.indexOf(logLevel)
25
25
  module.exports = Object.fromEntries(
26
26
  LEVELS.map(level => [
27
27
  level,
28
- debug && threshold >= LEVELS.indexOf(level) ? on.bind(null, level) : off
28
+ debug && threshold >= LEVELS.indexOf(level) ? on.bind(null, level) : off,
29
29
  ])
30
30
  )
@@ -3,10 +3,11 @@
3
3
  const { hostname: getHostname } = require('os')
4
4
  const { stringify } = require('querystring')
5
5
 
6
+ const { version } = require('../../../../../package.json')
6
7
  const request = require('../../exporters/common/request')
7
8
  const { GIT_COMMIT_SHA, GIT_REPOSITORY_URL } = require('../../plugins/util/tags')
8
- const { version } = require('../../../../../package.json')
9
9
  const { getValueFromEnvSources } = require('../../config/helper')
10
+ const { DEBUGGER_DIAGNOSTICS_V1, DEBUGGER_INPUT_V2 } = require('../constants')
10
11
  const log = require('./log')
11
12
  const JSONBuffer = require('./json-buffer')
12
13
  const config = require('./config')
@@ -28,15 +29,16 @@ const ddtags = [
28
29
  ['debugger_version', version],
29
30
  ['host_name', hostname],
30
31
  [GIT_COMMIT_SHA, config.commitSHA],
31
- [GIT_REPOSITORY_URL, config.repositoryUrl]
32
+ [GIT_REPOSITORY_URL, config.repositoryUrl],
32
33
  ].filter(([, value]) => value !== undefined).map((pair) => pair.join(':')).join(',')
33
34
 
34
- const path = `/debugger/v1/input?${stringify({ ddtags })}`
35
+ let path
36
+ setInputPath(config.inputPath)
35
37
 
36
38
  const jsonBuffer = new JSONBuffer({
37
39
  size: config.maxTotalPayloadSize,
38
40
  timeout: config.dynamicInstrumentation.uploadIntervalSeconds * 1000,
39
- onFlush
41
+ onFlush,
40
42
  })
41
43
 
42
44
  function send (message, logger, dd, snapshot) {
@@ -49,7 +51,7 @@ function send (message, logger, dd, snapshot) {
49
51
  : message,
50
52
  logger,
51
53
  dd,
52
- debugger: { snapshot }
54
+ debugger: { snapshot },
53
55
  }
54
56
 
55
57
  let json = JSON.stringify(payload)
@@ -78,17 +80,59 @@ function send (message, logger, dd, snapshot) {
78
80
  jsonBuffer.write(json, size)
79
81
  }
80
82
 
83
+ /**
84
+ * @param {string} payload - The payload to send
85
+ */
81
86
  function onFlush (payload) {
82
87
  log.debug('[debugger:devtools_client] Flushing probe payload buffer')
83
88
 
84
- const opts = {
89
+ request(payload, buildRequestOpts(), (err, res, statusCode) => {
90
+ if (!handleV2FallbackIfNeeded(statusCode, payload) && err) {
91
+ log.error('[debugger:devtools_client] Error sending probe payload', err)
92
+ }
93
+ })
94
+ }
95
+
96
+ /**
97
+ * @param {number} statusCode - The status code of the response
98
+ * @param {string} payload - The payload to send
99
+ * @returns {boolean} True if the fallback was needed, false otherwise
100
+ */
101
+ function handleV2FallbackIfNeeded (statusCode, payload) {
102
+ if (statusCode !== 404 || config.inputPath !== DEBUGGER_INPUT_V2) {
103
+ return false
104
+ }
105
+
106
+ log.warn('[debugger:devtools_client] Received 404 from %s, falling back to %s',
107
+ DEBUGGER_INPUT_V2,
108
+ DEBUGGER_DIAGNOSTICS_V1)
109
+
110
+ setInputPath(DEBUGGER_DIAGNOSTICS_V1)
111
+
112
+ request(payload, buildRequestOpts(), (err) => {
113
+ if (err) {
114
+ log.error('[debugger:devtools_client] Error sending probe payload after fallback to %s',
115
+ DEBUGGER_DIAGNOSTICS_V1,
116
+ err)
117
+ }
118
+ })
119
+
120
+ return true
121
+ }
122
+
123
+ function buildRequestOpts () {
124
+ return {
85
125
  method: 'POST',
86
126
  url: config.url,
87
127
  path,
88
- headers: { 'Content-Type': 'application/json; charset=utf-8' }
128
+ headers: { 'Content-Type': 'application/json; charset=utf-8' },
89
129
  }
130
+ }
90
131
 
91
- request(payload, opts, (err) => {
92
- if (err) log.error('[debugger:devtools_client] Error sending probe payload', err)
93
- })
132
+ /**
133
+ * @param {string} newPath - The new debugger input path
134
+ */
135
+ function setInputPath (newPath) {
136
+ config.inputPath = newPath
137
+ path = `${newPath}?${stringify({ ddtags })}`
94
138
  }
@@ -9,9 +9,51 @@ const ITERABLE_SUBTYPES = new Set(['map', 'set', 'weakmap', 'weakset'])
9
9
  const SIZE_IN_DESCRIPTION_SUBTYPES = new Set(['array', 'typedarray', 'arraybuffer', 'dataview', 'map', 'set'])
10
10
 
11
11
  module.exports = {
12
- collectObjectProperties
12
+ collectObjectProperties,
13
13
  }
14
14
 
15
+ /** @typedef {import('node:inspector').Runtime.PropertyDescriptor} PropertyDescriptor */
16
+ /** @typedef {import('node:inspector').Runtime.InternalPropertyDescriptor} InternalPropertyDescriptor */
17
+
18
+ // TODO: Once @types/node include privateProperties, we should clean this typedef up:
19
+ /**
20
+ * Extended version of Runtime.GetPropertiesReturnType that includes privateProperties
21
+ * which is not in the base type but is returned by the CDP API.
22
+ *
23
+ * @typedef {import('node:inspector').Runtime.GetPropertiesReturnType & {
24
+ * privateProperties?: PropertyDescriptor[]
25
+ * }} GetPropertiesResult
26
+ */
27
+
28
+ /**
29
+ * Extended version of GetPropertiesResult where internalProperties is guaranteed to exist.
30
+ * Use this typedef when calling Runtime.getProperties on objects that always have internal properties
31
+ * (e.g., iterables, proxies, ArrayBuffers).
32
+ *
33
+ * @typedef {GetPropertiesResult & {
34
+ * internalProperties: InternalPropertyDescriptor[]
35
+ * }} GetPropertiesResultWithInternals
36
+ */
37
+
38
+ /**
39
+ * Extended version of InternalPropertyDescriptor where value is guaranteed to exist.
40
+ * Use this typedef for internal properties that always have values (e.g., [[Entries]] for iterables).
41
+ *
42
+ * @typedef {InternalPropertyDescriptor & {
43
+ * value: NonNullable<InternalPropertyDescriptor['value']>
44
+ * }} InternalPropertyDescriptorWithValue
45
+ */
46
+
47
+ /**
48
+ * Extended version of GetPropertiesResult where internalProperties exist and all properties have values.
49
+ * Use this typedef when all internal properties are guaranteed to have values in practice.
50
+ * Examples: [[Entries]] for iterables, [[Target]] for Proxies, [[Uint8Array]] for ArrayBuffers.
51
+ *
52
+ * @typedef {GetPropertiesResult & {
53
+ * internalProperties: InternalPropertyDescriptorWithValue[]
54
+ * }} GetPropertiesResultWithInternalValues
55
+ */
56
+
15
57
  /**
16
58
  * @typedef {object} GetObjectOptions
17
59
  * @property {object} maxReferenceDepth - The maximum depth of the object to traverse
@@ -37,10 +79,12 @@ module.exports = {
37
79
  * @returns {Promise<object[]>} The properties of the object
38
80
  */
39
81
  async function collectObjectProperties (objectId, opts, depth = 0, collection = false) {
40
- const { result, privateProperties } = await session.post('Runtime.getProperties', {
41
- objectId,
42
- ownProperties: true // exclude inherited properties
43
- })
82
+ const { result, privateProperties } = /** @type {GetPropertiesResult} */ (
83
+ await session.post('Runtime.getProperties', {
84
+ objectId,
85
+ ownProperties: true, // exclude inherited properties
86
+ })
87
+ )
44
88
 
45
89
  if (collection) {
46
90
  // Trim the collection if it's too large.
@@ -95,14 +139,14 @@ async function traverseGetPropertiesResult (props, opts, depth) {
95
139
  prop.value,
96
140
  () => collectPropertiesBySubtype(subtype, objectId, opts, depth).then((properties) => {
97
141
  prop.value.properties = properties
98
- })
142
+ }),
99
143
  ])
100
144
  } else if (type === 'function') {
101
145
  work.push([
102
146
  prop.value,
103
147
  () => getFunctionProperties(objectId, opts, depth + 1).then((properties) => {
104
148
  prop.value.properties = properties
105
- })
149
+ }),
106
150
  ])
107
151
  }
108
152
  }
@@ -122,7 +166,7 @@ async function traverseGetPropertiesResult (props, opts, depth) {
122
166
  // eslint-disable-next-line no-await-in-loop
123
167
  await Promise.all([
124
168
  work[i][1](),
125
- work[i + 1]?.[1]()
169
+ work[i + 1]?.[1](),
126
170
  ])
127
171
  }
128
172
  }
@@ -147,10 +191,10 @@ function collectPropertiesBySubtype (subtype, objectId, opts, depth) {
147
191
  // - Bound function: `[[TargetFunction]]`, `[[BoundThis]]` and `[[BoundArgs]]`
148
192
  // - Non-bound function: `[[FunctionLocation]]`, and `[[Scopes]]`
149
193
  async function getFunctionProperties (objectId, opts, depth) {
150
- let { result } = await session.post('Runtime.getProperties', {
194
+ let { result } = /** @type {GetPropertiesResult} */ (await session.post('Runtime.getProperties', {
151
195
  objectId,
152
- ownProperties: true // exclude inherited properties
153
- })
196
+ ownProperties: true, // exclude inherited properties
197
+ }))
154
198
 
155
199
  // For legacy reasons (I assume) functions has a `prototype` property besides the internal `[[Prototype]]`
156
200
  result = result.filter(({ name }) => name !== 'prototype')
@@ -161,22 +205,25 @@ async function getFunctionProperties (objectId, opts, depth) {
161
205
  async function getIterable (objectId, opts, depth) {
162
206
  // TODO: If the iterable has any properties defined on the object directly, instead of in its collection, they will
163
207
  // exist in the return value below in the `result` property. We currently do not collect these.
164
- const { internalProperties } = await session.post('Runtime.getProperties', {
165
- objectId,
166
- ownProperties: true // exclude inherited properties
167
- })
208
+ const { internalProperties } = /** @type {GetPropertiesResultWithInternalValues} */ (
209
+ await session.post('Runtime.getProperties', {
210
+ objectId,
211
+ ownProperties: true, // exclude inherited properties
212
+ })
213
+ )
168
214
 
169
215
  let entry = internalProperties[1]
170
216
  if (entry.name !== '[[Entries]]') {
171
217
  // Currently `[[Entries]]` is the last of 2 elements, but in case this ever changes, fall back to searching
218
+ // @ts-expect-error - findLast is available in Node.js 18+ but TypeScript doesn't know about it without ES2023 lib
172
219
  entry = internalProperties.findLast(({ name }) => name === '[[Entries]]')
173
220
  }
174
221
 
175
222
  // Skip the `[[Entries]]` level and go directly to the content of the iterable
176
- const { result } = await session.post('Runtime.getProperties', {
223
+ const { result } = /** @type {GetPropertiesResult} */ (await session.post('Runtime.getProperties', {
177
224
  objectId: entry.value.objectId,
178
- ownProperties: true // exclude inherited properties
179
- })
225
+ ownProperties: true, // exclude inherited properties
226
+ }))
180
227
 
181
228
  removeNonEnumerableProperties(result) // remove the `length` property
182
229
  const size = result.length
@@ -189,10 +236,12 @@ async function getIterable (objectId, opts, depth) {
189
236
  }
190
237
 
191
238
  async function getInternalProperties (objectId, opts, depth) {
192
- const { internalProperties } = await session.post('Runtime.getProperties', {
193
- objectId,
194
- ownProperties: true // exclude inherited properties
195
- })
239
+ const { internalProperties } = /** @type {GetPropertiesResultWithInternals} */ (
240
+ await session.post('Runtime.getProperties', {
241
+ objectId,
242
+ ownProperties: true, // exclude inherited properties
243
+ })
244
+ )
196
245
 
197
246
  // We want all internal properties except the prototype
198
247
  const props = internalProperties.filter(({ name }) => name !== '[[Prototype]]')
@@ -201,23 +250,26 @@ async function getInternalProperties (objectId, opts, depth) {
201
250
  }
202
251
 
203
252
  async function getProxy (objectId, opts, depth) {
204
- const { internalProperties } = await session.post('Runtime.getProperties', {
205
- objectId,
206
- ownProperties: true // exclude inherited properties
207
- })
253
+ const { internalProperties } = /** @type {GetPropertiesResultWithInternalValues} */ (
254
+ await session.post('Runtime.getProperties', {
255
+ objectId,
256
+ ownProperties: true, // exclude inherited properties
257
+ })
258
+ )
208
259
 
209
260
  // TODO: If we do not skip the proxy wrapper, we can add a `revoked` boolean
210
261
  let entry = internalProperties[1]
211
262
  if (entry.name !== '[[Target]]') {
212
263
  // Currently `[[Target]]` is the last of 2 elements, but in case this ever changes, fall back to searching
264
+ // @ts-expect-error - findLast is available in Node.js 18+ but TypeScript doesn't know about it without ES2023 lib
213
265
  entry = internalProperties.findLast(({ name }) => name === '[[Target]]')
214
266
  }
215
267
 
216
268
  // Skip the `[[Target]]` level and go directly to the target of the Proxy
217
- const { result } = await session.post('Runtime.getProperties', {
269
+ const { result } = /** @type {GetPropertiesResult} */ (await session.post('Runtime.getProperties', {
218
270
  objectId: entry.value.objectId,
219
- ownProperties: true // exclude inherited properties
220
- })
271
+ ownProperties: true, // exclude inherited properties
272
+ }))
221
273
 
222
274
  return traverseGetPropertiesResult(result, opts, depth)
223
275
  }
@@ -227,19 +279,24 @@ async function getProxy (objectId, opts, depth) {
227
279
  // UInt8Array(3), whereas ArrayBuffer(8) internally contains both Int8Array(8), Uint8Array(8), Int16Array(4), and
228
280
  // Int32Array(2) - all representing the same data in different ways.
229
281
  async function getArrayBuffer (objectId, opts, depth) {
230
- const { internalProperties } = await session.post('Runtime.getProperties', {
231
- objectId,
232
- ownProperties: true // exclude inherited properties
233
- })
282
+ const { internalProperties } = /** @type {GetPropertiesResultWithInternalValues} */ (
283
+ await session.post('Runtime.getProperties', {
284
+ objectId,
285
+ ownProperties: true, // exclude inherited properties
286
+ })
287
+ )
234
288
 
235
289
  // Use Uint8 to make it easy to convert to a string later.
236
- const entry = internalProperties.find(({ name }) => name === '[[Uint8Array]]')
290
+ // [[Uint8Array]] always exists for ArrayBuffers
291
+ const entry = /** @type {InternalPropertyDescriptorWithValue} */ (
292
+ internalProperties.find(({ name }) => name === '[[Uint8Array]]')
293
+ )
237
294
 
238
295
  // Skip the `[[Uint8Array]]` level and go directly to the content of the ArrayBuffer
239
- const { result } = await session.post('Runtime.getProperties', {
296
+ const { result } = /** @type {GetPropertiesResult} */ (await session.post('Runtime.getProperties', {
240
297
  objectId: entry.value.objectId,
241
- ownProperties: true // exclude inherited properties
242
- })
298
+ ownProperties: true, // exclude inherited properties
299
+ }))
243
300
 
244
301
  return traverseGetPropertiesResult(result, opts, depth)
245
302
  }
@@ -4,7 +4,7 @@ const {
4
4
  DEFAULT_MAX_REFERENCE_DEPTH,
5
5
  DEFAULT_MAX_COLLECTION_SIZE,
6
6
  DEFAULT_MAX_FIELD_COUNT,
7
- DEFAULT_MAX_LENGTH
7
+ DEFAULT_MAX_LENGTH,
8
8
  } = require('./constants')
9
9
  const { collectObjectProperties } = require('./collector')
10
10
  const { processRawState } = require('./processor')
@@ -12,7 +12,7 @@ const { processRawState } = require('./processor')
12
12
  const BIGINT_MAX = (1n << 256n) - 1n
13
13
 
14
14
  module.exports = {
15
- getLocalStateForCallFrame
15
+ getLocalStateForCallFrame,
16
16
  }
17
17
 
18
18
  /**
@@ -43,7 +43,7 @@ async function getLocalStateForCallFrame (
43
43
  maxCollectionSize = DEFAULT_MAX_COLLECTION_SIZE,
44
44
  maxFieldCount = DEFAULT_MAX_FIELD_COUNT,
45
45
  maxLength = DEFAULT_MAX_LENGTH,
46
- deadlineNs = BIGINT_MAX
46
+ deadlineNs = BIGINT_MAX,
47
47
  } = {}
48
48
  ) {
49
49
  /** @type {{ deadlineReached: boolean, captureErrors: Error[] }} */
@@ -78,6 +78,6 @@ async function getLocalStateForCallFrame (
78
78
  processedState = processedState ?? processRawState(rawState, maxLength)
79
79
  return processedState
80
80
  },
81
- captureErrors: ctx.captureErrors
81
+ captureErrors: ctx.captureErrors,
82
82
  }
83
83
  }
@@ -5,7 +5,7 @@ const { collectionSizeSym, largeCollectionSkipThresholdSym, fieldCountSym, timeB
5
5
  const { normalizeName, REDACTED_IDENTIFIERS } = require('./redaction')
6
6
 
7
7
  module.exports = {
8
- processRawState: processProperties
8
+ processRawState: processProperties,
9
9
  }
10
10
 
11
11
  // Matches classes in source code, no matter how it's written:
@@ -150,7 +150,7 @@ function toString (str, maxLength) {
150
150
  type: 'string',
151
151
  value: str.slice(0, maxLength),
152
152
  truncated: true,
153
- size
153
+ size,
154
154
  }
155
155
  }
156
156
 
@@ -160,7 +160,7 @@ function toObject (type, props, maxLength, timeBudgetReached) {
160
160
 
161
161
  const result = {
162
162
  type,
163
- fields: processProperties(props, maxLength)
163
+ fields: processProperties(props, maxLength),
164
164
  }
165
165
 
166
166
  if (props[fieldCountSym] !== undefined) {
@@ -179,7 +179,7 @@ function toArray (type, elements, maxLength, timeBudgetReached) {
179
179
  type,
180
180
  elements: elements.map((element) => {
181
181
  return getPropertyValue(element, maxLength)
182
- })
182
+ }),
183
183
  }
184
184
 
185
185
  setNotCaptureReasonOnCollection(result, elements)
@@ -218,7 +218,7 @@ function toMap (type, pairs, maxLength, timeBudgetReached) {
218
218
  ? notCapturedRedacted(value.properties[1].value.type)
219
219
  : getPropertyValue(value.properties[1], maxLength)
220
220
  return [key, val]
221
- })
221
+ }),
222
222
  }
223
223
 
224
224
  setNotCaptureReasonOnCollection(result, pairs)
@@ -250,7 +250,7 @@ function toSet (type, values, maxLength, timeBudgetReached) {
250
250
  if (value.properties === undefined) return { notCapturedReason: 'unknown' }
251
251
 
252
252
  return getPropertyValue(value.properties[0], maxLength)
253
- })
253
+ }),
254
254
  }
255
255
 
256
256
  setNotCaptureReasonOnCollection(result, values)
@@ -270,7 +270,7 @@ function toArrayBuffer (type, bytes, maxLength, timeBudgetReached) {
270
270
  type,
271
271
  value: arrayBufferToString(bytes, maxLength),
272
272
  truncated: true,
273
- size: bytes.length
273
+ size: bytes.length,
274
274
  }
275
275
  : { type, value: arrayBufferToString(bytes, size) }
276
276
  }
@@ -95,7 +95,7 @@ const REDACTED_IDENTIFIERS = new Set(
95
95
  'x_forwarded_for',
96
96
  'x_real_ip',
97
97
  'XSRF-TOKEN',
98
- ...config.dynamicInstrumentation.redactedIdentifiers
98
+ ...config.dynamicInstrumentation.redactedIdentifiers,
99
99
  ]
100
100
  .map((name) => normalizeName(name))
101
101
  .filter((name) => excludedIdentifiers.has(name) === false)
@@ -108,5 +108,5 @@ function normalizeName (name, isSymbol) {
108
108
 
109
109
  module.exports = {
110
110
  REDACTED_IDENTIFIERS,
111
- normalizeName
111
+ normalizeName,
112
112
  }
@@ -4,5 +4,5 @@ module.exports = {
4
4
  collectionSizeSym: Symbol('datadog.collectionSize'),
5
5
  largeCollectionSkipThresholdSym: Symbol('datadog.largeCollectionSkipThresholdSym'),
6
6
  fieldCountSym: Symbol('datadog.fieldCount'),
7
- timeBudgetSym: Symbol('datadog.timeout')
7
+ timeBudgetSym: Symbol('datadog.timeout'),
8
8
  }
@@ -74,7 +74,7 @@ class TreeNode {
74
74
  this.notCapturedDepth ? 1 : 0,
75
75
  this.level,
76
76
  this.notCaptured ? 1 : 0,
77
- this.size
77
+ this.size,
78
78
  ]
79
79
  }
80
80
  return this.#priorityKeyCache
@@ -31,7 +31,16 @@ const self = module.exports = {
31
31
  null,
32
32
  (consumer) => consumer.generatedPositionFor({ source, line, column: 0 })
33
33
  )
34
- }
34
+ },
35
+
36
+ async getOriginalPosition (url, line, column, sourceMapURL) {
37
+ const dir = dirname(new URL(url).pathname)
38
+ return SourceMapConsumer.with(
39
+ await self.loadSourceMap(dir, sourceMapURL),
40
+ null,
41
+ (consumer) => consumer.originalPositionFor({ line, column })
42
+ )
43
+ },
35
44
  }
36
45
 
37
46
  function cacheIt (key, value) {