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
@@ -18,12 +18,15 @@ const { isTrue } = require('../util')
18
18
  const telemetry = require('../telemetry')
19
19
  const telemetryMetrics = require('../telemetry/metrics')
20
20
  const {
21
+ getServerlessPlatform,
21
22
  getServerlessPlatformTags,
22
23
  IS_SERVERLESS,
24
+ IS_AWS_LAMBDA,
23
25
  getIsGCPFunction,
24
26
  getIsAzureFunction,
25
27
  } = require('../serverless')
26
28
  const { ORIGIN_KEY, DATADOG_MINI_AGENT_PATH } = require('../constants')
29
+ const { usesOtlpTraceExporter } = require('../exporter')
27
30
  const { appendRules } = require('../payload-tagging/config')
28
31
  const { createSiteUrl } = require('../exporters/common/url')
29
32
  const { getUnsupportedRuntime } = require('../debugger/unsupported-runtime')
@@ -377,6 +380,13 @@ class Config extends ConfigBase {
377
380
  #applyCalculated () {
378
381
  undo(this, 'calculated')
379
382
 
383
+ if (this.isCiVisibility) {
384
+ setAndTrack(this, 'appsec.DD_APPSEC_ENABLED', false)
385
+ setAndTrack(this, 'iast.DD_IAST_ENABLED', false)
386
+ setAndTrack(this, 'llmobs.DD_LLMOBS_ENABLED', false)
387
+ setAndTrack(this, 'aiguard.DD_AI_GUARD_ENABLED', false)
388
+ }
389
+
380
390
  if (this.featureFlags.DD_FEATURE_FLAGS_ENABLED &&
381
391
  !trackedConfigOrigins.has('featureFlags.DD_FEATURE_FLAGS_CONFIGURATION_SOURCE') &&
382
392
  trackedConfigOrigins.has('featureFlags.DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED')) {
@@ -428,10 +438,8 @@ class Config extends ConfigBase {
428
438
  setAndTrack(this, 'DD_METRICS_OTEL_ENABLED', false)
429
439
  }
430
440
 
431
- if (this.OTEL_TRACES_EXPORTER === 'otlp' && trackedConfigOrigins.has('protocolVersion')) {
432
- log.warn('DD_TRACE_AGENT_PROTOCOL_VERSION is set, disabling OTLP traces export')
433
- setAndTrack(this, 'OTEL_TRACES_EXPORTER', 'none')
434
- }
441
+ const agentlessTracingEnabled = this.DD_AGENTLESS_ENABLED ||
442
+ isTrue(getEnvironmentVariable('_DD_APM_TRACING_AGENTLESS_ENABLED'))
435
443
 
436
444
  if (this.telemetry.DD_TELEMETRY_HEARTBEAT_INTERVAL) {
437
445
  setAndTrack(this, 'telemetry.DD_TELEMETRY_HEARTBEAT_INTERVAL',
@@ -451,8 +459,15 @@ class Config extends ConfigBase {
451
459
  setAndTrack(this, 'DD_TRACE_RESOURCE_RENAMING_ENABLED', this.appsec.DD_APPSEC_ENABLED ?? false)
452
460
  }
453
461
 
454
- if (!trackedConfigOrigins.has('spanComputePeerService') && this.spanAttributeSchema !== 'v0') {
455
- setAndTrack(this, 'spanComputePeerService', true)
462
+ // Enable the thread context writer when appsec is enabled and only
463
+ // if DD_TRACE_OTEL_CTX_ENABLED is not explicitly set. The writer is started once
464
+ // at init, so appsec enabled later through remote config does not start it.
465
+ // Serverless functions and Vercel are left out: the eBPF reader cannot run there.
466
+ if (!trackedConfigOrigins.has('DD_TRACE_OTEL_CTX_ENABLED') &&
467
+ this.appsec.DD_APPSEC_ENABLED &&
468
+ !IS_SERVERLESS &&
469
+ !getServerlessPlatform().isVercel) {
470
+ setAndTrack(this, 'DD_TRACE_OTEL_CTX_ENABLED', true)
456
471
  }
457
472
 
458
473
  if (!this.apmTracingEnabled) {
@@ -479,10 +494,15 @@ class Config extends ConfigBase {
479
494
  setAndTrack(this, 'tracePropagationStyle.extract', this.tracePropagationStyle.extract)
480
495
  }
481
496
 
482
- if (getEnvironmentVariable('AWS_LAMBDA_FUNCTION_NAME') && !fs.existsSync(DATADOG_MINI_AGENT_PATH)) {
497
+ if (IS_AWS_LAMBDA && !fs.existsSync(DATADOG_MINI_AGENT_PATH)) {
483
498
  setAndTrack(this, 'flushInterval', 0)
484
499
  }
485
500
 
501
+ if (!trackedConfigOrigins.has('lambda.DD_LAMBDA_FIPS_MODE') &&
502
+ getEnvironmentVariable('AWS_REGION')?.startsWith('us-gov-')) {
503
+ setAndTrack(this, 'lambda.DD_LAMBDA_FIPS_MODE', true)
504
+ }
505
+
486
506
  if (!trackedConfigOrigins.has('apmTracingEnabled') &&
487
507
  trackedConfigOrigins.has('appsec.DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED')) {
488
508
  setAndTrack(this, 'apmTracingEnabled', !this.appsec.DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED)
@@ -503,23 +523,6 @@ class Config extends ConfigBase {
503
523
  setAndTrack(this, 'runtimeMetrics.enabled', false)
504
524
  }
505
525
 
506
- const agentlessTracingEnabled = this.DD_AGENTLESS_ENABLED ||
507
- isTrue(getEnvironmentVariable('_DD_APM_TRACING_AGENTLESS_ENABLED'))
508
-
509
- // Apply the OTel sampler when the user opted into OTel traces or explicitly set the sampler.
510
- // OTEL_TRACES_SAMPLER has `default: parentbased_always_on` (per OTel spec), so opt-in users
511
- // that don't set the sampler still get parent-based sampling. Electron exporter spans go over
512
- // the Electron SDK's IPC bridge rather than OTLP (see opentracing/tracer.js), so an
513
- // OTEL_TRACES_EXPORTER=otlp set for an unrelated telemetry pipeline shouldn't also override
514
- // dd-trace's own sampling policy in that case.
515
- if (!trackedConfigOrigins.has('sampleRate') &&
516
- (trackedConfigOrigins.has('OTEL_TRACES_SAMPLER') ||
517
- (this.OTEL_TRACES_EXPORTER === 'otlp' &&
518
- this.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER !== 'electron'))) {
519
- setAndTrack(this, 'sampleRate',
520
- getFromOtelSamplerMap(this.OTEL_TRACES_SAMPLER, this.OTEL_TRACES_SAMPLER_ARG))
521
- }
522
-
523
526
  if (this.DD_SPAN_SAMPLING_RULES_FILE) {
524
527
  try {
525
528
  // TODO: Should we log a warning in case this is defined next to spanSamplingRules?
@@ -529,16 +532,9 @@ class Config extends ConfigBase {
529
532
  }
530
533
  }
531
534
 
532
- // All sampler options are tracked as individual values. No need to track the sampler object as a whole.
533
- this.sampler = {
534
- rules: this.samplingRules,
535
- rateLimit: this.rateLimit,
536
- sampleRate: this.sampleRate,
537
- spanSamplingRules: this.spanSamplingRules,
538
- }
539
-
540
535
  // For LLMObs, we want to auto enable it when other llmobs options are defined.
541
- if (!this.llmobs.DD_LLMOBS_ENABLED &&
536
+ if (!this.isCiVisibility &&
537
+ !this.llmobs.DD_LLMOBS_ENABLED &&
542
538
  !trackedConfigOrigins.has('llmobs.DD_LLMOBS_ENABLED') &&
543
539
  (trackedConfigOrigins.has('llmobs.DD_LLMOBS_AGENTLESS_ENABLED') ||
544
540
  trackedConfigOrigins.has('llmobs.DD_LLMOBS_ML_APP') ||
@@ -546,6 +542,14 @@ class Config extends ConfigBase {
546
542
  setAndTrack(this, 'llmobs.DD_LLMOBS_ENABLED', true)
547
543
  }
548
544
 
545
+ if (this.llmobs.DD_LLMOBS_ENABLED) {
546
+ // LLMObs payloads use APM structured metadata, which is only supported by protocol v0.4.
547
+ if (this.protocolVersion !== '0.4') {
548
+ log.warn('LLM Observability requires protocol version 0.4 - overriding choice of %s', this.protocolVersion)
549
+ }
550
+ setAndTrack(this, 'protocolVersion', '0.4')
551
+ }
552
+
549
553
  if (this.OTEL_RESOURCE_ATTRIBUTES) {
550
554
  for (const [key, value] of Object.entries(this.OTEL_RESOURCE_ATTRIBUTES)) {
551
555
  // Not replacing existing tags keeps the order of the tags as before.
@@ -688,10 +692,6 @@ class Config extends ConfigBase {
688
692
  setAndTrack(this, 'stats.DD_TRACE_STATS_COMPUTATION_ENABLED', false)
689
693
  // Enable hostname reporting
690
694
  setAndTrack(this, 'reportHostname', true)
691
- // Disable rate limiting - server-side sampling will be used
692
- setAndTrack(this, 'sampler.rateLimit', -1)
693
- // Clear sampling rules - server-side sampling handles this
694
- setAndTrack(this, 'sampler.rules', [])
695
695
  // Agentless intake only accepts 64-bit trace IDs; disable 128-bit generation
696
696
  if (!trackedConfigOrigins.has('traceId128BitGenerationEnabled')) {
697
697
  setAndTrack(this, 'traceId128BitGenerationEnabled', false)
@@ -711,6 +711,75 @@ class Config extends ConfigBase {
711
711
  }
712
712
  }
713
713
 
714
+ if (this.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
715
+ let warning
716
+
717
+ if (this.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER === exporters.ELECTRON) {
718
+ warning = 'DD_TRACE_EXPERIMENTAL_EXPORTER=electron is incompatible with DD_TRACE_OTEL_SEMANTICS_ENABLED. ' +
719
+ 'DD_TRACE_OTEL_SEMANTICS_ENABLED deactivated'
720
+ } else if (this.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER === exporters.AGENTLESS) {
721
+ warning = 'Agentless tracing is incompatible with DD_TRACE_OTEL_SEMANTICS_ENABLED. ' +
722
+ 'DD_TRACE_OTEL_SEMANTICS_ENABLED deactivated'
723
+ } else if (this.isCiVisibility) {
724
+ warning = 'Test Optimization is incompatible with DD_TRACE_OTEL_SEMANTICS_ENABLED. ' +
725
+ 'Deactivating DD_TRACE_OTEL_SEMANTICS_ENABLED'
726
+ } else if (this.OTEL_TRACES_EXPORTER === 'none') {
727
+ warning = 'DD_TRACE_OTEL_SEMANTICS_ENABLED is deactivated due to OTEL_TRACES_EXPORTER set to "none"'
728
+ }
729
+
730
+ if (warning) {
731
+ log.warn(warning)
732
+ setAndTrack(this, 'DD_TRACE_OTEL_SEMANTICS_ENABLED', false)
733
+ } else {
734
+ setAndTrack(this, 'OTEL_TRACES_EXPORTER', 'otlp')
735
+ }
736
+ }
737
+
738
+ if (this.OTEL_TRACES_EXPORTER === 'otlp' && trackedConfigOrigins.has('protocolVersion')) {
739
+ log.warn('DD_TRACE_AGENT_PROTOCOL_VERSION is set, disabling OTLP traces export')
740
+ setAndTrack(this, 'OTEL_TRACES_EXPORTER', 'none')
741
+ if (this.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
742
+ setAndTrack(this, 'DD_TRACE_OTEL_SEMANTICS_ENABLED', false)
743
+ }
744
+ }
745
+
746
+ if (this.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
747
+ if (this.spanAttributeSchema !== 'v0') {
748
+ log.warn('DD_TRACE_OTEL_SEMANTICS_ENABLED requires DD_TRACE_SPAN_ATTRIBUTE_SCHEMA to be "v0". Resetting')
749
+ }
750
+ if (this.spanComputePeerService) {
751
+ log.warn(
752
+ 'DD_TRACE_OTEL_SEMANTICS_ENABLED requires DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED to be false. Resetting'
753
+ )
754
+ }
755
+ setAndTrack(this, 'spanAttributeSchema', 'v0')
756
+ setAndTrack(this, 'spanComputePeerService', false)
757
+ } else if (!trackedConfigOrigins.has('spanComputePeerService') && this.spanAttributeSchema !== 'v0') {
758
+ setAndTrack(this, 'spanComputePeerService', true)
759
+ }
760
+
761
+ // An explicit OTel sampler also applies to native trace exporters.
762
+ if (!trackedConfigOrigins.has('sampleRate') &&
763
+ (trackedConfigOrigins.has('OTEL_TRACES_SAMPLER') || usesOtlpTraceExporter(this))) {
764
+ setAndTrack(this, 'sampleRate',
765
+ getFromOtelSamplerMap(this.OTEL_TRACES_SAMPLER, this.OTEL_TRACES_SAMPLER_ARG))
766
+ }
767
+
768
+ // All sampler options are tracked as individual values. No need to track the sampler object as a whole.
769
+ this.sampler = {
770
+ rules: this.samplingRules,
771
+ rateLimit: this.rateLimit,
772
+ sampleRate: this.sampleRate,
773
+ spanSamplingRules: this.spanSamplingRules,
774
+ }
775
+
776
+ if (agentlessTracingEnabled && !this.isCiVisibility) {
777
+ // Disable rate limiting - server-side sampling will be used
778
+ setAndTrack(this, 'sampler.rateLimit', -1)
779
+ // Clear sampling rules - server-side sampling handles this
780
+ setAndTrack(this, 'sampler.rules', [])
781
+ }
782
+
714
783
  // TODO: This could likely be moved to the base class and allow easier GRPC handling
715
784
  // Default OTLP endpoints follow the configured agent host so users who point DD at a custom
716
785
  // agent (DD_AGENT_HOST / DD_TRACE_AGENT_URL) also reach OTLP on that host. In agentless mode
@@ -742,11 +811,10 @@ class Config extends ConfigBase {
742
811
  assignOtlpHeaderApiKey('OTEL_EXPORTER_OTLP_TRACES_HEADERS')
743
812
  }
744
813
 
745
- const autoTraceMetrics = this.OTEL_TRACES_EXPORTER === 'otlp' && this.DD_METRICS_OTEL_ENABLED === true
746
- setAndTrack(this, 'OTEL_TRACES_SPAN_METRICS_ENABLED', this.OTEL_TRACES_SPAN_METRICS_ENABLED ?? autoTraceMetrics)
814
+ setAndTrack(this, 'OTEL_TRACES_SPAN_METRICS_ENABLED', this.OTEL_TRACES_SPAN_METRICS_ENABLED ?? false)
747
815
 
748
- if (this.OTEL_TRACES_SPAN_METRICS_ENABLED) {
749
- this.stats = { ...this.stats, DD_TRACE_STATS_COMPUTATION_ENABLED: true }
816
+ if (usesOtlpTraceExporter(this) || this.OTEL_TRACES_SPAN_METRICS_ENABLED) {
817
+ setAndTrack(this, 'stats.DD_TRACE_STATS_COMPUTATION_ENABLED', this.OTEL_TRACES_SPAN_METRICS_ENABLED)
750
818
  }
751
819
 
752
820
  const flushInterval = getValueFromEnvSources('_DD_TRACE_METRICS_OTEL_FLUSH_INTERVAL')
@@ -856,7 +924,7 @@ function getFromOtelSamplerMap (otelTracesSampler, otelTracesSamplerArg) {
856
924
  function warnWrongOtelSettings () {
857
925
  // This mostly works for non-aliased environment variables only.
858
926
  // TODO: Adjust this to work across all sources.
859
- for (const [otelEnvVar, ddEnvVar, key] of [
927
+ for (const [otelEnvVar, ddEnvVar, key = otelEnvVar] of [
860
928
  // eslint-disable-next-line eslint-rules/eslint-env-aliases
861
929
  ['OTEL_LOG_LEVEL', 'DD_TRACE_LOG_LEVEL', 'logLevel'],
862
930
  // eslint-disable-next-line eslint-rules/eslint-env-aliases
@@ -873,7 +941,7 @@ function warnWrongOtelSettings () {
873
941
  ]) {
874
942
  // eslint-disable-next-line eslint-rules/eslint-process-env
875
943
  const envs = process.env
876
- const otelSource = trackedConfigOrigins.get(/** @type {ConfigPath} */ (key ?? otelEnvVar))
944
+ const otelSource = trackedConfigOrigins.get(/** @type {ConfigPath} */ (key))
877
945
  const otelEnvValue = envs[otelEnvVar]
878
946
  if (otelEnvValue) {
879
947
  if (envs[ddEnvVar]) {
@@ -334,7 +334,15 @@ const parsers = {
334
334
  // DD_TAGS is a special case. It may be a map of key-value pairs separated by spaces.
335
335
  raw = raw.replaceAll(/\s+/g, ',')
336
336
  }
337
- tagger.add(entries, raw, valueSeparator)
337
+ if (valueSeparator === '=' && raw.includes('%')) {
338
+ try {
339
+ tagger.add(entries, raw, valueSeparator, true)
340
+ } catch {
341
+ return
342
+ }
343
+ } else {
344
+ tagger.add(entries, raw, valueSeparator)
345
+ }
338
346
  return entries
339
347
  },
340
348
  JSON (raw) {
@@ -429,9 +437,18 @@ const programmaticTypeCoercions = {
429
437
  return value
430
438
  }
431
439
  },
440
+ /**
441
+ * Keeps any value as given, for an option that its consumer validates.
442
+ *
443
+ * @param {unknown} value
444
+ */
445
+ PASSTHROUGH (value) {
446
+ return value
447
+ },
432
448
  }
433
449
 
434
450
  module.exports = {
451
+ VALID_PROPAGATION_STYLES,
435
452
  parsers,
436
453
  programmaticTypeCoercions,
437
454
  transformers,
@@ -32,6 +32,138 @@
32
32
  "description": "Override the automatic log submission intake URL."
33
33
  }
34
34
  ],
35
+ "DD_API_KEY_SECRET_ARN": [
36
+ {
37
+ "implementation": "A",
38
+ "type": "string",
39
+ "namespace": "lambda",
40
+ "default": null,
41
+ "sensitive": true
42
+ }
43
+ ],
44
+ "DD_CAPTURE_LAMBDA_PAYLOAD": [
45
+ {
46
+ "implementation": "B",
47
+ "type": "boolean",
48
+ "namespace": "lambda",
49
+ "default": "false"
50
+ }
51
+ ],
52
+ "DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH": [
53
+ {
54
+ "implementation": "B",
55
+ "type": "int",
56
+ "namespace": "lambda",
57
+ "default": "10",
58
+ "allowed": "\\d+"
59
+ }
60
+ ],
61
+ "DD_COLD_START_TRACE_SKIP_LIB": [
62
+ {
63
+ "implementation": "B",
64
+ "type": "string",
65
+ "namespace": "lambda",
66
+ "default": "./opentracing/tracer"
67
+ }
68
+ ],
69
+ "DD_COLD_START_TRACING": [
70
+ {
71
+ "implementation": "B",
72
+ "type": "boolean",
73
+ "namespace": "lambda",
74
+ "default": "true"
75
+ }
76
+ ],
77
+ "DD_DECODE_AUTHORIZER_CONTEXT": [
78
+ {
79
+ "implementation": "B",
80
+ "type": "boolean",
81
+ "namespace": "lambda",
82
+ "default": "true"
83
+ }
84
+ ],
85
+ "DD_ENCODE_AUTHORIZER_CONTEXT": [
86
+ {
87
+ "implementation": "B",
88
+ "type": "boolean",
89
+ "namespace": "lambda",
90
+ "default": "true"
91
+ }
92
+ ],
93
+ "DD_ENHANCED_METRICS": [
94
+ {
95
+ "implementation": "B",
96
+ "type": "boolean",
97
+ "namespace": "lambda",
98
+ "default": "true"
99
+ }
100
+ ],
101
+ "DD_FLUSH_TO_LOG": [
102
+ {
103
+ "implementation": "B",
104
+ "type": "boolean",
105
+ "namespace": "lambda",
106
+ "default": "false"
107
+ }
108
+ ],
109
+ "DD_KMS_API_KEY": [
110
+ {
111
+ "implementation": "A",
112
+ "type": "string",
113
+ "namespace": "lambda",
114
+ "default": null,
115
+ "sensitive": true
116
+ }
117
+ ],
118
+ "DD_LAMBDA_FIPS_MODE": [
119
+ {
120
+ "implementation": "B",
121
+ "type": "boolean",
122
+ "namespace": "lambda",
123
+ "default": "false"
124
+ }
125
+ ],
126
+ "DD_MERGE_XRAY_TRACES": [
127
+ {
128
+ "implementation": "B",
129
+ "type": "boolean",
130
+ "namespace": "lambda",
131
+ "default": "false"
132
+ }
133
+ ],
134
+ "DD_MIN_COLD_START_DURATION": [
135
+ {
136
+ "implementation": "B",
137
+ "type": "int",
138
+ "namespace": "lambda",
139
+ "default": "3",
140
+ "allowed": "\\d+"
141
+ }
142
+ ],
143
+ "DD_TRACE_AWS_LAMBDA_ENABLED": [
144
+ {
145
+ "implementation": "B",
146
+ "namespace": "lambda",
147
+ "type": "boolean",
148
+ "default": "true"
149
+ }
150
+ ],
151
+ "DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED": [
152
+ {
153
+ "implementation": "B",
154
+ "type": "boolean",
155
+ "namespace": "lambda",
156
+ "default": "true"
157
+ }
158
+ ],
159
+ "DD_TRACE_MANAGED_SERVICES": [
160
+ {
161
+ "implementation": "B",
162
+ "type": "boolean",
163
+ "namespace": "lambda",
164
+ "default": "true"
165
+ }
166
+ ],
35
167
  "_DD_APM_TRACING_AGENTLESS_ENABLED": [
36
168
  {
37
169
  "implementation": "A",
@@ -143,6 +275,7 @@
143
275
  {
144
276
  "implementation": "A",
145
277
  "type": "string",
278
+ "allowed": ".+",
146
279
  "default": null,
147
280
  "aliases": [
148
281
  "DATADOG_API_KEY"
@@ -497,6 +630,7 @@
497
630
  {
498
631
  "implementation": "A",
499
632
  "type": "string",
633
+ "allowed": ".+",
500
634
  "default": null,
501
635
  "sensitive": true
502
636
  }
@@ -1612,6 +1746,14 @@
1612
1746
  ]
1613
1747
  }
1614
1748
  ],
1749
+ "DD_OPENAI_REALTIME_SIDEBAND_AUDIO_RETRIEVAL_ENABLED": [
1750
+ {
1751
+ "implementation": "A",
1752
+ "type": "boolean",
1753
+ "default": "true",
1754
+ "namespace": "openai"
1755
+ }
1756
+ ],
1615
1757
  "DD_OPENAI_REALTIME_ENABLED": [
1616
1758
  {
1617
1759
  "implementation": "A",
@@ -1644,9 +1786,9 @@
1644
1786
  ],
1645
1787
  "DD_PROFILING_ALLOCATION_ENABLED": [
1646
1788
  {
1647
- "implementation": "B",
1789
+ "implementation": "A",
1648
1790
  "type": "boolean",
1649
- "default": "true"
1791
+ "default": "false"
1650
1792
  }
1651
1793
  ],
1652
1794
  "DD_PROFILING_ASYNC_CONTEXT_FRAME_ENABLED": [
@@ -2326,6 +2468,13 @@
2326
2468
  "default": "true"
2327
2469
  }
2328
2470
  ],
2471
+ "DD_TRACE_ASYNC_MUTEX_ENABLED": [
2472
+ {
2473
+ "implementation": "A",
2474
+ "type": "boolean",
2475
+ "default": "true"
2476
+ }
2477
+ ],
2329
2478
  "DD_TRACE_AVSC_ENABLED": [
2330
2479
  {
2331
2480
  "implementation": "A",
@@ -3229,9 +3378,9 @@
3229
3378
  ],
3230
3379
  "DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": [
3231
3380
  {
3232
- "implementation": "A",
3381
+ "implementation": "D",
3233
3382
  "type": "string",
3234
- "default": "400-499"
3383
+ "default": null
3235
3384
  }
3236
3385
  ],
3237
3386
  "DD_TRACE_HTTP_ENABLED": [
@@ -4017,6 +4166,13 @@
4017
4166
  "default": "true"
4018
4167
  }
4019
4168
  ],
4169
+ "DD_TRACE_REACT_ROUTER_ENABLED": [
4170
+ {
4171
+ "implementation": "A",
4172
+ "type": "boolean",
4173
+ "default": "true"
4174
+ }
4175
+ ],
4020
4176
  "DD_TRACE_REDIS_CLIENT_ENABLED": [
4021
4177
  {
4022
4178
  "implementation": "A",
@@ -4229,6 +4385,20 @@
4229
4385
  "default": "true"
4230
4386
  }
4231
4387
  ],
4388
+ "DD_TRACE_TRPC_ENABLED": [
4389
+ {
4390
+ "implementation": "A",
4391
+ "type": "boolean",
4392
+ "default": "true"
4393
+ }
4394
+ ],
4395
+ "DD_TRACE_TYPESAFE_ENABLED": [
4396
+ {
4397
+ "implementation": "A",
4398
+ "type": "boolean",
4399
+ "default": "true"
4400
+ }
4401
+ ],
4232
4402
  "DD_TRACE_UNDICI_ENABLED": [
4233
4403
  {
4234
4404
  "implementation": "A",
@@ -24,6 +24,7 @@ module.exports = {
24
24
  SVC_SRC_KEY: '_dd.svc_src',
25
25
  SDK_OTLP_EXPORT_KEY: '_dd.sdk.otlp_export',
26
26
  SDK_SEMANTICS_KEY: 'datadog.sdk.semantics',
27
+ TELEMETRY_DISTRIBUTION_RELATIVE_ACCURACY: 1 / 129,
27
28
  DATADOG_LAMBDA_EXTENSION_PATH: '/opt/extensions/datadog-agent',
28
29
  DATADOG_MINI_AGENT_PATH: '/tmp/datadog/mini_agent_ready',
29
30
  DECISION_MAKER_KEY: '_dd.p.dm',
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const { LogCollapsingLowestDenseDDSketch } = require('../../../../vendor/dist/@datadog/sketches-js')
4
+ const { TELEMETRY_DISTRIBUTION_RELATIVE_ACCURACY } = require('../constants')
4
5
 
5
6
  /**
6
7
  * Durations of the pauses caused by probes, shared between the debugger worker thread and the main thread.
@@ -17,7 +18,7 @@ const { LogCollapsingLowestDenseDDSketch } = require('../../../../vendor/dist/@d
17
18
  */
18
19
 
19
20
  // Created the same way as the sketch of telemetry distributions, so both map durations to the same keys
20
- const { mapping } = new LogCollapsingLowestDenseDDSketch()
21
+ const { mapping } = new LogCollapsingLowestDenseDDSketch({ relativeAccuracy: TELEMETRY_DISTRIBUTION_RELATIVE_ACCURACY })
21
22
 
22
23
  const MIN_KEY = mapping.key(0.001) // 1 µs
23
24
  const MAX_KEY = mapping.key(60 * 60 * 1000) // 1 hour
@@ -152,7 +152,7 @@ function installProbeSampler (guardrailMetrics, config) {
152
152
  if (elapsedNs > evaluationTimeoutNs) {
153
153
  return recordConditionError(probeIndex, probeId, now, describeTimeout(elapsedNs), true)
154
154
  }
155
- return matched === true && sample(probeIndex, probeId, now, nsBetweenSampling, isSnapshotProducingProbe)
155
+ return matched && sample(probeIndex, probeId, now, nsBetweenSampling, isSnapshotProducingProbe)
156
156
  },
157
157
 
158
158
  /**
@@ -235,7 +235,7 @@ function installProbeSampler (guardrailMetrics, config) {
235
235
  if (state.timedOut) {
236
236
  guardrailMetrics.eventSkipped(
237
237
  SKIPPED_REASON.EVALUATION_TIMEOUT,
238
- isSnapshotProducingProbe === true ? EVENT_TYPE.SNAPSHOT : EVENT_TYPE.LOG
238
+ isSnapshotProducingProbe ? EVENT_TYPE.SNAPSHOT : EVENT_TYPE.LOG
239
239
  )
240
240
  }
241
241
  return true
@@ -254,7 +254,7 @@ function installProbeSampler (guardrailMetrics, config) {
254
254
  * @param {boolean} isSnapshotProducingProbe - Whether this probe counts toward the global snapshot sample limit.
255
255
  */
256
256
  function sample (probeIndex, probeId, now, nsBetweenSampling, isSnapshotProducingProbe) {
257
- if (isSnapshotProducingProbe === true) {
257
+ if (isSnapshotProducingProbe) {
258
258
  const span = /** @type {ActiveSpan | null | undefined} */ (legacyStorage.getStore()?.span)
259
259
  const trace = span?.context()._trace
260
260
  // The span processor empties `started` once all spans of a trace have finished. A probe hit under such a trace
@@ -320,12 +320,12 @@ function installProbeSampler (guardrailMetrics, config) {
320
320
  if (lastCaptureNs !== undefined && now - lastCaptureNs < nsBetweenSampling) {
321
321
  guardrailMetrics.eventSkipped(
322
322
  SKIPPED_REASON.RATE_LIMIT_PROBE,
323
- isSnapshotProducingProbe === true ? EVENT_TYPE.SNAPSHOT : EVENT_TYPE.LOG
323
+ isSnapshotProducingProbe ? EVENT_TYPE.SNAPSHOT : EVENT_TYPE.LOG
324
324
  )
325
325
  return true
326
326
  }
327
327
 
328
- if (isSnapshotProducingProbe === true &&
328
+ if (isSnapshotProducingProbe &&
329
329
  now - globalSnapshotSamplingRateWindowStart <= oneSecondNs &&
330
330
  snapshotsSampledWithinTheLastSecond >= MAX_SNAPSHOTS_PER_SECOND_GLOBALLY) {
331
331
  guardrailMetrics.eventSkipped(SKIPPED_REASON.RATE_LIMIT_GLOBAL, EVENT_TYPE.SNAPSHOT)
@@ -346,7 +346,7 @@ function installProbeSampler (guardrailMetrics, config) {
346
346
  function commitSample (probeIndex, probeId, now, isSnapshotProducingProbe) {
347
347
  if (!storeSampledProbeIndex(probeIndex)) return false
348
348
 
349
- if (isSnapshotProducingProbe === true) {
349
+ if (isSnapshotProducingProbe) {
350
350
  if (now - globalSnapshotSamplingRateWindowStart > oneSecondNs) {
351
351
  snapshotsSampledWithinTheLastSecond = 1
352
352
  globalSnapshotSamplingRateWindowStart = now
@@ -694,7 +694,7 @@ class AgentEncoder {
694
694
  let count = 0
695
695
  for (const key of Object.keys(value)) {
696
696
  const entryValue = value[key]
697
- if (typeof entryValue === 'string' || typeof entryValue === 'number' ||
697
+ if (typeof entryValue === 'string' || typeof entryValue === 'number' || typeof entryValue === 'boolean' ||
698
698
  (entryValue !== null && typeof entryValue === 'object')) {
699
699
  this._encodeString(bytes, key)
700
700
  this.#encodeObjectAsByteArray(bytes, entryValue)
@@ -768,7 +768,7 @@ class AgentEncoder {
768
768
 
769
769
  let count = 0
770
770
  for (const item of value) {
771
- if (typeof item === 'string' || typeof item === 'number' ||
771
+ if (typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean' ||
772
772
  (item !== null && typeof item === 'object' && !circularReferencesDetector.has(item))) {
773
773
  this.#encodeObject(bytes, item, circularReferencesDetector)
774
774
  count++
@@ -0,0 +1,58 @@
1
+ 'use strict'
2
+
3
+ const { MessageChannel } = require('node:worker_threads')
4
+
5
+ const dc = require('dc-polyfill')
6
+
7
+ const moduleLoadStartChannel = dc.channel('dd-trace:moduleLoadStart')
8
+ const moduleLoadEndChannel = dc.channel('dd-trace:moduleLoadEnd')
9
+
10
+ // The loader reports a package once, possibly before dependency telemetry subscribes (the loader handles
11
+ // the whole graph before an app that starts the tracer itself runs), so late consumers replay these.
12
+ /** @type {string[]} */
13
+ const publishedFilenames = []
14
+
15
+ /**
16
+ * Publishes an ESM module load that the loader observed but did not wrap, so consumers such as
17
+ * dependency telemetry see packages without dd-trace instrumentation too.
18
+ *
19
+ * @param {string} filename Loaded module URL.
20
+ */
21
+ function publishModuleLoad (filename) {
22
+ publishedFilenames.push(filename)
23
+ const payload = { filename }
24
+ if (moduleLoadStartChannel.hasSubscribers) {
25
+ moduleLoadStartChannel.publish(payload)
26
+ }
27
+ // Consumers such as datadog-lambda-js cold start tracing pair every start with an end. The load has
28
+ // already happened, so close it right away.
29
+ if (moduleLoadEndChannel.hasSubscribers) {
30
+ moduleLoadEndChannel.publish(payload)
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Returns the ESM module loads published so far, one per package.
36
+ *
37
+ * @returns {string[]}
38
+ */
39
+ function getPublishedModuleLoads () {
40
+ return publishedFilenames
41
+ }
42
+
43
+ /**
44
+ * Builds the `module.register` options that hand the asynchronous loader thread a port to report
45
+ * unwrapped module loads back to the application thread.
46
+ *
47
+ * @returns {{ data: { moduleLoadPort: import('node:worker_threads').MessagePort },
48
+ * transferList: import('node:worker_threads').MessagePort[] }}
49
+ */
50
+ function getLoaderRegisterOptions () {
51
+ const { port1, port2 } = new MessageChannel()
52
+ port1.on('message', publishModuleLoad)
53
+ // The loader thread outlives short-lived applications; never keep them running.
54
+ port1.unref?.()
55
+ return { data: { moduleLoadPort: port2 }, transferList: [port2] }
56
+ }
57
+
58
+ module.exports = { getLoaderRegisterOptions, getPublishedModuleLoads, publishModuleLoad }