dd-trace 6.24.0 → 6.26.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 (352) hide show
  1. package/README.md +3 -0
  2. package/ci/cypress/support.js +2 -1
  3. package/ci/init.js +2 -22
  4. package/ci/vitest-no-worker-init-node-setup.mjs +2 -1
  5. package/ci/vitest-no-worker-init-runner-setup.mjs +2 -1
  6. package/ci/vitest-no-worker-init-setup.mjs +729 -724
  7. package/ci/vitest-no-worker-init-v5-setup.mjs +2 -1
  8. package/ext/exporters.js +0 -1
  9. package/index.d.ts +105 -5
  10. package/initialize.mjs +5 -2
  11. package/package.json +41 -36
  12. package/packages/datadog-esbuild/index.js +16 -70
  13. package/packages/datadog-esbuild/src/log.js +2 -29
  14. package/packages/datadog-instrumentations/src/ai.js +6 -1
  15. package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
  16. package/packages/datadog-instrumentations/src/cucumber.js +5 -2
  17. package/packages/datadog-instrumentations/src/cypress-config.js +20 -9
  18. package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
  19. package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
  20. package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
  21. package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
  22. package/packages/datadog-instrumentations/src/graphql.js +20 -17
  23. package/packages/datadog-instrumentations/src/helpers/bundler-esm-exports.js +582 -0
  24. package/packages/datadog-instrumentations/src/helpers/bundler-log.js +38 -0
  25. package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +576 -0
  26. package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
  27. package/packages/datadog-instrumentations/src/helpers/fetch.js +51 -6
  28. package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
  29. package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -7
  30. package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
  31. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +8 -0
  32. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +26 -1
  33. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
  34. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
  35. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
  36. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-client.js +30 -0
  37. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-server.js +23 -0
  38. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +61 -0
  39. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
  40. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +33 -4
  41. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
  42. package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +80 -0
  43. package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +23 -3
  44. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +122 -0
  45. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
  46. package/packages/datadog-instrumentations/src/ioredis.js +101 -3
  47. package/packages/datadog-instrumentations/src/microgateway-core.js +1 -2
  48. package/packages/datadog-instrumentations/src/modelcontextprotocol-client.js +21 -0
  49. package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +7 -1
  50. package/packages/datadog-instrumentations/src/modelcontextprotocol-server.js +41 -0
  51. package/packages/datadog-instrumentations/src/next.js +203 -26
  52. package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
  53. package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
  54. package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
  55. package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
  56. package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
  57. package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
  58. package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
  59. package/packages/datadog-instrumentations/src/router.js +35 -12
  60. package/packages/datadog-instrumentations/src/vitest-main.js +10 -2
  61. package/packages/datadog-instrumentations/src/webdriverio.js +12 -12
  62. package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
  63. package/packages/datadog-plugin-aws-lambda/src/arn.js +41 -0
  64. package/packages/datadog-plugin-aws-lambda/src/event-type-guards.js +170 -0
  65. package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
  66. package/packages/datadog-plugin-aws-lambda/src/trigger.js +339 -0
  67. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +7 -0
  68. package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +32 -10
  69. package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +10 -1
  70. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +4 -0
  71. package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +3 -0
  72. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +50 -13
  73. package/packages/datadog-plugin-cypress/src/support.mjs +1353 -0
  74. package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
  75. package/packages/datadog-plugin-express/src/code_origin.js +2 -2
  76. package/packages/datadog-plugin-fastify/src/code_origin.js +2 -2
  77. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +20 -7
  78. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +21 -52
  79. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +11 -2
  80. package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
  81. package/packages/datadog-plugin-google-cloud-pubsub/src/resource-names.js +24 -0
  82. package/packages/datadog-plugin-graphql/src/tools/transforms.js +1 -0
  83. package/packages/datadog-plugin-http/src/client.js +34 -10
  84. package/packages/datadog-plugin-http2/src/client.js +40 -14
  85. package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +28 -2
  86. package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +1 -0
  87. package/packages/datadog-plugin-mongodb-core/src/query.js +17 -1
  88. package/packages/datadog-plugin-next/src/index.js +112 -14
  89. package/packages/datadog-plugin-postgres/src/index.js +118 -41
  90. package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
  91. package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +18 -8
  92. package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +49 -13
  93. package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +34 -9
  94. package/packages/datadog-plugin-trpc/src/index.js +15 -0
  95. package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
  96. package/packages/datadog-plugin-trpc/src/request.js +81 -0
  97. package/packages/datadog-plugin-undici/src/index.js +22 -7
  98. package/packages/datadog-plugin-vitest/src/index.js +3 -2
  99. package/packages/datadog-plugin-ws/src/close.js +3 -5
  100. package/packages/datadog-plugin-ws/src/producer.js +1 -4
  101. package/packages/datadog-plugin-ws/src/receiver.js +3 -5
  102. package/packages/datadog-plugin-ws/src/server.js +44 -13
  103. package/packages/datadog-turbopack/index.js +4 -28
  104. package/packages/datadog-turbopack/src/loader.js +14 -452
  105. package/packages/datadog-vite/index.js +537 -0
  106. package/packages/datadog-vite/src/log.js +5 -0
  107. package/packages/datadog-webpack/index.js +3 -55
  108. package/packages/datadog-webpack/src/log.js +2 -29
  109. package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
  110. package/packages/dd-trace/src/aiguard/index.js +1 -1
  111. package/packages/dd-trace/src/aiguard/integrations/index.js +6 -5
  112. package/packages/dd-trace/src/aiguard/sdk.js +8 -2
  113. package/packages/dd-trace/src/aiguard/tags.js +2 -0
  114. package/packages/dd-trace/src/appsec/blocking/index.js +21 -1
  115. package/packages/dd-trace/src/appsec/channels.js +7 -0
  116. package/packages/dd-trace/src/appsec/downstream_requests.js +105 -0
  117. package/packages/dd-trace/src/appsec/graphql.js +89 -7
  118. package/packages/dd-trace/src/appsec/handlers/auth.js +1 -3
  119. package/packages/dd-trace/src/appsec/handlers/http-request.js +60 -65
  120. package/packages/dd-trace/src/appsec/handlers/http-response.js +61 -7
  121. package/packages/dd-trace/src/appsec/handlers/payments.js +23 -27
  122. package/packages/dd-trace/src/appsec/index.js +6 -0
  123. package/packages/dd-trace/src/appsec/lambda.js +17 -17
  124. package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -4
  125. package/packages/dd-trace/src/appsec/rasp/index.js +8 -1
  126. package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -2
  127. package/packages/dd-trace/src/appsec/rasp/sql_injection.js +7 -17
  128. package/packages/dd-trace/src/appsec/rasp/ssrf.js +80 -16
  129. package/packages/dd-trace/src/appsec/rasp/utils.js +33 -3
  130. package/packages/dd-trace/src/appsec/recommended.json +1358 -94
  131. package/packages/dd-trace/src/appsec/reporter.js +9 -0
  132. package/packages/dd-trace/src/appsec/sdk/set_user.js +3 -3
  133. package/packages/dd-trace/src/appsec/sdk/track_event.js +4 -4
  134. package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -1
  135. package/packages/dd-trace/src/appsec/user_tracking.js +6 -8
  136. package/packages/dd-trace/src/appsec/waf/index.js +65 -6
  137. package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +33 -38
  138. package/packages/dd-trace/src/appsec/waf/waf_manager.js +18 -2
  139. package/packages/dd-trace/src/before-exit.js +32 -0
  140. package/packages/dd-trace/src/bootstrap.js +5 -3
  141. package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +15 -2
  142. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +12 -34
  143. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
  144. package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
  145. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +1 -2
  146. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +1 -1
  147. package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
  148. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +1 -1
  149. package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
  150. package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
  151. package/packages/dd-trace/src/config/config-types.d.ts +3 -0
  152. package/packages/dd-trace/src/config/defaults.js +5 -0
  153. package/packages/dd-trace/src/config/generated-config-types.d.ts +46 -4
  154. package/packages/dd-trace/src/config/index.js +63 -31
  155. package/packages/dd-trace/src/config/parsers.js +44 -0
  156. package/packages/dd-trace/src/config/remote-config-layers.js +38 -0
  157. package/packages/dd-trace/src/config/remote_config.js +2 -1
  158. package/packages/dd-trace/src/config/supported-configurations.json +172 -10
  159. package/packages/dd-trace/src/constants.js +1 -0
  160. package/packages/dd-trace/src/datastreams/fnv.js +27 -0
  161. package/packages/dd-trace/src/datastreams/pathway.js +113 -28
  162. package/packages/dd-trace/src/datastreams/processor.js +5 -4
  163. package/packages/dd-trace/src/debugger/config.js +1 -1
  164. package/packages/dd-trace/src/debugger/devtools_client/request-options.js +7 -9
  165. package/packages/dd-trace/src/debugger/devtools_client/send.js +1 -1
  166. package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
  167. package/packages/dd-trace/src/debugger/devtools_client/tags.js +1 -1
  168. package/packages/dd-trace/src/debugger/index.js +2 -2
  169. package/packages/dd-trace/src/debugger/inspect-segment.js +3 -2
  170. package/packages/dd-trace/src/debugger/pause-duration-histogram.js +6 -2
  171. package/packages/dd-trace/src/debugger/probe_sampler.js +39 -17
  172. package/packages/dd-trace/src/debugger/unsupported-runtime.js +2 -0
  173. package/packages/dd-trace/src/exporter.js +0 -11
  174. package/packages/dd-trace/src/exporters/common/request.js +81 -48
  175. package/packages/dd-trace/src/exporters/common/retry.js +12 -7
  176. package/packages/dd-trace/src/exporters/common/url.js +1 -1
  177. package/packages/dd-trace/src/git_metadata.js +2 -1
  178. package/packages/dd-trace/src/id.js +1 -1
  179. package/packages/dd-trace/src/index.js +6 -3
  180. package/packages/dd-trace/src/lambda/facade.js +75 -0
  181. package/packages/dd-trace/src/lambda/handler.js +3 -41
  182. package/packages/dd-trace/src/lambda/index.js +38 -15
  183. package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
  184. package/packages/dd-trace/src/lambda/wrap.js +44 -0
  185. package/packages/dd-trace/src/llmobs/constants/tags.js +2 -0
  186. package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
  187. package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
  188. package/packages/dd-trace/src/llmobs/plugins/genai/util.js +19 -6
  189. package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +54 -3
  190. package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +81 -1
  191. package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
  192. package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
  193. package/packages/dd-trace/src/llmobs/sdk.js +19 -0
  194. package/packages/dd-trace/src/llmobs/span_processor.js +9 -0
  195. package/packages/dd-trace/src/llmobs/tagger.js +22 -0
  196. package/packages/dd-trace/src/log/channels.js +4 -0
  197. package/packages/dd-trace/src/log/writer.js +6 -1
  198. package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +7 -0
  199. package/packages/dd-trace/src/openfeature/configuration_source.js +55 -27
  200. package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
  201. package/packages/dd-trace/src/openfeature/flagging_provider.js +19 -1
  202. package/packages/dd-trace/src/openfeature/writers/base.js +1 -3
  203. package/packages/dd-trace/src/opentelemetry/logs/index.js +11 -0
  204. package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
  205. package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
  206. package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
  207. package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
  208. package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
  209. package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
  210. package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
  211. package/packages/dd-trace/src/opentelemetry/span.js +2 -2
  212. package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
  213. package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
  214. package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
  215. package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
  216. package/packages/dd-trace/src/opentracing/tracer.js +24 -0
  217. package/packages/dd-trace/src/otel-thread-ctx.js +28 -31
  218. package/packages/dd-trace/src/plugin_manager.js +34 -7
  219. package/packages/dd-trace/src/plugins/ci_plugin.js +143 -17
  220. package/packages/dd-trace/src/plugins/index.js +8 -0
  221. package/packages/dd-trace/src/plugins/plugin.js +4 -2
  222. package/packages/dd-trace/src/plugins/tracing.js +1 -1
  223. package/packages/dd-trace/src/plugins/util/ci.js +52 -1
  224. package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
  225. package/packages/dd-trace/src/plugins/util/git.js +263 -82
  226. package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +80 -56
  227. package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
  228. package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
  229. package/packages/dd-trace/src/plugins/util/tags.js +6 -0
  230. package/packages/dd-trace/src/plugins/util/test.js +92 -40
  231. package/packages/dd-trace/src/plugins/util/url.js +18 -7
  232. package/packages/dd-trace/src/plugins/util/user-provided-git.js +6 -6
  233. package/packages/dd-trace/src/plugins/util/web.js +65 -10
  234. package/packages/dd-trace/src/process-tags/index.js +1 -1
  235. package/packages/dd-trace/src/profiler.js +74 -12
  236. package/packages/dd-trace/src/profiling/profiler.js +30 -2
  237. package/packages/dd-trace/src/profiling/profilers/space.js +3 -1
  238. package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
  239. package/packages/dd-trace/src/profiling/remote-config.js +354 -0
  240. package/packages/dd-trace/src/profiling/runtime-capabilities.js +11 -0
  241. package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
  242. package/packages/dd-trace/src/propagation-hash/index.js +7 -0
  243. package/packages/dd-trace/src/proxy.js +46 -54
  244. package/packages/dd-trace/src/span_processor.js +20 -0
  245. package/packages/dd-trace/src/startup-log.js +8 -6
  246. package/packages/dd-trace/src/telemetry/metrics.js +2 -1
  247. package/packages/dd-trace/src/tracer.js +0 -2
  248. package/packages/dd-trace/src/web-tags-cache.js +8 -9
  249. package/register.js +2 -1
  250. package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
  251. package/vendor/dist/@datadog/flagging-core/LICENSE +221 -0
  252. package/vendor/dist/@datadog/flagging-core/index.js +1 -0
  253. package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
  254. package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
  255. package/vendor/dist/@datadog/sketches-js/LICENSE +263 -0
  256. package/vendor/dist/@datadog/source-map/LICENSE +1 -0
  257. package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
  258. package/vendor/dist/@opentelemetry/core/LICENSE +220 -1
  259. package/vendor/dist/@opentelemetry/core/index.js +1 -1
  260. package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
  261. package/vendor/dist/escape-string-regexp/LICENSE +13 -0
  262. package/vendor/dist/esquery/LICENSE +2 -0
  263. package/vendor/dist/https-proxy-agent/LICENSE +80 -1
  264. package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
  265. package/vendor/dist/jest-docblock/LICENSE +16 -0
  266. package/vendor/dist/jsonpath-plus/LICENSE +13 -0
  267. package/vendor/dist/limiter/LICENSE +2 -0
  268. package/vendor/dist/lodash.sortby/LICENSE +2 -0
  269. package/vendor/dist/lru-cache/LICENSE +13 -0
  270. package/vendor/dist/meriyah/LICENSE +13 -0
  271. package/vendor/dist/module-details-from-path/LICENSE +2 -0
  272. package/vendor/dist/mutexify/promise/LICENSE +28 -0
  273. package/vendor/dist/pprof-format/LICENSE +13 -0
  274. package/vendor/dist/pprof-format/index.js +1 -1
  275. package/vendor/dist/protobufjs/LICENSE +219 -0
  276. package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
  277. package/vendor/dist/proxy-from-env/LICENSE +13 -0
  278. package/vendor/dist/retry/LICENSE +2 -0
  279. package/vendor/dist/rfdc/LICENSE +2 -0
  280. package/vendor/dist/semifies/LICENSE +3 -1
  281. package/vendor/dist/shell-quote/LICENSE +3 -1
  282. package/vendor/dist/source-map/LICENSE +1 -0
  283. package/vendor/dist/source-map/lib/util/LICENSE +1 -0
  284. package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
  285. package/vendor/dist/ttl-set/LICENSE +28 -0
  286. package/vite.d.ts +7 -0
  287. package/vite.js +3 -0
  288. package/ci/diagnose.js +0 -2215
  289. package/ci/runbook.md +0 -299
  290. package/ci/test-optimization-validation/approval-artifacts.js +0 -175
  291. package/ci/test-optimization-validation/approval.js +0 -386
  292. package/ci/test-optimization-validation/artifact-id.js +0 -18
  293. package/ci/test-optimization-validation/blocker-category.js +0 -24
  294. package/ci/test-optimization-validation/bounded-json.js +0 -120
  295. package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
  296. package/ci/test-optimization-validation/ci-discovery.js +0 -192
  297. package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
  298. package/ci/test-optimization-validation/ci-remediation.js +0 -283
  299. package/ci/test-optimization-validation/cli.js +0 -954
  300. package/ci/test-optimization-validation/command-blocker.js +0 -377
  301. package/ci/test-optimization-validation/command-output-policy.js +0 -188
  302. package/ci/test-optimization-validation/command-runner.js +0 -649
  303. package/ci/test-optimization-validation/environment.js +0 -88
  304. package/ci/test-optimization-validation/executable-approval.js +0 -47
  305. package/ci/test-optimization-validation/executable.js +0 -244
  306. package/ci/test-optimization-validation/execution-lock.js +0 -70
  307. package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
  308. package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
  309. package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
  310. package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
  311. package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
  312. package/ci/test-optimization-validation/generated-file-policy.js +0 -63
  313. package/ci/test-optimization-validation/generated-files.js +0 -425
  314. package/ci/test-optimization-validation/generated-test-contract.js +0 -284
  315. package/ci/test-optimization-validation/generated-verifier.js +0 -235
  316. package/ci/test-optimization-validation/literal-environment.js +0 -56
  317. package/ci/test-optimization-validation/literal-glob.js +0 -52
  318. package/ci/test-optimization-validation/manifest-loader.js +0 -116
  319. package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
  320. package/ci/test-optimization-validation/manifest-schema.js +0 -695
  321. package/ci/test-optimization-validation/offline-fixtures.js +0 -335
  322. package/ci/test-optimization-validation/offline-output.js +0 -406
  323. package/ci/test-optimization-validation/package-check.js +0 -97
  324. package/ci/test-optimization-validation/payload-normalizer.js +0 -72
  325. package/ci/test-optimization-validation/plan-writer.js +0 -541
  326. package/ci/test-optimization-validation/preflight-runner.js +0 -186
  327. package/ci/test-optimization-validation/project-build-artifact.js +0 -31
  328. package/ci/test-optimization-validation/redaction.js +0 -319
  329. package/ci/test-optimization-validation/report-writer.js +0 -666
  330. package/ci/test-optimization-validation/result-semantics.js +0 -103
  331. package/ci/test-optimization-validation/runner-command.js +0 -264
  332. package/ci/test-optimization-validation/runner-contract.js +0 -695
  333. package/ci/test-optimization-validation/safe-files.js +0 -202
  334. package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
  335. package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
  336. package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
  337. package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
  338. package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
  339. package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
  340. package/ci/test-optimization-validation/source-text.js +0 -84
  341. package/ci/test-optimization-validation/static-diagnosis.js +0 -166
  342. package/ci/test-optimization-validation/test-output.js +0 -120
  343. package/ci/test-optimization-validation/validation-blocker.js +0 -21
  344. package/ci/validate-test-optimization.js +0 -3
  345. package/packages/datadog-esbuild/src/resolver.js +0 -284
  346. package/packages/datadog-esbuild/src/utils.js +0 -318
  347. package/packages/datadog-plugin-cypress/src/support.js +0 -1348
  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
@@ -105,6 +105,41 @@ const transformers = {
105
105
  }
106
106
  return tags
107
107
  },
108
+ /**
109
+ * Resolves an OpenTelemetry exporter list (e.g. `console,otlp`) to the single exporter the
110
+ * tracer supports. `none` disables export and cannot be combined with any other entry: such a
111
+ * list is invalid and resolves to unset. Otherwise `otlp` anywhere selects OTLP. Other entries
112
+ * are ignored with a warning; a list without a supported entry resolves to unset.
113
+ *
114
+ * @param {string[]} value
115
+ * @param {string} optionName
116
+ * @param {string} source
117
+ * @param {boolean} [reportInvalid]
118
+ * @returns {'none' | 'otlp' | undefined}
119
+ */
120
+ parseOtelExporterList (value, optionName, source, reportInvalid = true) {
121
+ const entries = transformers.toLowerCase(value)
122
+
123
+ if (entries.includes('none')) {
124
+ if (entries.every(entry => entry === 'none')) {
125
+ return 'none'
126
+ }
127
+ if (reportInvalid) {
128
+ warnInvalidValue(entries.join(','), optionName, source, "'none' cannot be combined with other exporters")
129
+ }
130
+ return
131
+ }
132
+
133
+ const exporter = entries.includes('otlp') ? 'otlp' : undefined
134
+
135
+ const ignored = entries.filter(entry => entry !== 'otlp')
136
+ if (ignored.length > 0 && reportInvalid) {
137
+ const outcome = exporter === undefined ? 'picked default' : null
138
+ warnInvalidValue(ignored.join(','), optionName, source, 'Unsupported exporters ignored', undefined, outcome)
139
+ }
140
+
141
+ return exporter
142
+ },
108
143
  normalizeProfilingEnabled (configValue) {
109
144
  if (configValue == null) {
110
145
  return
@@ -437,9 +472,18 @@ const programmaticTypeCoercions = {
437
472
  return value
438
473
  }
439
474
  },
475
+ /**
476
+ * Keeps any value as given, for an option that its consumer validates.
477
+ *
478
+ * @param {unknown} value
479
+ */
480
+ PASSTHROUGH (value) {
481
+ return value
482
+ },
440
483
  }
441
484
 
442
485
  module.exports = {
486
+ VALID_PROPAGATION_STYLES,
443
487
  parsers,
444
488
  programmaticTypeCoercions,
445
489
  transformers,
@@ -0,0 +1,38 @@
1
+ 'use strict'
2
+
3
+ const { getEnvironmentVariables } = require('./helper')
4
+
5
+ /**
6
+ * @typedef {ReturnType<import('./index')>} Config
7
+ * @typedef {'APM_TRACING' | 'APM_PROFILING'} Product
8
+ * @typedef {Partial<Record<import('./helper').SupportedEnvKey, string>>} Settings
9
+ */
10
+
11
+ /** @type {WeakMap<Config, Record<Product, Settings | null>>} */
12
+ const layersByConfig = new WeakMap()
13
+
14
+ /**
15
+ * Replace a product's settings and apply the settings of every active product. For a setting
16
+ * both products supply, APM_PROFILING takes precedence over the broader APM_TRACING, whatever the
17
+ * order of updates.
18
+ *
19
+ * @param {Config} config
20
+ * @param {Product} product
21
+ * @param {Settings | null} settings
22
+ */
23
+ module.exports = function applyRemoteConfig (config, product, settings) {
24
+ let layers = layersByConfig.get(config)
25
+ if (layers === undefined) {
26
+ layers = { APM_TRACING: null, APM_PROFILING: null }
27
+ layersByConfig.set(config, layers)
28
+ }
29
+ layers[product] = settings
30
+
31
+ const { APM_TRACING: tracing, APM_PROFILING: profiling } = layers
32
+ if (tracing === null || profiling === null) {
33
+ config.setRemoteConfig(tracing ?? profiling)
34
+ return
35
+ }
36
+ // Resolve aliases first, so that each setting has a single key across products.
37
+ config.setRemoteConfig({ ...getEnvironmentVariables(tracing, true), ...getEnvironmentVariables(profiling, true) })
38
+ }
@@ -2,6 +2,7 @@
2
2
 
3
3
  const RemoteConfigCapabilities = require('../remote_config/capabilities')
4
4
  const log = require('../log')
5
+ const applyRemoteConfig = require('./remote-config-layers')
5
6
 
6
7
  module.exports = {
7
8
  enable,
@@ -181,7 +182,7 @@ function enable (rc, config, onConfigUpdated) {
181
182
  transaction.ack(item.path)
182
183
  }
183
184
 
184
- config.setRemoteConfig(sdkConfigManager.getMergedConfig())
185
+ applyRemoteConfig(config, 'APM_TRACING', sdkConfigManager.getMergedConfig())
185
186
 
186
187
  onConfigUpdated()
187
188
  })
@@ -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",
@@ -53,6 +185,15 @@
53
185
  ]
54
186
  }
55
187
  ],
188
+ "DD_AI_GUARD_DISABLED_INTEGRATIONS": [
189
+ {
190
+ "implementation": "A",
191
+ "type": "array",
192
+ "namespace": "aiguard",
193
+ "default": null,
194
+ "description": "Comma-separated integration names for which AI Guard automatic evaluation is disabled."
195
+ }
196
+ ],
56
197
  "DD_AI_GUARD_ANALYZE_STREAM_RESPONSES_ENABLED": [
57
198
  {
58
199
  "implementation": "A",
@@ -1614,6 +1755,14 @@
1614
1755
  ]
1615
1756
  }
1616
1757
  ],
1758
+ "DD_OPENAI_REALTIME_SIDEBAND_AUDIO_RETRIEVAL_ENABLED": [
1759
+ {
1760
+ "implementation": "A",
1761
+ "type": "boolean",
1762
+ "default": "true",
1763
+ "namespace": "openai"
1764
+ }
1765
+ ],
1617
1766
  "DD_OPENAI_REALTIME_ENABLED": [
1618
1767
  {
1619
1768
  "implementation": "A",
@@ -1646,9 +1795,9 @@
1646
1795
  ],
1647
1796
  "DD_PROFILING_ALLOCATION_ENABLED": [
1648
1797
  {
1649
- "implementation": "B",
1798
+ "implementation": "A",
1650
1799
  "type": "boolean",
1651
- "default": "true"
1800
+ "default": "false"
1652
1801
  }
1653
1802
  ],
1654
1803
  "DD_PROFILING_ASYNC_CONTEXT_FRAME_ENABLED": [
@@ -2328,6 +2477,13 @@
2328
2477
  "default": "true"
2329
2478
  }
2330
2479
  ],
2480
+ "DD_TRACE_ASYNC_MUTEX_ENABLED": [
2481
+ {
2482
+ "implementation": "A",
2483
+ "type": "boolean",
2484
+ "default": "true"
2485
+ }
2486
+ ],
2331
2487
  "DD_TRACE_AVSC_ENABLED": [
2332
2488
  {
2333
2489
  "implementation": "A",
@@ -3231,9 +3387,9 @@
3231
3387
  ],
3232
3388
  "DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": [
3233
3389
  {
3234
- "implementation": "A",
3390
+ "implementation": "D",
3235
3391
  "type": "string",
3236
- "default": "400-499"
3392
+ "default": null
3237
3393
  }
3238
3394
  ],
3239
3395
  "DD_TRACE_HTTP_ENABLED": [
@@ -4238,6 +4394,13 @@
4238
4394
  "default": "true"
4239
4395
  }
4240
4396
  ],
4397
+ "DD_TRACE_TRPC_ENABLED": [
4398
+ {
4399
+ "implementation": "A",
4400
+ "type": "boolean",
4401
+ "default": "true"
4402
+ }
4403
+ ],
4241
4404
  "DD_TRACE_TYPESAFE_ENABLED": [
4242
4405
  {
4243
4406
  "implementation": "A",
@@ -4613,18 +4776,17 @@
4613
4776
  ],
4614
4777
  "OTEL_SDK_DISABLED": [
4615
4778
  {
4616
- "implementation": "C",
4779
+ "implementation": "B",
4617
4780
  "type": "boolean",
4618
- "default": "true"
4781
+ "default": null
4619
4782
  }
4620
4783
  ],
4621
4784
  "OTEL_TRACES_EXPORTER": [
4622
4785
  {
4623
- "implementation": "H",
4624
- "type": "string",
4786
+ "implementation": "J",
4787
+ "type": "array",
4625
4788
  "default": null,
4626
- "allowed": "none|otlp",
4627
- "transform": "toLowerCase"
4789
+ "transform": "parseOtelExporterList"
4628
4790
  }
4629
4791
  ],
4630
4792
  "OTEL_TRACES_SAMPLER": [
@@ -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',
@@ -20,6 +20,33 @@ function fnv64 (data) {
20
20
  return fnv(byteArray, FNV1_64_INIT, FNV_64_PRIME, 2n ** 64n)
21
21
  }
22
22
 
23
+ /**
24
+ * FNV-1 64 of `data`, written into `target` at `offset` as a uint64 little-endian. With `seed`, an
25
+ * earlier result in the same layout, it continues that hash, like dd-trace-java's
26
+ * FNV64Hash.continueHash.
27
+ *
28
+ * Same hash as `fnv64`, computed on two uint32 halves because BigInt arithmetic per byte is several
29
+ * times slower on the per-message DSM path. FNV_64_PRIME is 2^40 + 0x1b3, so multiplying by it is
30
+ * a 40-bit shift plus a multiply by 0x1b3, and every intermediate stays below 2^53.
31
+ *
32
+ * @param {Uint8Array} data
33
+ * @param {Buffer} target
34
+ * @param {number} offset
35
+ * @param {Buffer} [seed]
36
+ */
37
+ function writeFnv64LE (data, target, offset, seed) {
38
+ let high = seed === undefined ? 0xCB_F2_9C_E4 : seed.readUInt32LE(4)
39
+ let low = seed === undefined ? 0x84_22_23_25 : seed.readUInt32LE(0)
40
+ for (let i = 0; i < data.length; i++) {
41
+ const lowProduct = low * 0x1_B3
42
+ high = (high * 0x1_B3 + Math.floor(lowProduct / 0x1_00_00_00_00) + (low << 8)) >>> 0
43
+ low = ((lowProduct >>> 0) ^ data[i]) >>> 0
44
+ }
45
+ target.writeUInt32LE(low, offset)
46
+ target.writeUInt32LE(high, offset + 4)
47
+ }
48
+
23
49
  module.exports = {
24
50
  fnv64,
51
+ writeFnv64LE,
25
52
  }
@@ -1,9 +1,8 @@
1
1
  'use strict'
2
2
 
3
- // encoding used here is sha256
4
- // other languages use FNV1
5
- // this inconsistency is ok because hashes do not need to be consistent across services
6
- const crypto = require('crypto')
3
+ // Pathway hashes must equal dd-trace-java's for the same checkpoint, so a pathway that crosses
4
+ // tracers resolves to one set of nodes. The rules below mirror dd-trace-java's BaseHash and
5
+ // DataStreamsTags (node hash) and DefaultPathwayContext#generatePathwayHash (pathway hash).
7
6
  const { LRUCache } = require('../../../../vendor/dist/lru-cache')
8
7
  const {
9
8
  hasDsmBase64,
@@ -15,8 +14,39 @@ const {
15
14
  } = require('../carrier')
16
15
  const log = require('../log')
17
16
  const { encodeVarintInto, decodeVarint } = require('./encoding')
17
+ const { writeFnv64LE } = require('./fnv')
18
18
 
19
19
  const cache = new LRUCache({ max: 500 })
20
+ const seeds = new LRUCache({ max: 100 })
21
+ let nextSeedId = 0
22
+ /** @type {{ id: number, state: Buffer } | undefined} */
23
+ let lastSeed
24
+ /** @type {unknown[]} */
25
+ let lastSeedInputs = []
26
+
27
+ // dd-trace-java hashes these tag keys in this order, not alphabetically. Keys it does not know are
28
+ // hashed after them, alphabetically.
29
+ const HASHED_TAG_RANK = new Map([
30
+ ['bus', 0],
31
+ ['direction', 1],
32
+ ['exchange', 2],
33
+ ['topic', 3],
34
+ ['type', 4],
35
+ ['subscription', 5],
36
+ ['kafka_cluster_id', 6],
37
+ ])
38
+ const UNKNOWN_TAG_RANK = HASHED_TAG_RANK.size
39
+
40
+ // dd-trace-java reports these tags but keeps them out of the pathway hash.
41
+ const UNHASHED_TAG_KEYS = new Set([
42
+ 'ds.name',
43
+ 'ds.namespace',
44
+ 'manual_checkpoint',
45
+ 'group',
46
+ 'consumer_group',
47
+ 'partition',
48
+ 'has_routing_key',
49
+ ])
20
50
 
21
51
  const PATHWAY_CONTEXT_BYTES = 20
22
52
 
@@ -24,43 +54,98 @@ const PATHWAY_CONTEXT_BYTES = 20
24
54
  // `Buffer.from(...)` copy-out so callers never observe mutation between checkpoints.
25
55
  const pathwayScratch = Buffer.allocUnsafe(PATHWAY_CONTEXT_BYTES)
26
56
 
27
- function shaHash (checkpointString) {
28
- // Copy out of the 32-byte digest so the LRU cache doesn't retain it.
29
- return Buffer.from(crypto.createHash('sha256').update(checkpointString).digest().subarray(0, 8))
57
+ /**
58
+ * @param {string} tag
59
+ */
60
+ function tagKey (tag) {
61
+ const colon = tag.indexOf(':')
62
+ return colon === -1 ? tag : tag.slice(0, colon)
63
+ }
64
+
65
+ /**
66
+ * @param {string} tag
67
+ */
68
+ function tagRank (tag) {
69
+ return HASHED_TAG_RANK.get(tagKey(tag)) ?? UNKNOWN_TAG_RANK
70
+ }
71
+
72
+ /**
73
+ * @param {string[]} sortedEdgeTags
74
+ */
75
+ function hashedEdgeTags (sortedEdgeTags) {
76
+ return sortedEdgeTags
77
+ .filter(tag => !UNHASHED_TAG_KEYS.has(tagKey(tag)))
78
+ .sort((a, b) => tagRank(a) - tagRank(b))
79
+ .join('')
80
+ }
81
+
82
+ /**
83
+ * Like dd-trace-java's BaseHash, the FNV state over service, env, process tags and container tags
84
+ * hash is computed once per distinct value and continued for every checkpoint. `id` stands in for
85
+ * that value in the checkpoint cache key; ids are never reused, so an evicted seed cannot alias another.
86
+ *
87
+ * @param {string} service
88
+ * @param {string | undefined} env
89
+ * @param {string | undefined} processTags
90
+ * @param {string | null | undefined} containerTagsHash
91
+ * @returns {{ id: number, state: Buffer }}
92
+ */
93
+ function nodeHashSeed (service, env, processTags, containerTagsHash) {
94
+ if (
95
+ lastSeed !== undefined &&
96
+ lastSeedInputs[0] === service &&
97
+ lastSeedInputs[1] === env &&
98
+ lastSeedInputs[2] === processTags &&
99
+ lastSeedInputs[3] === containerTagsHash
100
+ ) {
101
+ return lastSeed
102
+ }
103
+ // dd-trace-java folds the container tags hash only when it folds process tags.
104
+ const prefix = processTags
105
+ ? `${service}${env ?? ''}${processTags}${containerTagsHash || ''}`
106
+ : `${service}${env ?? ''}`
107
+ let seed = seeds.get(prefix)
108
+ if (seed === undefined) {
109
+ const state = Buffer.alloc(8)
110
+ writeFnv64LE(Buffer.from(prefix, 'utf8'), state, 0)
111
+ seed = { id: nextSeedId++, state }
112
+ seeds.set(prefix, seed)
113
+ }
114
+ lastSeedInputs = [service, env, processTags, containerTagsHash]
115
+ lastSeed = seed
116
+ return seed
30
117
  }
31
118
 
32
119
  /**
120
+ * Sorts `edgeTags` in place.
121
+ *
122
+ * Returns one Buffer instance per distinct set of arguments while it stays cached: StatsBucket keys
123
+ * stats points by that instance, which keeps tags left out of the hash, such as `group`, in separate
124
+ * stats points.
125
+ *
33
126
  * @param {string} service
34
- * @param {string} env
127
+ * @param {string | undefined} env
35
128
  * @param {string[]} edgeTags
36
- * @param {Buffer} parentHash
37
- * @param {bigint | null} propagationHashBigInt - Optional propagation hash for process/container tags
129
+ * @param {Buffer} parentHash Parent pathway hash as uint64 little-endian.
130
+ * @param {string} [processTags] Serialized process tags; omitted when process tags are off.
131
+ * @param {string | null} [containerTagsHash] Container tags hash from the agent.
132
+ * @returns {Buffer} Pathway hash as uint64 little-endian.
38
133
  */
39
- function computeHash (service, env, edgeTags, parentHash, propagationHashBigInt = null) {
134
+ function computeHash (service, env, edgeTags, parentHash, processTags, containerTagsHash) {
40
135
  edgeTags.sort()
41
- const hashableEdgeTags = edgeTags.includes('manual_checkpoint:true')
42
- ? edgeTags.filter(item => item !== 'manual_checkpoint:true')
43
- : edgeTags
44
-
45
- // The cache key includes parentHash so a fan-in node with different parents
46
- // gets distinct cache entries; the hash input below excludes parentHash and
47
- // gets combined with it via a second sha pass to produce the final hash.
48
- const joinedEdgeTags = hashableEdgeTags.join('')
49
- const propagationHex = propagationHashBigInt ? propagationHashBigInt.toString(16) : ''
50
- const propagationPart = propagationHex ? `:${propagationHex}` : ''
51
- const key = `${service}${env}${joinedEdgeTags}${parentHash}${propagationPart}`
136
+ const seed = nodeHashSeed(service, env, processTags, containerTagsHash)
137
+ const key = `${seed.id}\0${edgeTags.join('\0')}\0${parentHash.toString('hex')}`
52
138
 
53
139
  let value = cache.get(key)
54
140
  if (value) {
55
141
  return value
56
142
  }
57
143
 
58
- const baseString = `${service}${env}${joinedEdgeTags}`
59
- const hashInput = propagationHex ? `${baseString}:${propagationHex}` : baseString
60
-
61
- const currentHash = shaHash(hashInput)
62
- const buf = Buffer.concat([currentHash, parentHash], 16)
63
- value = shaHash(buf.toString())
144
+ const pathwayInput = Buffer.alloc(16)
145
+ writeFnv64LE(Buffer.from(hashedEdgeTags(edgeTags), 'utf8'), pathwayInput, 0, seed.state)
146
+ parentHash.copy(pathwayInput, 8)
147
+ value = Buffer.allocUnsafe(8)
148
+ writeFnv64LE(pathwayInput, value, 0)
64
149
  cache.set(key, value)
65
150
  return value
66
151
  }
@@ -332,10 +332,11 @@ class DataStreamsProcessor {
332
332
  )
333
333
  }
334
334
 
335
- // Get propagation hash if enabled
336
- const propagationHashValue = propagationHash.isEnabled() ? propagationHash.getHash() : null
337
-
338
- const hash = computePathwayHash(this.service, this.env, edgeTags, parentHash, propagationHashValue)
335
+ const hash = propagationHash.isEnabled()
336
+ ? computePathwayHash(
337
+ this.service, this.env, edgeTags, parentHash, processTags.serialized, propagationHash.getContainerTagsHash()
338
+ )
339
+ : computePathwayHash(this.service, this.env, edgeTags, parentHash)
339
340
  const edgeLatencyNs = nowNs - edgeStartNs
340
341
  const pathwayLatencyNs = nowNs - pathwayStartNs
341
342
  const dataStreamsContext = {
@@ -27,7 +27,7 @@ module.exports = function getDebuggerConfig (config, inputPath) {
27
27
  repositoryUrl,
28
28
  runtimeId: config.tags['runtime-id'],
29
29
  service: config.service,
30
- url: agentless ? agentlessUrl.origin : config.url.toString(),
30
+ url: agentlessUrl === undefined ? config.url.toString() : agentlessUrl.origin,
31
31
  version: config.version,
32
32
  inputPath,
33
33
  }
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  /**
4
- * @param {ReturnType<import('../config')>} config - Debugger configuration
4
+ * @param {NonNullable<ReturnType<import('../config')>>} config - Debugger configuration
5
5
  * @param {string} path - Request path
6
6
  * @param {Record<string, string>} headers - Payload headers
7
7
  * @returns {{
@@ -12,17 +12,15 @@
12
12
  * }}
13
13
  */
14
14
  module.exports = function getRequestOptions (config, path, headers) {
15
- const options = {
16
- method: 'POST',
17
- url: config.url,
18
- path,
19
- headers,
20
- }
21
-
22
15
  if (config.agentless) {
23
16
  if (config.apiKey !== undefined) headers['DD-API-KEY'] = config.apiKey
24
17
  headers['DD-EVP-ORIGIN'] = 'agent-debugger'
25
18
  }
26
19
 
27
- return options
20
+ return {
21
+ method: 'POST',
22
+ url: config.url,
23
+ path,
24
+ headers,
25
+ }
28
26
  }
@@ -131,7 +131,7 @@ function onFlush (payload, done) {
131
131
  }
132
132
 
133
133
  /**
134
- * @param {number} statusCode - The status code of the response
134
+ * @param {number | undefined} statusCode - The status code of the response, if one was received
135
135
  * @param {string} payload - The payload to send
136
136
  * @param {() => void} done - Releases the payload from the upload queue
137
137
  */
@@ -1,7 +1,9 @@
1
1
  'use strict'
2
2
 
3
3
  const { join, dirname } = require('path')
4
- const { normalize } = require('../../../../../vendor/dist/source-map/lib/util')
4
+ const { normalize } = /** @type {{ normalize: (path: string) => string }} */ (
5
+ require('../../../../../vendor/dist/source-map/lib/util')
6
+ )
5
7
  const { loadSourceMapSync, getOriginalPosition } = require('./source-maps')
6
8
  const session = require('./session')
7
9
  const log = require('./log')
@@ -3,7 +3,7 @@
3
3
  const { GIT_COMMIT_SHA, GIT_REPOSITORY_URL } = require('../../plugins/util/tags')
4
4
 
5
5
  /**
6
- * @param {ReturnType<import('../config')>} config - Debugger configuration
6
+ * @param {NonNullable<ReturnType<import('../config')>>} config - Debugger configuration
7
7
  * @param {string} hostname - Host name
8
8
  * @param {string} debuggerVersion - Debugger version
9
9
  * @param {typeof import('./log')} log - Debugger logger