dd-trace 5.134.0 → 5.136.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 (353) hide show
  1. package/LICENSE-3rdparty.csv +0 -1
  2. package/ci/cypress/support.js +15 -1
  3. package/ci/init.js +2 -22
  4. package/ci/test-annotations.d.ts +5 -0
  5. package/ci/test-annotations.js +5 -0
  6. package/ci/vitest-no-worker-init-annotations.mjs +4 -0
  7. package/ci/vitest-no-worker-init-node-setup.mjs +22 -0
  8. package/ci/vitest-no-worker-init-runner-setup.mjs +7 -32
  9. package/ci/vitest-no-worker-init-setup.mjs +34 -12
  10. package/ci/vitest-no-worker-init-v5-setup.mjs +6 -0
  11. package/ext/exporters.js +1 -1
  12. package/index.d.ts +124 -5
  13. package/initialize.mjs +5 -2
  14. package/lambda.d.ts +39 -0
  15. package/lambda.js +3 -0
  16. package/loader-hook.mjs +53 -0
  17. package/openfeature/exposure-hook.d.ts +66 -0
  18. package/openfeature/exposure-hook.js +5 -0
  19. package/package.json +19 -15
  20. package/packages/datadog-core/src/storage.js +1 -1
  21. package/packages/datadog-esbuild/index.js +78 -62
  22. package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
  23. package/packages/datadog-instrumentations/src/cucumber.js +56 -19
  24. package/packages/datadog-instrumentations/src/cypress-config.js +163 -15
  25. package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
  26. package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
  27. package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
  28. package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
  29. package/packages/datadog-instrumentations/src/graphql.js +29 -20
  30. package/packages/datadog-instrumentations/src/grpc/server.js +23 -6
  31. package/packages/{datadog-esbuild/src/utils.js → datadog-instrumentations/src/helpers/bundler-esm-exports.js} +282 -40
  32. package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +573 -0
  33. package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
  34. package/packages/datadog-instrumentations/src/helpers/fetch.js +5 -1
  35. package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +30 -8
  36. package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
  37. package/packages/datadog-instrumentations/src/helpers/hooks.js +4 -8
  38. package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
  39. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +18 -6
  40. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +26 -1
  41. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
  42. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
  43. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql-jit.js +3 -1
  44. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
  45. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +40 -0
  46. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
  47. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/react-router.js +49 -0
  48. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
  49. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/typesafe.js +23 -0
  50. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +12 -0
  51. package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +58 -0
  52. package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +19 -2
  53. package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +25 -3
  54. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
  55. package/packages/datadog-instrumentations/src/ioredis.js +101 -3
  56. package/packages/datadog-instrumentations/src/jest.js +265 -82
  57. package/packages/datadog-instrumentations/src/mariadb-bundle.js +69 -11
  58. package/packages/datadog-instrumentations/src/mariadb.js +13 -6
  59. package/packages/datadog-instrumentations/src/mocha/common.js +89 -8
  60. package/packages/datadog-instrumentations/src/mocha/main.js +11 -2
  61. package/packages/datadog-instrumentations/src/mocha/utils.js +58 -12
  62. package/packages/datadog-instrumentations/src/mocha/worker.js +1 -1
  63. package/packages/datadog-instrumentations/src/next.js +19 -6
  64. package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
  65. package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
  66. package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
  67. package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
  68. package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
  69. package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
  70. package/packages/datadog-instrumentations/src/oracledb.js +33 -0
  71. package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
  72. package/packages/datadog-instrumentations/src/pg.js +2 -1
  73. package/packages/datadog-instrumentations/src/playwright.js +81 -28
  74. package/packages/datadog-instrumentations/src/react-router.js +106 -0
  75. package/packages/datadog-instrumentations/src/typesafe.js +89 -0
  76. package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +84 -48
  77. package/packages/datadog-instrumentations/src/vitest-main.js +26 -0
  78. package/packages/datadog-instrumentations/src/vitest-test-annotations.js +20 -0
  79. package/packages/datadog-instrumentations/src/vitest-worker.js +39 -17
  80. package/packages/datadog-instrumentations/src/vitest.js +10 -8
  81. package/packages/datadog-instrumentations/src/webdriverio.js +12 -12
  82. package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
  83. package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
  84. package/packages/datadog-plugin-cucumber/src/index.js +5 -0
  85. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +296 -55
  86. package/packages/datadog-plugin-cypress/src/index.js +1 -1
  87. package/packages/datadog-plugin-cypress/src/lifecycle-owner.js +20 -0
  88. package/packages/datadog-plugin-cypress/src/plugin.js +10 -0
  89. package/packages/datadog-plugin-cypress/src/retry-config-observer.js +281 -0
  90. package/packages/datadog-plugin-cypress/src/setup-handoff.js +125 -0
  91. package/packages/datadog-plugin-cypress/src/support.js +1217 -439
  92. package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
  93. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -7
  94. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +19 -52
  95. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +4 -2
  96. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
  97. package/packages/datadog-plugin-graphql/src/execute.js +2 -2
  98. package/packages/datadog-plugin-graphql/src/utils.js +5 -5
  99. package/packages/datadog-plugin-http/src/client.js +32 -9
  100. package/packages/datadog-plugin-http2/src/client.js +38 -13
  101. package/packages/datadog-plugin-jest/src/index.js +25 -3
  102. package/packages/datadog-plugin-mocha/src/index.js +47 -6
  103. package/packages/datadog-plugin-next/src/index.js +112 -14
  104. package/packages/datadog-plugin-oracledb/src/connection-parser.js +21 -11
  105. package/packages/datadog-plugin-playwright/src/index.js +4 -0
  106. package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
  107. package/packages/datadog-plugin-react-router/src/index.js +118 -0
  108. package/packages/datadog-plugin-trpc/src/index.js +15 -0
  109. package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
  110. package/packages/datadog-plugin-trpc/src/request.js +81 -0
  111. package/packages/datadog-plugin-typesafe/src/index.js +17 -0
  112. package/packages/datadog-plugin-typesafe/src/tracing.js +31 -0
  113. package/packages/datadog-plugin-undici/src/index.js +22 -7
  114. package/packages/datadog-plugin-vitest/src/index.js +8 -0
  115. package/packages/datadog-turbopack/index.js +4 -28
  116. package/packages/datadog-turbopack/src/loader.js +14 -452
  117. package/packages/datadog-webpack/index.js +3 -55
  118. package/packages/dd-trace/src/agent/info.js +2 -1
  119. package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
  120. package/packages/dd-trace/src/aiguard/sdk.js +8 -13
  121. package/packages/dd-trace/src/aiguard/tags.js +2 -0
  122. package/packages/dd-trace/src/appsec/blocking/index.js +4 -0
  123. package/packages/dd-trace/src/appsec/graphql.js +91 -6
  124. package/packages/dd-trace/src/appsec/recommended.json +1287 -90
  125. package/packages/dd-trace/src/before-exit.js +32 -0
  126. package/packages/dd-trace/src/bootstrap.js +5 -3
  127. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +24 -18
  128. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +16 -36
  129. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
  130. package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
  131. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +10 -18
  132. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +10 -15
  133. package/packages/dd-trace/src/ci-visibility/requests/route.js +44 -0
  134. package/packages/dd-trace/src/ci-visibility/telemetry-logs.js +5 -0
  135. package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
  136. package/packages/dd-trace/src/ci-visibility/test-annotations.js +72 -0
  137. package/packages/dd-trace/src/ci-visibility/test-declaration-annotations.js +170 -0
  138. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +10 -17
  139. package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
  140. package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
  141. package/packages/dd-trace/src/config/config-types.d.ts +3 -0
  142. package/packages/dd-trace/src/config/defaults.js +9 -3
  143. package/packages/dd-trace/src/config/generated-config-types.d.ts +46 -2
  144. package/packages/dd-trace/src/config/index.js +111 -43
  145. package/packages/dd-trace/src/config/parsers.js +18 -1
  146. package/packages/dd-trace/src/config/supported-configurations.json +174 -4
  147. package/packages/dd-trace/src/constants.js +1 -0
  148. package/packages/dd-trace/src/debugger/pause-duration-histogram.js +2 -1
  149. package/packages/dd-trace/src/debugger/probe_sampler.js +6 -6
  150. package/packages/dd-trace/src/encode/0.4.js +2 -2
  151. package/packages/dd-trace/src/esm-module-load.js +58 -0
  152. package/packages/dd-trace/src/exporter.js +23 -15
  153. package/packages/dd-trace/src/exporters/agent/index.js +3 -1
  154. package/packages/dd-trace/src/exporters/agentless/index.js +3 -1
  155. package/packages/dd-trace/src/exporters/common/request.js +83 -50
  156. package/packages/dd-trace/src/exporters/common/retry.js +12 -7
  157. package/packages/dd-trace/src/exporters/common/url.js +1 -1
  158. package/packages/dd-trace/src/exporters/llmobs/index.js +135 -0
  159. package/packages/dd-trace/src/exporters/log/index.js +4 -3
  160. package/packages/dd-trace/src/id.js +1 -1
  161. package/packages/dd-trace/src/lambda/facade.js +74 -0
  162. package/packages/dd-trace/src/lambda/handler.js +3 -41
  163. package/packages/dd-trace/src/lambda/index.js +38 -15
  164. package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
  165. package/packages/dd-trace/src/lambda/wrap.js +44 -0
  166. package/packages/dd-trace/src/llmobs/constants/tags.js +3 -0
  167. package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
  168. package/packages/dd-trace/src/llmobs/experiments/index.js +2 -3
  169. package/packages/dd-trace/src/llmobs/experiments/noop.js +5 -2
  170. package/packages/dd-trace/src/llmobs/index.js +13 -2
  171. package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +1 -1
  172. package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
  173. package/packages/dd-trace/src/llmobs/plugins/genai/index.js +1 -1
  174. package/packages/dd-trace/src/llmobs/plugins/genai/util.js +27 -10
  175. package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
  176. package/packages/dd-trace/src/llmobs/plugins/typesafe/index.js +102 -0
  177. package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
  178. package/packages/dd-trace/src/llmobs/prompts/cache.js +3 -1
  179. package/packages/dd-trace/src/llmobs/sdk.js +21 -1
  180. package/packages/dd-trace/src/llmobs/span_processor.js +219 -12
  181. package/packages/dd-trace/src/llmobs/tagger.js +25 -0
  182. package/packages/dd-trace/src/llmobs/writers/util.js +3 -3
  183. package/packages/dd-trace/src/log/channels.js +4 -0
  184. package/packages/dd-trace/src/log/writer.js +13 -2
  185. package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +68 -6
  186. package/packages/dd-trace/src/openfeature/configuration_source.js +41 -17
  187. package/packages/dd-trace/src/openfeature/debug-logging-hook.js +66 -3
  188. package/packages/dd-trace/src/openfeature/exposure-hook.js +185 -0
  189. package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
  190. package/packages/dd-trace/src/openfeature/flagging_provider.js +58 -14
  191. package/packages/dd-trace/src/openfeature/remote_config.js +16 -3
  192. package/packages/dd-trace/src/openfeature/writers/base.js +63 -30
  193. package/packages/dd-trace/src/openfeature/writers/exposures.js +161 -1
  194. package/packages/dd-trace/src/openfeature/writers/flag-eval-evp-hook.js +5 -0
  195. package/packages/dd-trace/src/openfeature/writers/flag-evaluation-aggregation.js +9 -4
  196. package/packages/dd-trace/src/openfeature/writers/flag-evaluation-payload.js +2 -0
  197. package/packages/dd-trace/src/openfeature/writers/flag-evaluation-pii.js +2 -0
  198. package/packages/dd-trace/src/openfeature/writers/split-features.js +25 -0
  199. package/packages/dd-trace/src/opentelemetry/logs/index.js +11 -0
  200. package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
  201. package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
  202. package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
  203. package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
  204. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +2 -2
  205. package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
  206. package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
  207. package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
  208. package/packages/dd-trace/src/opentelemetry/span.js +2 -2
  209. package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
  210. package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
  211. package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
  212. package/packages/dd-trace/src/opentelemetry/tracer_provider.js +5 -1
  213. package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
  214. package/packages/dd-trace/src/opentracing/tracer.js +33 -13
  215. package/packages/dd-trace/src/otel-thread-ctx.js +72 -49
  216. package/packages/dd-trace/src/plugin_manager.js +34 -7
  217. package/packages/dd-trace/src/plugins/ci_plugin.js +45 -14
  218. package/packages/dd-trace/src/plugins/index.js +9 -0
  219. package/packages/dd-trace/src/plugins/plugin.js +4 -2
  220. package/packages/dd-trace/src/plugins/tracing.js +1 -1
  221. package/packages/dd-trace/src/plugins/util/ci.js +18 -1
  222. package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
  223. package/packages/dd-trace/src/plugins/util/git.js +273 -86
  224. package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +77 -50
  225. package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
  226. package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
  227. package/packages/dd-trace/src/plugins/util/tags.js +6 -0
  228. package/packages/dd-trace/src/plugins/util/test.js +90 -45
  229. package/packages/dd-trace/src/plugins/util/url.js +10 -2
  230. package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -2
  231. package/packages/dd-trace/src/plugins/util/web.js +81 -10
  232. package/packages/dd-trace/src/process-tags/index.js +1 -1
  233. package/packages/dd-trace/src/profiling/config.js +6 -3
  234. package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
  235. package/packages/dd-trace/src/proxy.js +48 -57
  236. package/packages/dd-trace/src/serverless.js +3 -2
  237. package/packages/dd-trace/src/span_processor.js +41 -9
  238. package/packages/dd-trace/src/span_stats.js +28 -2
  239. package/packages/dd-trace/src/startup-log.js +8 -5
  240. package/packages/dd-trace/src/tagger.js +7 -5
  241. package/packages/dd-trace/src/telemetry/dependencies.js +4 -0
  242. package/packages/dd-trace/src/telemetry/index.js +3 -0
  243. package/packages/dd-trace/src/telemetry/logs/index.js +21 -2
  244. package/packages/dd-trace/src/telemetry/logs/log-collector.js +1 -0
  245. package/packages/dd-trace/src/telemetry/metrics.js +2 -1
  246. package/packages/dd-trace/src/telemetry/telemetry.js +10 -3
  247. package/packages/dd-trace/src/tracer.js +0 -2
  248. package/packages/dd-trace/src/util.js +1 -1
  249. package/packages/dd-trace/src/web-tags-cache.js +8 -9
  250. package/register.js +4 -2
  251. package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
  252. package/vendor/dist/{@opentelemetry/resources → @datadog/flagging-core}/LICENSE +22 -2
  253. package/vendor/dist/@datadog/flagging-core/index.js +1 -0
  254. package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
  255. package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
  256. package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
  257. package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.d.ts +78 -0
  258. package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.js +1 -1
  259. package/vendor/dist/@datadog/sketches-js/LICENSE +263 -0
  260. package/vendor/dist/@datadog/source-map/LICENSE +1 -0
  261. package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
  262. package/vendor/dist/@opentelemetry/core/LICENSE +209 -1
  263. package/vendor/dist/@opentelemetry/core/index.js +1 -1
  264. package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
  265. package/vendor/dist/escape-string-regexp/LICENSE +13 -0
  266. package/vendor/dist/esquery/LICENSE +2 -0
  267. package/vendor/dist/https-proxy-agent/LICENSE +80 -1
  268. package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
  269. package/vendor/dist/jest-docblock/LICENSE +16 -0
  270. package/vendor/dist/jsonpath-plus/LICENSE +13 -0
  271. package/vendor/dist/limiter/LICENSE +2 -0
  272. package/vendor/dist/lodash.sortby/LICENSE +2 -0
  273. package/vendor/dist/lru-cache/LICENSE +13 -0
  274. package/vendor/dist/meriyah/LICENSE +13 -0
  275. package/vendor/dist/module-details-from-path/LICENSE +2 -0
  276. package/vendor/dist/mutexify/promise/LICENSE +28 -0
  277. package/vendor/dist/pprof-format/LICENSE +13 -0
  278. package/vendor/dist/pprof-format/index.js +1 -1
  279. package/vendor/dist/protobufjs/LICENSE +219 -0
  280. package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
  281. package/vendor/dist/proxy-from-env/LICENSE +13 -0
  282. package/vendor/dist/retry/LICENSE +2 -0
  283. package/vendor/dist/rfdc/LICENSE +2 -0
  284. package/vendor/dist/semifies/LICENSE +3 -1
  285. package/vendor/dist/shell-quote/LICENSE +3 -1
  286. package/vendor/dist/source-map/LICENSE +1 -0
  287. package/vendor/dist/source-map/lib/util/LICENSE +1 -0
  288. package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
  289. package/vendor/dist/ttl-set/LICENSE +28 -0
  290. package/ci/diagnose.js +0 -2215
  291. package/ci/runbook.md +0 -299
  292. package/ci/test-optimization-validation/approval-artifacts.js +0 -175
  293. package/ci/test-optimization-validation/approval.js +0 -386
  294. package/ci/test-optimization-validation/artifact-id.js +0 -19
  295. package/ci/test-optimization-validation/blocker-category.js +0 -24
  296. package/ci/test-optimization-validation/bounded-json.js +0 -120
  297. package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
  298. package/ci/test-optimization-validation/ci-discovery.js +0 -192
  299. package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
  300. package/ci/test-optimization-validation/ci-remediation.js +0 -283
  301. package/ci/test-optimization-validation/cli.js +0 -954
  302. package/ci/test-optimization-validation/command-blocker.js +0 -377
  303. package/ci/test-optimization-validation/command-output-policy.js +0 -188
  304. package/ci/test-optimization-validation/command-runner.js +0 -650
  305. package/ci/test-optimization-validation/environment.js +0 -88
  306. package/ci/test-optimization-validation/executable-approval.js +0 -47
  307. package/ci/test-optimization-validation/executable.js +0 -244
  308. package/ci/test-optimization-validation/execution-lock.js +0 -70
  309. package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
  310. package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
  311. package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
  312. package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
  313. package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
  314. package/ci/test-optimization-validation/generated-file-policy.js +0 -63
  315. package/ci/test-optimization-validation/generated-files.js +0 -425
  316. package/ci/test-optimization-validation/generated-test-contract.js +0 -284
  317. package/ci/test-optimization-validation/generated-verifier.js +0 -235
  318. package/ci/test-optimization-validation/literal-environment.js +0 -56
  319. package/ci/test-optimization-validation/literal-glob.js +0 -52
  320. package/ci/test-optimization-validation/manifest-loader.js +0 -116
  321. package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
  322. package/ci/test-optimization-validation/manifest-schema.js +0 -695
  323. package/ci/test-optimization-validation/offline-fixtures.js +0 -335
  324. package/ci/test-optimization-validation/offline-output.js +0 -406
  325. package/ci/test-optimization-validation/package-check.js +0 -97
  326. package/ci/test-optimization-validation/payload-normalizer.js +0 -72
  327. package/ci/test-optimization-validation/plan-writer.js +0 -541
  328. package/ci/test-optimization-validation/preflight-runner.js +0 -186
  329. package/ci/test-optimization-validation/project-build-artifact.js +0 -31
  330. package/ci/test-optimization-validation/redaction.js +0 -319
  331. package/ci/test-optimization-validation/report-writer.js +0 -666
  332. package/ci/test-optimization-validation/result-semantics.js +0 -103
  333. package/ci/test-optimization-validation/runner-command.js +0 -264
  334. package/ci/test-optimization-validation/runner-contract.js +0 -695
  335. package/ci/test-optimization-validation/safe-files.js +0 -202
  336. package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
  337. package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
  338. package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
  339. package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
  340. package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
  341. package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
  342. package/ci/test-optimization-validation/source-text.js +0 -84
  343. package/ci/test-optimization-validation/static-diagnosis.js +0 -166
  344. package/ci/test-optimization-validation/test-output.js +0 -120
  345. package/ci/test-optimization-validation/validation-blocker.js +0 -21
  346. package/ci/validate-test-optimization.js +0 -3
  347. package/packages/datadog-esbuild/src/resolver.js +0 -284
  348. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -156
  349. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -287
  350. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +0 -84
  351. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -368
  352. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +0 -59
  353. package/vendor/dist/@opentelemetry/resources/index.js +0 -1
@@ -22,7 +22,6 @@
22
22
  "@opentelemetry/api","https://github.com/open-telemetry/opentelemetry-js","['Apache-2.0']","['OpenTelemetry Authors']"
23
23
  "@opentelemetry/api-logs","https://github.com/open-telemetry/opentelemetry-js","['Apache-2.0']","['OpenTelemetry Authors']"
24
24
  "@opentelemetry/core","https://github.com/open-telemetry/opentelemetry-js","['Apache-2.0']","['OpenTelemetry Authors']"
25
- "@opentelemetry/resources","https://github.com/open-telemetry/opentelemetry-js","['Apache-2.0']","['OpenTelemetry Authors']"
26
25
  "@opentelemetry/semantic-conventions","https://github.com/open-telemetry/opentelemetry-js","['Apache-2.0']","['OpenTelemetry Authors']"
27
26
  "@oxc-parser/binding-android-arm-eabi","https://github.com/oxc-project/oxc","['MIT']","['Boshen and oxc contributors']"
28
27
  "@oxc-parser/binding-android-arm64","https://github.com/oxc-project/oxc","['MIT']","['Boshen and oxc contributors']"
@@ -1,3 +1,17 @@
1
1
  'use strict'
2
2
 
3
- require('../../packages/datadog-plugin-cypress/src/support')
3
+ /* global Cypress */
4
+
5
+ const hasCypressLifecycle = require('../../packages/datadog-plugin-cypress/src/lifecycle-owner')
6
+ const root = Cypress.mocha.getRootSuite()
7
+ const installed = Symbol.for('dd-trace.cypress.support-installed')
8
+
9
+ if (!hasCypressLifecycle(root)) {
10
+ if (!root[installed]) {
11
+ require('../../packages/datadog-plugin-cypress/src/support')
12
+ root[installed] = true
13
+ }
14
+
15
+ const install = root[Symbol.for('dd-trace.cypress.install-lifecycle')]
16
+ if (typeof install === 'function') install()
17
+ }
package/ci/init.js CHANGED
@@ -4,15 +4,12 @@
4
4
  const exporters = require('../ext/exporters')
5
5
  const log = require('../packages/dd-trace/src/log')
6
6
  const { getEnvironmentVariable, getValueFromEnvSources } = require('../packages/dd-trace/src/config/helper')
7
- const { isFalse, isTrue } = require('../packages/dd-trace/src/util')
7
+ const { isTrue } = require('../packages/dd-trace/src/util')
8
8
 
9
9
  const PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm']
10
10
  const DEFAULT_FLUSH_INTERVAL = 10_000
11
11
  const JEST_FLUSH_INTERVAL = 0
12
12
  const VITEST_NO_WORKER_INIT_ACTIVE_ENV = 'DD_TEST_OPT_VITEST_NO_WORKER_INIT_ACTIVE'
13
- const VALIDATION_MODE_ENV = '_DD_TEST_OPTIMIZATION_VALIDATION_MODE'
14
- const VALIDATION_MANIFEST_ENV = '_DD_TEST_OPTIMIZATION_VALIDATION_MANIFEST_FILE'
15
- const VALIDATION_OUTPUT_ENV = '_DD_TEST_OPTIMIZATION_VALIDATION_OUTPUT_DIR'
16
13
  const EXPORTER_MAP = {
17
14
  jest: exporters.JEST_WORKER,
18
15
  cucumber: exporters.CUCUMBER_WORKER,
@@ -46,22 +43,9 @@ const baseOptions = {
46
43
  flushInterval: isJestWorker ? JEST_FLUSH_INTERVAL : DEFAULT_FLUSH_INTERVAL,
47
44
  }
48
45
 
49
- const isValidationModeRequested = isTrue(getEnvironmentVariable(VALIDATION_MODE_ENV))
50
- const missingValidationEnvironment = [VALIDATION_MANIFEST_ENV, VALIDATION_OUTPUT_ENV].filter(name => {
51
- return !getEnvironmentVariable(name)
52
- })
53
- const isValidationMode = isValidationModeRequested && missingValidationEnvironment.length === 0
54
- if (isValidationModeRequested && !isValidationMode) {
55
- console.error(
56
- `${VALIDATION_MODE_ENV} requires ${missingValidationEnvironment.join(' and ')}; ` +
57
- 'dd-trace will not be initialized.'
58
- )
59
- }
60
46
  // skipDefault: CI visibility stays on unless DD_CIVISIBILITY_ENABLED is explicitly false; the
61
47
  // registered default (false) would otherwise turn it off whenever the variable is unset.
62
- let shouldInit = isValidationModeRequested
63
- ? isValidationMode && !isFalse(getEnvironmentVariable('DD_CIVISIBILITY_ENABLED'))
64
- : getValueFromEnvSources('DD_CIVISIBILITY_ENABLED', true) !== false
48
+ let shouldInit = getValueFromEnvSources('DD_CIVISIBILITY_ENABLED', true) !== false
65
49
  const isGlobalAgentlessEnabled = getValueFromEnvSources('DD_AGENTLESS_ENABLED')
66
50
  const isAgentlessEnabled = isGlobalAgentlessEnabled ||
67
51
  getValueFromEnvSources('DD_CIVISIBILITY_AGENTLESS_ENABLED')
@@ -75,10 +59,6 @@ if (isTestWorker) {
75
59
  baseOptions.experimental = {
76
60
  exporter: EXPORTER_MAP[testWorkerType],
77
61
  }
78
- } else if (isValidationMode) {
79
- baseOptions.experimental = {
80
- exporter: 'ci_validation',
81
- }
82
62
  } else {
83
63
  if (isAgentlessEnabled) {
84
64
  if (getValueFromEnvSources('DD_API_KEY')) {
@@ -0,0 +1,5 @@
1
+ /** Prevent Datadog from quarantining or disabling this test callback. */
2
+ export function preventFailureSuppression<T extends (...args: never[]) => unknown>(callback: T): T;
3
+
4
+ /** Prevent ATR, Early Flake Detection, and Attempt to Fix retries for this test callback. */
5
+ export function noAutoRetry<T extends (...args: never[]) => unknown>(callback: T): T;
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ const { preventFailureSuppression, noAutoRetry } = require('../packages/dd-trace/src/ci-visibility/test-annotations')
4
+
5
+ module.exports = { preventFailureSuppression, noAutoRetry }
@@ -0,0 +1,4 @@
1
+ import * as declarations from '../packages/dd-trace/src/ci-visibility/test-declaration-annotations.js'
2
+
3
+ export const { captureDeclarations } = declarations.default ||
4
+ globalThis[Symbol.for('dd-trace.vitest.declaration-annotations')]
@@ -0,0 +1,22 @@
1
+ import { createRequire } from 'node:module'
2
+ import { pathToFileURL } from 'node:url'
3
+
4
+ import { captureDeclarations } from './vitest-no-worker-init-annotations.mjs'
5
+
6
+ // Vitest's resolver selects the running installation even when config.root contains another copy.
7
+ const worker = globalThis.__vitest_worker__
8
+ // Vitest 3 uses Vite Node's resolveId RPC; Vitest 4+ uses Vite's named environments.
9
+ const { id } = worker.moduleCache
10
+ ? await worker.rpc.resolveId('vitest', undefined, 'ssr')
11
+ : await worker.rpc.resolve('vitest', undefined, '__vitest__')
12
+ const vitestUrl = id.startsWith('file:') ? id : pathToFileURL(id).href
13
+ const vitestRequire = createRequire(vitestUrl)
14
+ const vitest = await import(vitestUrl)
15
+ const vitestRunner = vitest.TestRunner || await import(pathToFileURL(vitestRequire.resolve('vitest/suite')).href)
16
+
17
+ globalThis[Symbol.for('dd-trace.vitest.api')] = vitest
18
+ globalThis[Symbol.for('dd-trace.vitest.set-fn')] = vitestRunner.setTestFn || vitestRunner.setFn
19
+ globalThis[Symbol.for('dd-trace.vitest.skip-task')] = skip => skip('Skipped by Datadog Test Optimization')
20
+ captureDeclarations(vitest.test, vitestRunner.getCurrentSuite)
21
+
22
+ await import('./vitest-no-worker-init-setup.mjs')
@@ -1,35 +1,10 @@
1
- try {
2
- // Vitest does not expose setFn from its public setup API; keep this optional for strict installers.
3
- const vitestRunner = await import('@vitest/runner')
4
- globalThis[Symbol.for('dd-trace.vitest.set-fn')] = vitestRunner.setFn
5
- trackNativeRetryOptions(vitestRunner.getCurrentSuite())
6
- } catch {}
1
+ import * as vitest from 'vitest'
2
+
3
+ import { captureDeclarations } from './vitest-no-worker-init-annotations.mjs'
4
+
5
+ const vitestRunner = vitest.TestRunner || await import('vitest/suite')
6
+ globalThis[Symbol.for('dd-trace.vitest.set-fn')] = vitestRunner.setTestFn || vitestRunner.setFn
7
+ captureDeclarations(vitest.test, vitestRunner.getCurrentSuite)
7
8
  globalThis[Symbol.for('dd-trace.vitest.browser-context-importer')] = () => import('@vitest/browser/context')
8
9
 
9
10
  await import('./vitest-no-worker-init-setup.mjs')
10
-
11
- /**
12
- * Legacy Vitest inherits numeric retries and loses their origin during collection.
13
- * These collectors and their chainable callbacks are created at runtime.
14
- * @param {object} collector
15
- */
16
- function trackNativeRetryOptions (collector) {
17
- const original = collector.test.fn
18
- collector.test.fn = function (name, optionsOrFn, fnOrOptions) {
19
- const options = optionsOrFn !== null && typeof optionsOrFn === 'object' ? optionsOrFn : fnOrOptions
20
- const length = collector.tasks.length
21
- const result = original.apply(this, arguments)
22
- if ((options?.retry !== undefined || collector.options?.retry !== undefined) && collector.tasks.length > length) {
23
- const task = collector.tasks.at(-1)
24
- task.meta = { ...task.meta, __ddTestOptNativeRetry: true }
25
- }
26
- return result
27
- }
28
- const push = collector.tasks.push
29
- collector.tasks.push = function (...tasks) {
30
- for (const task of tasks) {
31
- if (task.type === 'collector') trackNativeRetryOptions(task)
32
- }
33
- return push.apply(this, tasks)
34
- }
35
- }
@@ -1,4 +1,5 @@
1
- import { afterEach, beforeAll, beforeEach, inject } from 'vitest'
1
+ const { afterEach, beforeAll, beforeEach, inject } =
2
+ globalThis[Symbol.for('dd-trace.vitest.api')] || await import('vitest')
2
3
 
3
4
  // Instrumentation-less setup for DD_EXPERIMENTAL_TEST_OPT_VITEST_NO_WORKER_INIT.
4
5
  // It applies Test Optimization execution changes without initializing dd-trace and also supports Browser Mode.
@@ -84,9 +85,11 @@ if (isNoWorkerInitActive) {
84
85
  beforeEach(function ({ onTestFinished, task, skip }) {
85
86
  const testSuite = getTestSuite(task)
86
87
  const testName = getTestName(task)
87
- const isAttemptToFixTest = attemptToFixTests[testSuite]?.[testName]
88
+ const annotations = task.meta?.__ddTestOptAnnotations || {}
89
+ const isAttemptToFixTest = attemptToFixTests[testSuite]?.[testName] && !annotations.noAutoRetry
88
90
  const isEarlyFlakeDetectionTestAttempt = isEarlyFlakeDetectionTask(task)
89
- const isQuarantinedTest = quarantinedTests[testSuite]?.[testName] && !isAttemptToFixTest
91
+ const isQuarantinedTest = quarantinedTests[testSuite]?.[testName] &&
92
+ !annotations.mustFail && !isAttemptToFixTest
90
93
  const attemptIndex = getNextAttemptIndex(task)
91
94
  const attemptStart = now()
92
95
  if (task.retry?.__ddTestOptAtr && retryAttemptIndexByTask.get(task).index === 0) {
@@ -98,7 +101,7 @@ if (isNoWorkerInitActive) {
98
101
  recordTestOptimizationStatus(task, attemptIndex - 1)
99
102
  }
100
103
 
101
- if (!isAttemptToFixTest && disabledTests[testSuite]?.[testName]) {
104
+ if (!isAttemptToFixTest && !annotations.mustFail && disabledTests[testSuite]?.[testName]) {
102
105
  skip('Skipped by Datadog Test Optimization')
103
106
  } else if (isAttemptToFixTest && attemptIndex > 0) {
104
107
  task.result.state = 'run'
@@ -148,13 +151,19 @@ function applyExecutionChanges (suite, isEfdSuiteAdmissionAllowed) {
148
151
 
149
152
  const testSuite = getTestSuite(task)
150
153
  const testName = getTestName(task)
151
- if (attemptToFixTests[testSuite]?.[testName]) {
154
+ const annotations = task.meta?.__ddTestOptAnnotations || {}
155
+ if (annotations.noAutoRetry && !annotations.hasFrameworkRetry &&
156
+ (task.retry?.__ddTestOptAtr || isAutomaticRetryProject(task))) {
157
+ task.retry = 0
158
+ }
159
+ if (attemptToFixTests[testSuite]?.[testName] && !annotations.noAutoRetry) {
152
160
  task.retry = 0
153
161
  task.repeats = attemptToFixRetries
154
162
  task.meta.__ddTestOptAtfRetries = attemptToFixRetries
155
- } else if (disabledTests[testSuite]?.[testName]) {
163
+ } else if (disabledTests[testSuite]?.[testName] && !annotations.mustFail) {
156
164
  task.mode = 'skip'
157
- } else if (isEfdSuiteAdmissionAllowed && isEarlyFlakeDetectionTest(testSuite, testName)) {
165
+ } else if (!annotations.noAutoRetry && isEfdSuiteAdmissionAllowed &&
166
+ isEarlyFlakeDetectionTest(testSuite, testName)) {
158
167
  task.retry = 0
159
168
  task.repeats = earlyFlakeDetectionRetries
160
169
  task.meta.__ddTestOptEfdRetries = earlyFlakeDetectionRetries
@@ -165,6 +174,15 @@ function applyExecutionChanges (suite, isEfdSuiteAdmissionAllowed) {
165
174
  }
166
175
  }
167
176
 
177
+ /** @param {object} task */
178
+ function isAutomaticRetryProject (task) {
179
+ if (!flakyTestRetriesConfiguration) return false
180
+ const projectName = task.file.projectName
181
+ return projectName
182
+ ? flakyTestRetriesConfiguration.projectNames.includes(projectName)
183
+ : flakyTestRetriesConfiguration.includesUnnamedProject
184
+ }
185
+
168
186
  /**
169
187
  * Stops Datadog-managed retries at the initial attempt's duration budget, after the complete lifecycle.
170
188
  *
@@ -383,7 +401,7 @@ function recordTestOptimizationStatus (task, attemptIndex = task.result?.repeatC
383
401
  const testSuite = getTestSuite(task)
384
402
  const testName = getTestName(task)
385
403
 
386
- if (attemptToFixTests[testSuite]?.[testName]) {
404
+ if (attemptToFixTests[testSuite]?.[testName] && !task.meta?.__ddTestOptAnnotations?.noAutoRetry) {
387
405
  recordAttemptToFixStatus(task, attemptIndex, onlyIfNewErrors)
388
406
  } else if (isEarlyFlakeDetectionTask(task)) {
389
407
  recordEarlyFlakeDetectionStatus(task, attemptIndex, onlyIfNewErrors)
@@ -564,7 +582,7 @@ function getFinalAttemptIndex (task) {
564
582
  const testSuite = getTestSuite(task)
565
583
  const testName = getTestName(task)
566
584
 
567
- if (attemptToFixTests[testSuite]?.[testName]) {
585
+ if (attemptToFixTests[testSuite]?.[testName] && !task.meta?.__ddTestOptAnnotations?.noAutoRetry) {
568
586
  return getAttemptToFixRetryCount(task)
569
587
  }
570
588
  if (isEarlyFlakeDetectionTask(task)) {
@@ -589,7 +607,8 @@ function switchQuarantinedFinalFailure (task) {
589
607
  const testName = getTestName(task)
590
608
  if (
591
609
  !quarantinedTests[testSuite]?.[testName] ||
592
- attemptToFixTests[testSuite]?.[testName] ||
610
+ task.meta?.__ddTestOptAnnotations?.mustFail ||
611
+ (attemptToFixTests[testSuite]?.[testName] && !task.meta?.__ddTestOptAnnotations?.noAutoRetry) ||
593
612
  task.result?.state !== 'fail'
594
613
  ) {
595
614
  return
@@ -615,7 +634,8 @@ function markQuarantinedFailure (task) {
615
634
  const testName = getTestName(task)
616
635
  if (
617
636
  !quarantinedTests[testSuite]?.[testName] ||
618
- attemptToFixTests[testSuite]?.[testName] ||
637
+ task.meta?.__ddTestOptAnnotations?.mustFail ||
638
+ (attemptToFixTests[testSuite]?.[testName] && !task.meta?.__ddTestOptAnnotations?.noAutoRetry) ||
619
639
  task.result?.state !== 'fail'
620
640
  ) {
621
641
  return
@@ -768,9 +788,11 @@ function getEarlyFlakeDetectionSuiteCandidate (suite) {
768
788
 
769
789
  const testSuite = getTestSuite(task)
770
790
  const testName = getTestName(task)
791
+ const annotations = task.meta?.__ddTestOptAnnotations || {}
771
792
  if (
793
+ annotations.noAutoRetry ||
772
794
  attemptToFixTests[testSuite]?.[testName] ||
773
- disabledTests[testSuite]?.[testName] ||
795
+ (disabledTests[testSuite]?.[testName] && !annotations.mustFail) ||
774
796
  !isEarlyFlakeDetectionTest(testSuite, testName)
775
797
  ) {
776
798
  continue
@@ -1,3 +1,9 @@
1
+ import { test, TestRunner } from 'vitest'
2
+
3
+ import { captureDeclarations } from './vitest-no-worker-init-annotations.mjs'
4
+
5
+ captureDeclarations(test, TestRunner.getCurrentSuite)
6
+
1
7
  globalThis[Symbol.for('dd-trace.vitest.browser-context-importer')] = () => import('vitest/browser')
2
8
  globalThis[Symbol.for('dd-trace.vitest.skip-task')] = skip => skip('Skipped by Datadog Test Optimization')
3
9
 
package/ext/exporters.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict'
2
2
  module.exports = {
3
3
  LOG: 'log',
4
+ LLMOBS: 'llmobs',
4
5
  AGENT: 'agent',
5
6
  AGENTLESS: 'agentless',
6
7
  DATADOG: 'datadog',
7
8
  AGENT_PROXY: 'agent_proxy',
8
- CI_VALIDATION: 'ci_validation',
9
9
  JEST_WORKER: 'jest_worker',
10
10
  CUCUMBER_WORKER: 'cucumber_worker',
11
11
  MOCHA_WORKER: 'mocha_worker',
package/index.d.ts CHANGED
@@ -213,7 +213,9 @@ interface Tracer extends opentracing.Tracer {
213
213
  /**
214
214
  * OpenFeature Provider with agentless and Agent Remote Config delivery.
215
215
  *
216
- * Agentless delivery is enabled by default and starts when the provider is first accessed.
216
+ * Agentless delivery is enabled by default and starts when the provider is first accessed. The default agentless
217
+ * endpoint requires DD_API_KEY. Without it, provider initialization fails at once. A custom agentless base URL
218
+ * and Remote Config delivery do not need the key.
217
219
  *
218
220
  * @env DD_FEATURE_FLAGS_ENABLED
219
221
  * @env DD_FEATURE_FLAGS_CONFIGURATION_SOURCE
@@ -291,8 +293,10 @@ interface Plugins {
291
293
  "anthropic": tracer.plugins.anthropic;
292
294
  "claude-agent-sdk": tracer.plugins.claude_agent_sdk;
293
295
  "apollo": tracer.plugins.apollo;
296
+ "async-mutex": tracer.plugins.async_mutex;
294
297
  "avsc": tracer.plugins.avsc;
295
298
  "aws-durable-execution-sdk-js": tracer.plugins.aws_durable_execution_sdk_js;
299
+ "aws-lambda": tracer.plugins.aws_lambda;
296
300
  "aws-sdk": tracer.plugins.aws_sdk;
297
301
  "azure-cosmos": tracer.plugins.azure_cosmos;
298
302
  "azure-event-hubs": tracer.plugins.azure_event_hubs;
@@ -312,6 +316,7 @@ interface Plugins {
312
316
  "dns": tracer.plugins.dns;
313
317
  "elasticsearch": tracer.plugins.elasticsearch;
314
318
  "electron": tracer.plugins.electron;
319
+ "elevenlabs": tracer.plugins.elevenlabs;
315
320
  "express": tracer.plugins.express;
316
321
  "fastify": tracer.plugins.fastify;
317
322
  "fetch": tracer.plugins.fetch;
@@ -359,6 +364,7 @@ interface Plugins {
359
364
  "postgres": tracer.plugins.postgres;
360
365
  "prisma": tracer.plugins.prisma;
361
366
  "protobufjs": tracer.plugins.protobufjs;
367
+ "react-router": tracer.plugins.react_router;
362
368
  "redis": tracer.plugins.redis;
363
369
  "restify": tracer.plugins.restify;
364
370
  "rhea": tracer.plugins.rhea;
@@ -367,6 +373,8 @@ interface Plugins {
367
373
  "sharedb": tracer.plugins.sharedb;
368
374
  "supabase": tracer.plugins.supabase;
369
375
  "tedious": tracer.plugins.tedious;
376
+ "trpc": tracer.plugins.trpc;
377
+ "typesafe": tracer.plugins.typesafe;
370
378
  "undici": tracer.plugins.undici;
371
379
  "vitest": tracer.plugins.vitest;
372
380
  "web": tracer.plugins.web;
@@ -867,6 +875,25 @@ declare namespace tracer {
867
875
  * @env DD_FEATURE_FLAGS_EVALUATION_TELEMETRY_PER_SUBJECT_OPT_OUT_ENABLED
868
876
  */
869
877
  enableEvaluationTelemetryOptOutParameter?: boolean
878
+
879
+ /**
880
+ * Loads only the flags that have any of these tags or whose key matches any of these key patterns,
881
+ * instead of every flag. Each list accepts at most 31 values of at most 200 UTF-8 bytes each.
882
+ * A selection that cannot be sent is dropped with an error log, and every flag is loaded.
883
+ * Programmatic only, with no environment variable, so `dd-trace/init` cannot set it.
884
+ * Captured when `tracer.openfeature` is first accessed. Agentless delivery only.
885
+ */
886
+ flagSelection?: {
887
+ /**
888
+ * Flag tags, such as `checkout`, matched exactly and case-sensitively.
889
+ */
890
+ tags?: string[]
891
+ /**
892
+ * Flag key patterns, such as `checkout.*`, matched case-sensitively against the whole key.
893
+ * `*` matches any run of characters, including none; every other character, including `?`, is literal.
894
+ */
895
+ keyPatterns?: string[]
896
+ }
870
897
  }
871
898
 
872
899
  /**
@@ -990,7 +1017,8 @@ declare namespace tracer {
990
1017
  enabled?: boolean
991
1018
  /**
992
1019
  * Timeout in milliseconds for OpenFeature provider initialization.
993
- * If configuration is not received within this time, initialization fails.
1020
+ * If configuration is not received within this time, initialization fails. It fails at once when the agentless
1021
+ * configuration source cannot start, such as the default endpoint without DD_API_KEY.
994
1022
  * Can be configured via DD_EXPERIMENTAL_FLAGGING_PROVIDER_INITIALIZATION_TIMEOUT_MS environment variable.
995
1023
  *
996
1024
  * @default 30000
@@ -2130,11 +2158,21 @@ declare namespace tracer {
2130
2158
  * @param opts - Optional configuration object:
2131
2159
  * - `block`: When true, throws an exception if evaluation result is not 'ALLOW'
2132
2160
  * and the AI Guard service has blocking mode enabled (default: false).
2161
+ * - `tags`: Custom tags to set on the AI Guard span. Keys are set verbatim. Keys equal to
2162
+ * `ai_guard` or starting with `ai_guard.` are reserved and ignored. Entries with an
2163
+ * empty key, a key longer than 200 characters, a string value longer than 25000
2164
+ * characters, or a value that is not a string, finite number or boolean are dropped.
2133
2165
  * @returns Promise resolving to an Evaluation with the security decision and reasoning.
2134
2166
  * The promise rejects with AIGuardAbortError when `opts.block` is true and the evaluation result would block the request.
2135
2167
  * The promise rejects with AIGuardClientError when communication with the AI Guard service fails.
2136
2168
  */
2137
- evaluate (messages: Message[], opts?: { block?: boolean }): Promise<Evaluation>;
2169
+ evaluate (
2170
+ messages: Message[],
2171
+ opts?: {
2172
+ block?: boolean,
2173
+ tags?: { [key: string]: string | number | boolean },
2174
+ }
2175
+ ): Promise<Evaluation>;
2138
2176
  }
2139
2177
  }
2140
2178
 
@@ -2544,6 +2582,12 @@ declare namespace tracer {
2544
2582
  };
2545
2583
  }
2546
2584
 
2585
+ /**
2586
+ * This plugin automatically instruments the
2587
+ * [async-mutex](https://github.com/DirtyHairy/async-mutex) module.
2588
+ */
2589
+ interface async_mutex extends Instrumentation {}
2590
+
2547
2591
  /**
2548
2592
  * This plugin automatically patches the [avsc](https://github.com/mtth/avsc) module
2549
2593
  * to collect avro message schemas when Datastreams Monitoring is enabled.
@@ -2556,6 +2600,46 @@ declare namespace tracer {
2556
2600
  */
2557
2601
  interface aws_durable_execution_sdk_js extends Integration {}
2558
2602
 
2603
+ /** Configuration for AWS Lambda invocation instrumentation in Lambda runtimes. */
2604
+ interface aws_lambda extends Instrumentation {
2605
+ /** @default true @env DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED */
2606
+ serviceRepresentationEnabled?: boolean;
2607
+ /** @default true @env DD_ENHANCED_METRICS */
2608
+ enhancedMetrics?: boolean;
2609
+ /** @default false @env DD_CAPTURE_LAMBDA_PAYLOAD */
2610
+ captureLambdaPayload?: boolean;
2611
+ /** @default 10 @env DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH */
2612
+ captureLambdaPayloadMaxDepth?: number;
2613
+ /** @default true @env DD_TRACE_MANAGED_SERVICES */
2614
+ createInferredSpan?: boolean;
2615
+ /** @default false @env DD_MERGE_XRAY_TRACES */
2616
+ mergeXrayTraces?: boolean;
2617
+ /** @default true @env DD_ENCODE_AUTHORIZER_CONTEXT */
2618
+ encodeAuthorizerContext?: boolean;
2619
+ /** @default true @env DD_DECODE_AUTHORIZER_CONTEXT */
2620
+ decodeAuthorizerContext?: boolean;
2621
+ /** @default true @env DD_COLD_START_TRACING */
2622
+ coldStartTracing?: boolean;
2623
+ /** @default 3 @env DD_MIN_COLD_START_DURATION */
2624
+ minColdStartTraceDurationMs?: number;
2625
+ /** @default './opentracing/tracer' @env DD_COLD_START_TRACE_SKIP_LIB */
2626
+ coldStartTraceSkipLib?: string;
2627
+ /** @default false @env DD_FLUSH_TO_LOG */
2628
+ logForwarding?: boolean;
2629
+ /** Defaults to true in AWS GovCloud regions. @env DD_LAMBDA_FIPS_MODE */
2630
+ fipsMode?: boolean;
2631
+ /** @env DD_KMS_API_KEY */
2632
+ apiKeyKms?: string;
2633
+ /** @env DD_API_KEY_SECRET_ARN */
2634
+ apiKeySecretArn?: string;
2635
+ /** @default true @env DD_TRACE_AWS_ADD_SPAN_POINTERS */
2636
+ addSpanPointers?: boolean;
2637
+ /** @default false @env DD_DATA_STREAMS_ENABLED */
2638
+ dataStreamsEnabled?: boolean;
2639
+ /** Force a second wrapper even when the handler carries the shared wrapped marker. */
2640
+ forceWrap?: boolean;
2641
+ }
2642
+
2559
2643
  /**
2560
2644
  * This plugin automatically instruments the
2561
2645
  * [aws-sdk](https://github.com/aws/aws-sdk-js) module.
@@ -2751,6 +2835,12 @@ declare namespace tracer {
2751
2835
  net?: boolean;
2752
2836
  }
2753
2837
 
2838
+ /**
2839
+ * This plugin automatically instruments the
2840
+ * [@elevenlabs/elevenlabs-js](https://www.npmjs.com/package/@elevenlabs/elevenlabs-js) module.
2841
+ */
2842
+ interface elevenlabs extends Instrumentation, LLMObsIntegration {}
2843
+
2754
2844
  /**
2755
2845
  * This plugin automatically instruments the
2756
2846
  * [express](http://expressjs.com/) module.
@@ -3402,12 +3492,12 @@ declare namespace tracer {
3402
3492
  */
3403
3493
  interface prisma extends PrismaClient, PrismaEngine {
3404
3494
  /**
3405
- * Configuration for prisma client.
3495
+ * Configuration for prisma client. Set to `false` to skip `prisma.client` spans.
3406
3496
  */
3407
3497
  client?: PrismaClient | boolean,
3408
3498
 
3409
3499
  /**
3410
- * Configuration for Prisma engine.
3500
+ * Configuration for Prisma engine. Set to `false` to skip `prisma.engine` spans.
3411
3501
  */
3412
3502
  engine?: PrismaEngine | boolean
3413
3503
  }
@@ -3418,6 +3508,17 @@ declare namespace tracer {
3418
3508
  */
3419
3509
  interface protobufjs extends Integration {}
3420
3510
 
3511
+ /**
3512
+ * This plugin automatically instruments
3513
+ * [React Router](https://reactrouter.com/) Framework Mode via the
3514
+ * ServerInstrumentation API (`createRequestHandler`), tagging Express/http
3515
+ * spans with parameterized routes and creating loader/action child spans.
3516
+ *
3517
+ * Requires `react-router` >= 7.9.5 (stable `instrumentations` in >= 7.15).
3518
+ * Configure request span options on `http` or the host framework integration.
3519
+ */
3520
+ interface react_router extends Pick<Instrumentation, 'enabled' | 'measured'> {}
3521
+
3421
3522
  /**
3422
3523
  * This plugin automatically instruments the
3423
3524
  * [redis](https://github.com/NodeRedis/node_redis) module.
@@ -3539,6 +3640,18 @@ declare namespace tracer {
3539
3640
  */
3540
3641
  interface tedious extends Instrumentation {}
3541
3642
 
3643
+ /**
3644
+ * Traces tRPC server queries and mutations. Express requests with one resolved procedure
3645
+ * use its route as the HTTP resource; batches retain the Express mount route.
3646
+ */
3647
+ interface trpc extends Instrumentation {}
3648
+
3649
+ /**
3650
+ * This plugin automatically instruments the
3651
+ * [@typesafe-ai/sdk](https://www.npmjs.com/package/@typesafe-ai/sdk) module.
3652
+ */
3653
+ interface typesafe extends Instrumentation, LLMObsIntegration {}
3654
+
3542
3655
  /**
3543
3656
  * This plugin automatically instruments the
3544
3657
  * [undici](https://github.com/nodejs/undici) module.
@@ -4690,6 +4803,12 @@ declare namespace tracer {
4690
4803
  */
4691
4804
  output: { content: JSONType, role?: string }[]
4692
4805
 
4806
+ /**
4807
+ * The expected output associated with an experiment span.
4808
+ * Delete this property or set it to `undefined` to omit the expected output.
4809
+ */
4810
+ expectedOutput?: JSONType
4811
+
4693
4812
  /**
4694
4813
  * Get a tag from the span.
4695
4814
  * @param key The key of the tag to get.
package/initialize.mjs CHANGED
@@ -9,7 +9,9 @@
9
9
  * hook will always be active for ESM support.
10
10
  */
11
11
 
12
- /* eslint n/no-unsupported-features/node-builtins: ['error', { ignores: ['module.register'] }] */
12
+ /* eslint n/no-unsupported-features/node-builtins: [
13
+ 'error', { ignores: ['module.register', 'module.registerHooks'] }
14
+ ] */
13
15
 
14
16
  import { Buffer } from 'buffer'
15
17
  import * as Module from 'module'
@@ -100,7 +102,8 @@ if (isMainThread) {
100
102
  const initialized = require('./init.js')
101
103
  // Only register the loader hook when instrumentation initialized. On a bailout the
102
104
  // loader has nothing to instrument and can keep a short-lived process from exiting.
103
- if (Module.register && initialized) {
105
+ // `registerHooks` alone keeps the gate open once Node.js drops `register` (nodejs/node#67090).
106
+ if ((Module.registerHooks || Module.register) && initialized) {
104
107
  require('./register.js')
105
108
  }
106
109
  }
package/lambda.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ import tracer = require('./index')
2
+
3
+ export type LambdaHandler = (...args: any[]) => any
4
+
5
+ export interface LambdaWrapOptions extends tracer.plugins.aws_lambda {}
6
+
7
+ // Buffered wrappers require an event and context even when the customer handler omits them.
8
+ type LambdaHandlerArguments<THandler extends LambdaHandler> =
9
+ Parameters<THandler> extends [unknown, unknown, ...unknown[]]
10
+ ? Parameters<THandler>
11
+ : Parameters<THandler> extends [event?: infer TEvent, context?: infer TContext, ...unknown[]]
12
+ ? [event: TEvent, context: TContext & object]
13
+ : [event: unknown, context: object]
14
+
15
+ export function wrap<THandler extends LambdaHandler>(
16
+ handler: THandler,
17
+ config?: LambdaWrapOptions
18
+ ): ((...args: LambdaHandlerArguments<THandler>) => Promise<Awaited<ReturnType<THandler>>>) &
19
+ Pick<THandler, keyof THandler>
20
+
21
+ export function sendDistributionMetric(name: string, value: number, ...tags: string[]): void
22
+
23
+ export function sendDistributionMetricWithDate(
24
+ name: string,
25
+ value: number,
26
+ metricTime: Date,
27
+ ...tags: string[]
28
+ ): void
29
+
30
+ export function getTraceHeaders(): Record<string, string>
31
+
32
+ export interface LambdaInitFailure {
33
+ error: Error
34
+ functionName: string
35
+ /** `Date.now()` at the start of handler module evaluation. */
36
+ startTime: number
37
+ }
38
+
39
+ export function reportInitFailure(failure: LambdaInitFailure): Promise<void>
package/lambda.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ module.exports = require('./packages/dd-trace/src/lambda/facade')