@depup/dd-trace 6.16.0-depup.0 → 6.18.0-depup.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 (358) hide show
  1. package/README.md +2 -2
  2. package/changes.json +1 -1
  3. package/ci/diagnose.js +0 -23
  4. package/ci/test-optimization-validation/approval-artifacts.js +0 -3
  5. package/ci/test-optimization-validation/approval.js +0 -6
  6. package/ci/test-optimization-validation/artifact-id.js +0 -1
  7. package/ci/test-optimization-validation/bounded-json.js +0 -1
  8. package/ci/test-optimization-validation/cli.js +0 -12
  9. package/ci/test-optimization-validation/command-output-policy.js +0 -1
  10. package/ci/test-optimization-validation/command-runner.js +0 -3
  11. package/ci/test-optimization-validation/environment.js +0 -4
  12. package/ci/test-optimization-validation/executable-approval.js +0 -1
  13. package/ci/test-optimization-validation/executable.js +0 -5
  14. package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -6
  15. package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -3
  16. package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -6
  17. package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -4
  18. package/ci/test-optimization-validation/generated-test-contract.js +0 -5
  19. package/ci/test-optimization-validation/generated-verifier.js +0 -1
  20. package/ci/test-optimization-validation/literal-environment.js +0 -1
  21. package/ci/test-optimization-validation/manifest-scaffold.js +0 -17
  22. package/ci/test-optimization-validation/manifest-schema.js +0 -21
  23. package/ci/test-optimization-validation/offline-fixtures.js +0 -4
  24. package/ci/test-optimization-validation/plan-writer.js +0 -11
  25. package/ci/test-optimization-validation/preflight-runner.js +0 -1
  26. package/ci/test-optimization-validation/redaction.js +0 -4
  27. package/ci/test-optimization-validation/report-writer.js +0 -16
  28. package/ci/test-optimization-validation/runner-command.js +0 -3
  29. package/ci/test-optimization-validation/runner-contract.js +0 -4
  30. package/ci/test-optimization-validation/safe-files.js +0 -1
  31. package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -1
  32. package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -1
  33. package/ci/test-optimization-validation/source-text.js +0 -3
  34. package/ci/vitest-no-worker-init-setup.mjs +41 -16
  35. package/index.d.ts +208 -0
  36. package/package.json +19 -18
  37. package/packages/datadog-esbuild/src/utils.js +0 -2
  38. package/packages/datadog-instrumentations/src/aerospike.js +28 -6
  39. package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +0 -2
  40. package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
  41. package/packages/datadog-instrumentations/src/claude-agent-sdk.js +0 -2
  42. package/packages/datadog-instrumentations/src/console.js +97 -0
  43. package/packages/datadog-instrumentations/src/cucumber.js +77 -12
  44. package/packages/datadog-instrumentations/src/cypress-config.js +27 -38
  45. package/packages/datadog-instrumentations/src/helpers/bundler-register.js +6 -0
  46. package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
  47. package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +2 -1
  48. package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
  49. package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -6
  50. package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +0 -3
  51. package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
  52. package/packages/datadog-instrumentations/src/helpers/register.js +24 -0
  53. package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +111 -26
  54. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +41 -0
  55. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -17
  56. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +55 -0
  57. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +36 -0
  58. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/supabase.js +128 -0
  59. package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +13 -0
  60. package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +28 -3
  61. package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +20 -0
  62. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
  63. package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +0 -5
  64. package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
  65. package/packages/datadog-instrumentations/src/jest.js +165 -51
  66. package/packages/datadog-instrumentations/src/knex.js +0 -1
  67. package/packages/datadog-instrumentations/src/mariadb-bundle.js +0 -24
  68. package/packages/datadog-instrumentations/src/mariadb.js +0 -2
  69. package/packages/datadog-instrumentations/src/mocha/common.js +0 -1
  70. package/packages/datadog-instrumentations/src/mocha/main.js +25 -26
  71. package/packages/datadog-instrumentations/src/mocha/utils.js +119 -49
  72. package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +0 -6
  73. package/packages/datadog-instrumentations/src/mocha/worker.js +14 -17
  74. package/packages/datadog-instrumentations/src/mysql2.js +0 -2
  75. package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +241 -0
  76. package/packages/datadog-instrumentations/src/openai-realtime/events.js +76 -0
  77. package/packages/datadog-instrumentations/src/openai-realtime/index.js +301 -0
  78. package/packages/datadog-instrumentations/src/openai-realtime/session.js +998 -0
  79. package/packages/datadog-instrumentations/src/openai-realtime/turns.js +211 -0
  80. package/packages/datadog-instrumentations/src/openai.js +51 -12
  81. package/packages/datadog-instrumentations/src/oracledb.js +9 -3
  82. package/packages/datadog-instrumentations/src/playwright-reporter.js +6 -20
  83. package/packages/datadog-instrumentations/src/playwright.js +280 -56
  84. package/packages/datadog-instrumentations/src/{azure-cosmos.js → postgres.js} +1 -1
  85. package/packages/datadog-instrumentations/src/router.js +0 -2
  86. package/packages/datadog-instrumentations/src/rum-browser-scripts.js +0 -2
  87. package/packages/datadog-instrumentations/src/sequelize.js +0 -1
  88. package/packages/datadog-instrumentations/src/supabase.js +15 -0
  89. package/packages/datadog-instrumentations/src/undici.js +7 -3
  90. package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
  91. package/packages/datadog-instrumentations/src/vitest-main.js +121 -30
  92. package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
  93. package/packages/datadog-instrumentations/src/vitest-worker.js +49 -13
  94. package/packages/datadog-instrumentations/src/webdriverio.js +44 -47
  95. package/packages/datadog-instrumentations/src/ws.js +41 -2
  96. package/packages/datadog-plugin-ai/src/utils.js +0 -2
  97. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +0 -1
  98. package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +0 -2
  99. package/packages/datadog-plugin-aws-sdk/src/base.js +0 -1
  100. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +0 -1
  101. package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +0 -1
  102. package/packages/datadog-plugin-aws-sdk/src/util.js +0 -1
  103. package/packages/datadog-plugin-azure-durable-functions/src/index.js +0 -1
  104. package/packages/datadog-plugin-cucumber/src/index.js +9 -0
  105. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +211 -85
  106. package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
  107. package/packages/datadog-plugin-cypress/src/index.js +3 -1
  108. package/packages/datadog-plugin-cypress/src/source-map-utils.js +0 -4
  109. package/packages/datadog-plugin-cypress/src/support.js +52 -7
  110. package/packages/datadog-plugin-graphql/src/resolve-error.js +1 -2
  111. package/packages/datadog-plugin-graphql/src/utils.js +0 -5
  112. package/packages/datadog-plugin-jest/src/index.js +12 -0
  113. package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
  114. package/packages/datadog-plugin-mocha/src/index.js +38 -11
  115. package/packages/datadog-plugin-mongodb-core/src/query.js +0 -1
  116. package/packages/datadog-plugin-openai/src/index.js +16 -1
  117. package/packages/datadog-plugin-openai/src/realtime.js +144 -0
  118. package/packages/datadog-plugin-openai-agents/src/integration.js +0 -4
  119. package/packages/datadog-plugin-openai-agents/src/util.js +0 -1
  120. package/packages/datadog-plugin-playwright/src/index.js +81 -9
  121. package/packages/datadog-plugin-postgres/src/index.js +167 -0
  122. package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +0 -1
  123. package/packages/datadog-plugin-redis/src/index.js +15 -1
  124. package/packages/datadog-plugin-supabase/src/error.js +18 -0
  125. package/packages/datadog-plugin-supabase/src/index.js +21 -0
  126. package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +69 -0
  127. package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +70 -0
  128. package/packages/datadog-plugin-supabase/src/supabase-postgrest-js-postgrestbuilder-then.js +122 -0
  129. package/packages/datadog-plugin-supabase/src/supabase-realtime-js-realtimechannel-send.js +66 -0
  130. package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +93 -0
  131. package/packages/datadog-plugin-supabase/src/url.js +17 -0
  132. package/packages/datadog-plugin-vitest/src/index.js +9 -0
  133. package/packages/datadog-plugin-ws/src/producer.js +1 -1
  134. package/packages/datadog-plugin-ws/src/util.js +0 -4
  135. package/packages/datadog-shimmer/src/shimmer.js +14 -10
  136. package/packages/datadog-turbopack/index.js +4 -7
  137. package/packages/datadog-turbopack/src/loader.js +6 -18
  138. package/packages/datadog-webpack/src/loader.js +0 -1
  139. package/packages/dd-trace/src/agent/info.js +5 -4
  140. package/packages/dd-trace/src/aiguard/client.js +2 -3
  141. package/packages/dd-trace/src/aiguard/evaluation.js +6 -12
  142. package/packages/dd-trace/src/aiguard/index.js +2 -2
  143. package/packages/dd-trace/src/aiguard/integrations/index.js +1 -1
  144. package/packages/dd-trace/src/aiguard/integrations/openai.js +81 -7
  145. package/packages/dd-trace/src/aiguard/messages/anthropic.js +0 -2
  146. package/packages/dd-trace/src/aiguard/messages/openai.js +64 -1
  147. package/packages/dd-trace/src/aiguard/messages/utils.js +0 -1
  148. package/packages/dd-trace/src/aiguard/redaction.js +0 -1
  149. package/packages/dd-trace/src/aiguard/sdk.js +1 -1
  150. package/packages/dd-trace/src/appsec/activation.js +1 -1
  151. package/packages/dd-trace/src/appsec/api_security/normalized-route.js +0 -5
  152. package/packages/dd-trace/src/appsec/api_security/sampler.js +0 -4
  153. package/packages/dd-trace/src/appsec/blocking/index.js +3 -3
  154. package/packages/dd-trace/src/appsec/downstream_requests.js +1 -4
  155. package/packages/dd-trace/src/appsec/iast/index.js +1 -1
  156. package/packages/dd-trace/src/appsec/iast/overhead-controller.js +5 -5
  157. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -1
  158. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
  159. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +3 -3
  160. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +8 -10
  161. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -2
  162. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +4 -1
  163. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +7 -7
  164. package/packages/dd-trace/src/appsec/index.js +2 -2
  165. package/packages/dd-trace/src/appsec/lambda.js +71 -2
  166. package/packages/dd-trace/src/appsec/rasp/utils.js +5 -1
  167. package/packages/dd-trace/src/appsec/remote_config.js +8 -6
  168. package/packages/dd-trace/src/appsec/reporter.js +10 -6
  169. package/packages/dd-trace/src/appsec/rule_manager.js +3 -3
  170. package/packages/dd-trace/src/appsec/sdk/track_event.js +0 -2
  171. package/packages/dd-trace/src/appsec/waf/index.js +2 -2
  172. package/packages/dd-trace/src/appsec/waf/waf_manager.js +8 -5
  173. package/packages/dd-trace/src/carrier.js +0 -5
  174. package/packages/dd-trace/src/ci-visibility/dynamic-atr-retries.js +104 -0
  175. package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +0 -2
  176. package/packages/dd-trace/src/ci-visibility/efd-retry-policy.js +34 -3
  177. package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +0 -1
  178. package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +0 -1
  179. package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +0 -1
  180. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -4
  181. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -1
  182. package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -2
  183. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +37 -15
  184. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -3
  185. package/packages/dd-trace/src/ci-visibility/exporters/request.js +0 -11
  186. package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +0 -1
  187. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +0 -1
  188. package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +0 -6
  189. package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -2
  190. package/packages/dd-trace/src/ci-visibility/requests/rate-limit.js +0 -1
  191. package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +0 -5
  192. package/packages/dd-trace/src/ci-visibility/requests/video-request.js +0 -1
  193. package/packages/dd-trace/src/ci-visibility/telemetry.js +13 -0
  194. package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +0 -1
  195. package/packages/dd-trace/src/ci-visibility/test-screenshot.js +0 -2
  196. package/packages/dd-trace/src/ci-visibility/test-video.js +0 -1
  197. package/packages/dd-trace/src/config/defaults.js +3 -2
  198. package/packages/dd-trace/src/config/generated-config-types.d.ts +88 -82
  199. package/packages/dd-trace/src/config/helper.js +0 -1
  200. package/packages/dd-trace/src/config/index.js +31 -30
  201. package/packages/dd-trace/src/config/parsers.js +34 -6
  202. package/packages/dd-trace/src/config/remote_config.js +25 -109
  203. package/packages/dd-trace/src/config/supported-configurations.json +150 -10
  204. package/packages/dd-trace/src/datastreams/encoding.js +0 -1
  205. package/packages/dd-trace/src/datastreams/pathway.js +0 -1
  206. package/packages/dd-trace/src/debugger/constants.js +10 -0
  207. package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +62 -10
  208. package/packages/dd-trace/src/debugger/devtools_client/config.js +4 -1
  209. package/packages/dd-trace/src/debugger/devtools_client/guardrail-metrics.js +15 -0
  210. package/packages/dd-trace/src/debugger/devtools_client/index.js +103 -27
  211. package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +50 -7
  212. package/packages/dd-trace/src/debugger/devtools_client/log.js +3 -1
  213. package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +21 -8
  214. package/packages/dd-trace/src/debugger/devtools_client/send.js +41 -15
  215. package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +53 -13
  216. package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +118 -71
  217. package/packages/dd-trace/src/debugger/devtools_client/snapshot/redaction.js +5 -3
  218. package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
  219. package/packages/dd-trace/src/debugger/devtools_client/status.js +21 -7
  220. package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
  221. package/packages/dd-trace/src/debugger/index.js +51 -3
  222. package/packages/dd-trace/src/debugger/inspect-segment.js +0 -3
  223. package/packages/dd-trace/src/debugger/probe_sampler.js +133 -9
  224. package/packages/dd-trace/src/debugger/probe_sampler_constants.js +31 -1
  225. package/packages/dd-trace/src/dogstatsd.js +0 -23
  226. package/packages/dd-trace/src/encode/0.4-cross-payload.js +0 -3
  227. package/packages/dd-trace/src/encode/0.4.js +0 -7
  228. package/packages/dd-trace/src/encode/0.5.js +0 -2
  229. package/packages/dd-trace/src/encode/tags-processors.js +0 -1
  230. package/packages/dd-trace/src/evp_proxy/constants.js +2 -0
  231. package/packages/dd-trace/src/evp_proxy/direct.js +17 -13
  232. package/packages/dd-trace/src/evp_proxy/discovery.js +14 -11
  233. package/packages/dd-trace/src/evp_proxy/path.js +21 -9
  234. package/packages/dd-trace/src/exporters/agent/writer.js +0 -1
  235. package/packages/dd-trace/src/exporters/agentless/index.js +0 -1
  236. package/packages/dd-trace/src/exporters/agentless/intake.js +0 -1
  237. package/packages/dd-trace/src/exporters/agentless/writer.js +0 -3
  238. package/packages/dd-trace/src/exporters/common/final-flush-request-tracker.js +0 -6
  239. package/packages/dd-trace/src/exporters/common/request.js +1 -0
  240. package/packages/dd-trace/src/exporters/common/url.js +33 -4
  241. package/packages/dd-trace/src/exporters/common/writer.js +0 -2
  242. package/packages/dd-trace/src/id.js +0 -11
  243. package/packages/dd-trace/src/llmobs/audio-codec.js +192 -0
  244. package/packages/dd-trace/src/llmobs/audio-utils.js +121 -0
  245. package/packages/dd-trace/src/llmobs/constants/audio.js +35 -0
  246. package/packages/dd-trace/src/llmobs/constants/prompts.js +14 -0
  247. package/packages/dd-trace/src/llmobs/constants/tags.js +17 -0
  248. package/packages/dd-trace/src/llmobs/eval-metric.js +0 -6
  249. package/packages/dd-trace/src/llmobs/experiments/dataset.js +0 -4
  250. package/packages/dd-trace/src/llmobs/experiments/experiment.js +0 -3
  251. package/packages/dd-trace/src/llmobs/experiments/index.js +7 -6
  252. package/packages/dd-trace/src/llmobs/experiments/util.js +1 -11
  253. package/packages/dd-trace/src/llmobs/index.js +1 -3
  254. package/packages/dd-trace/src/llmobs/noop.js +10 -0
  255. package/packages/dd-trace/src/llmobs/plugins/ai/util.js +0 -4
  256. package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +0 -1
  257. package/packages/dd-trace/src/llmobs/plugins/genai/util.js +0 -4
  258. package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +0 -2
  259. package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +0 -2
  260. package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -6
  261. package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +285 -0
  262. package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +16 -3
  263. package/packages/dd-trace/src/llmobs/prompts/cache.js +272 -0
  264. package/packages/dd-trace/src/llmobs/prompts/manager.js +647 -0
  265. package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
  266. package/packages/dd-trace/src/llmobs/prompts/prompt.js +158 -0
  267. package/packages/dd-trace/src/llmobs/sdk.js +21 -6
  268. package/packages/dd-trace/src/llmobs/span_processor.js +81 -2
  269. package/packages/dd-trace/src/llmobs/tagger.js +39 -11
  270. package/packages/dd-trace/src/llmobs/telemetry.js +36 -4
  271. package/packages/dd-trace/src/llmobs/util.js +0 -34
  272. package/packages/dd-trace/src/llmobs/writers/base.js +0 -1
  273. package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
  274. package/packages/dd-trace/src/log/channels.js +3 -0
  275. package/packages/dd-trace/src/log/index.js +23 -5
  276. package/packages/dd-trace/src/log-submission/log-submission-plugin.js +74 -6
  277. package/packages/dd-trace/src/msgpack/chunk.js +0 -1
  278. package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +0 -12
  279. package/packages/dd-trace/src/openfeature/configuration_source.js +4 -1
  280. package/packages/dd-trace/src/openfeature/encoding.js +0 -2
  281. package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +0 -1
  282. package/packages/dd-trace/src/openfeature/flagging_provider.js +3 -3
  283. package/packages/dd-trace/src/openfeature/index.js +6 -6
  284. package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +0 -1
  285. package/packages/dd-trace/src/openfeature/span-enrichment.js +0 -4
  286. package/packages/dd-trace/src/openfeature/writers/base.js +90 -23
  287. package/packages/dd-trace/src/openfeature/writers/exposures.js +4 -5
  288. package/packages/dd-trace/src/openfeature/writers/util.js +104 -37
  289. package/packages/dd-trace/src/opentelemetry/logs/logger.js +0 -1
  290. package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +0 -1
  291. package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +0 -1
  292. package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +0 -2
  293. package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +0 -1
  294. package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +0 -1
  295. package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +0 -1
  296. package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +1 -14
  297. package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
  298. package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +30 -13
  299. package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +0 -1
  300. package/packages/dd-trace/src/opentelemetry/span-helpers.js +0 -1
  301. package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +0 -1
  302. package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +0 -3
  303. package/packages/dd-trace/src/opentracing/propagation/text_map.js +0 -6
  304. package/packages/dd-trace/src/opentracing/span_context.js +0 -1
  305. package/packages/dd-trace/src/opentracing/tracer.js +3 -3
  306. package/packages/dd-trace/src/otel-thread-ctx.js +38 -11
  307. package/packages/dd-trace/src/payload-tagging/tagging.js +15 -3
  308. package/packages/dd-trace/src/plugin_manager.js +27 -8
  309. package/packages/dd-trace/src/plugins/ci_plugin.js +1 -2
  310. package/packages/dd-trace/src/plugins/database.js +2 -6
  311. package/packages/dd-trace/src/plugins/index.js +7 -0
  312. package/packages/dd-trace/src/plugins/plugin.js +0 -4
  313. package/packages/dd-trace/src/plugins/tracing.js +1 -1
  314. package/packages/dd-trace/src/plugins/util/git.js +1 -3
  315. package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +0 -1
  316. package/packages/dd-trace/src/plugins/util/llm.js +0 -2
  317. package/packages/dd-trace/src/plugins/util/status-validator.js +0 -1
  318. package/packages/dd-trace/src/plugins/util/test.js +26 -20
  319. package/packages/dd-trace/src/plugins/util/url.js +0 -5
  320. package/packages/dd-trace/src/priority_sampler.js +0 -6
  321. package/packages/dd-trace/src/process-tags/index.js +0 -1
  322. package/packages/dd-trace/src/profiler.js +132 -35
  323. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +0 -1
  324. package/packages/dd-trace/src/profiling/profiler.js +101 -41
  325. package/packages/dd-trace/src/profiling/ssi-heuristics.js +29 -15
  326. package/packages/dd-trace/src/propagation-hash/index.js +0 -1
  327. package/packages/dd-trace/src/proxy.js +23 -47
  328. package/packages/dd-trace/src/random_sampler.js +0 -4
  329. package/packages/dd-trace/src/rate_limiter.js +0 -4
  330. package/packages/dd-trace/src/remote_config/capabilities.js +1 -9
  331. package/packages/dd-trace/src/remote_config/index.js +0 -1
  332. package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +0 -3
  333. package/packages/dd-trace/src/sampler.js +0 -4
  334. package/packages/dd-trace/src/sampling_rule.js +0 -7
  335. package/packages/dd-trace/src/serverless/vercel.js +0 -1
  336. package/packages/dd-trace/src/serverless.js +0 -1
  337. package/packages/dd-trace/src/service-naming/index.js +0 -1
  338. package/packages/dd-trace/src/service-naming/schemas/util.js +0 -1
  339. package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +7 -0
  340. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +5 -0
  341. package/packages/dd-trace/src/span_processor.js +2 -2
  342. package/packages/dd-trace/src/span_sampler.js +0 -1
  343. package/packages/dd-trace/src/standalone/product.js +2 -2
  344. package/packages/dd-trace/src/standalone/tracesource.js +0 -1
  345. package/packages/dd-trace/src/startup-log.js +1 -1
  346. package/packages/dd-trace/src/telemetry/endpoints.js +0 -8
  347. package/packages/dd-trace/src/telemetry/logs/index.js +16 -5
  348. package/packages/dd-trace/src/telemetry/logs/log-collector.js +16 -6
  349. package/packages/dd-trace/src/telemetry/metrics.js +0 -2
  350. package/packages/dd-trace/src/telemetry/send-data.js +2 -1
  351. package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
  352. package/packages/dd-trace/src/tracer.js +5 -4
  353. package/packages/dd-trace/src/util.js +13 -1
  354. package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
  355. package/packages/datadog-instrumentations/src/bullmq.js +0 -11
  356. package/packages/datadog-instrumentations/src/langchain.js +0 -7
  357. package/packages/datadog-instrumentations/src/langgraph.js +0 -7
  358. package/packages/datadog-instrumentations/src/mercurius.js +0 -11
@@ -8,6 +8,7 @@ const {
8
8
  } = require('./helpers/instrument')
9
9
 
10
10
  const ch = tracingChannel('apm:aerospike:command')
11
+ const kTracingCallbackCommand = Symbol('datadog.aerospike.tracing_callback_command')
11
12
 
12
13
  function wrapCreateCommand (createCommand) {
13
14
  if (typeof createCommand !== 'function') return createCommand
@@ -17,27 +18,48 @@ function wrapCreateCommand (createCommand) {
17
18
 
18
19
  if (!CommandClass) return CommandClass
19
20
 
21
+ shimmer.wrap(CommandClass.prototype, 'executeWithCallback', wrapExecuteWithCallback)
20
22
  shimmer.wrap(CommandClass.prototype, 'process', wrapProcess)
21
23
 
22
24
  return CommandClass
23
25
  }
24
26
  }
25
27
 
26
- function wrapProcess (process) {
28
+ function wrapExecuteWithCallback (executeWithCallback) {
27
29
  return function (...args) {
28
30
  const cb = args[0]
29
- if (typeof cb !== 'function') return process.apply(this, args)
31
+ if (!ch.start.hasSubscribers || typeof cb !== 'function') return executeWithCallback.apply(this, args)
30
32
 
31
- const ctx = {
32
- commandName: this.constructor.name,
33
- commandArgs: this.args,
34
- clientConfig: this.client.config,
33
+ this[kTracingCallbackCommand] = true
34
+ try {
35
+ return ch.traceCallback(executeWithCallback, 0, getContext(this), this, ...args)
36
+ } finally {
37
+ this[kTracingCallbackCommand] = false
35
38
  }
39
+ }
40
+ }
41
+
42
+ function wrapProcess (process) {
43
+ return function (...args) {
44
+ const cb = args[0]
45
+ if (!ch.start.hasSubscribers || typeof cb !== 'function') return process.apply(this, args)
46
+
47
+ if (this[kTracingCallbackCommand]) return process.apply(this, args)
48
+
49
+ const ctx = getContext(this)
36
50
 
37
51
  return ch.traceCallback(process, -1, ctx, this, ...args)
38
52
  }
39
53
  }
40
54
 
55
+ function getContext (command) {
56
+ return {
57
+ commandName: command.constructor.name,
58
+ commandArgs: command.args,
59
+ clientConfig: command.client.config,
60
+ }
61
+ }
62
+
41
63
  addHook({
42
64
  name: 'aerospike',
43
65
  file: 'lib/commands/command.js',
@@ -70,7 +70,6 @@ const instrumentedProtos = new WeakSet()
70
70
  * observer attaches at most once (a promise settles only once). Instances we don't observe
71
71
  * never set `ON_SETTLE`, so for them the wrappers are a single property read and a passthrough.
72
72
  * @param {object} proto - The DurablePromise prototype (`Object.getPrototypeOf(dp)`).
73
- * @returns {void}
74
73
  */
75
74
  function instrumentDurablePromiseProto (proto) {
76
75
  if (instrumentedProtos.has(proto)) return
@@ -97,7 +96,6 @@ function instrumentDurablePromiseProto (proto) {
97
96
  * @param {object} dp - The returned DurablePromise instance.
98
97
  * @param {(err: unknown) => void} onSettle - Called once with `undefined` on success or the
99
98
  * rejection reason on failure.
100
- * @returns {void}
101
99
  */
102
100
  function observeDurablePromise (dp, onSettle) {
103
101
  if (!dp || typeof dp.then !== 'function') return
@@ -77,7 +77,6 @@ const clientNameCache = new WeakMap()
77
77
 
78
78
  /**
79
79
  * @param {Function} clientCtor
80
- * @returns {string}
81
80
  */
82
81
  function getClientName (clientCtor) {
83
82
  let name = clientNameCache.get(clientCtor)
@@ -93,7 +92,6 @@ const operationCache = new WeakMap()
93
92
 
94
93
  /**
95
94
  * @param {Function} commandCtor
96
- * @returns {string}
97
95
  */
98
96
  function getOperationName (commandCtor) {
99
97
  let operation = operationCache.get(commandCtor)
@@ -353,7 +353,6 @@ function getToolResultContent (chunk, toolUseId) {
353
353
  * @param {SessionContext | null | undefined} sessionCtx
354
354
  * @param {GetLifecycle} getLifecycle
355
355
  * @param {ToolLifecycle} lifecycle
356
- * @returns {number} index in chunks where the next step should start iteration
357
356
  */
358
357
  function processTool (chunks, startIndex, toolUseId, sessionCtx, getLifecycle, lifecycle) {
359
358
  let chunkIndex = startIndex
@@ -412,7 +411,6 @@ function processTool (chunks, startIndex, toolUseId, sessionCtx, getLifecycle, l
412
411
  * @param {StepContext | null | undefined} stepCtx
413
412
  * @param {SessionContext | null | undefined} sessionCtx
414
413
  * @param {GetLifecycle} getLifecycle
415
- * @returns {number} index in chunks where the next step should start iteration
416
414
  */
417
415
  function processStep (
418
416
  chunks,
@@ -0,0 +1,97 @@
1
+ 'use strict'
2
+
3
+ const shimmer = require('../../datadog-shimmer')
4
+ const { channel } = require('./helpers/instrument')
5
+
6
+ const configureCh = channel('ci:log-submission:console:configure')
7
+ const logSubmissionCh = channel('ci:log-submission:console')
8
+ const vitestSuiteStartCh = channel('ci:vitest:test-suite:start')
9
+ const methods = ['error', 'warn']
10
+ const methodSet = new Set(methods)
11
+ const wrappedTargets = new WeakSet()
12
+
13
+ let callDepth = 0
14
+ let configuredGetLogHolder
15
+ let isVitestConsoleSubscribed = false
16
+
17
+ /**
18
+ * @param {string} method
19
+ * @param {unknown[]} args
20
+ * @param {(() => { dd: object } | undefined) | undefined} getLogHolder
21
+ */
22
+ function publishLog (method, args, getLogHolder) {
23
+ if (!logSubmissionCh.hasSubscribers) return
24
+
25
+ try {
26
+ const logHolder = (getLogHolder || configuredGetLogHolder)?.()
27
+ if (logHolder) logSubmissionCh.publish({ args, logHolder, method })
28
+ } catch {}
29
+ }
30
+
31
+ /**
32
+ * @param {object} target
33
+ * @param {(() => { dd: object } | undefined) | undefined} [getLogHolder]
34
+ */
35
+ function wrapConsole (target, getLogHolder) {
36
+ if (!target || wrappedTargets.has(target)) return
37
+
38
+ wrappedTargets.add(target)
39
+ for (const method of methods) {
40
+ if (typeof target[method] !== 'function') continue
41
+
42
+ // Global console methods are bound at runtime, so source rewriting cannot intercept them.
43
+ try {
44
+ shimmer.wrap(target, method, original => function () {
45
+ const shouldPublish = callDepth++ === 0
46
+ try {
47
+ const result = original.apply(this, arguments)
48
+ if (shouldPublish) publishLog(method, [...arguments], getLogHolder)
49
+ return result
50
+ } finally {
51
+ callDepth--
52
+ }
53
+ })
54
+ } catch {}
55
+ }
56
+ }
57
+
58
+ /**
59
+ * @param {{ BufferedConsole?: Function, CustomConsole?: Function }} jestConsole
60
+ * @param {(() => { dd: object } | undefined) | undefined} [getLogHolder]
61
+ */
62
+ function wrapJestConsole (jestConsole, getLogHolder) {
63
+ if (!getLogHolder && !configuredGetLogHolder) return
64
+
65
+ const { BufferedConsole, CustomConsole } = jestConsole
66
+
67
+ if (BufferedConsole && !wrappedTargets.has(BufferedConsole)) {
68
+ wrappedTargets.add(BufferedConsole)
69
+ // Jest bundles and exports these adapter classes differently across versions, so wrap their runtime exports.
70
+ shimmer.wrap(BufferedConsole, 'write', original => function (buffer, method, message) {
71
+ const result = original.apply(this, arguments)
72
+ if (methodSet.has(method)) publishLog(method, [message], getLogHolder)
73
+ return result
74
+ })
75
+ }
76
+
77
+ if (CustomConsole && !wrappedTargets.has(CustomConsole)) {
78
+ wrappedTargets.add(CustomConsole)
79
+ shimmer.wrap(CustomConsole.prototype, '_logError', original => function (method, message) {
80
+ const result = original.apply(this, arguments)
81
+ if (methodSet.has(method)) publishLog(method, [message], getLogHolder)
82
+ return result
83
+ })
84
+ }
85
+ }
86
+
87
+ configureCh.subscribe(({ getLogHolder } = {}) => {
88
+ configuredGetLogHolder = getLogHolder
89
+ wrapConsole(globalThis.console)
90
+ if (!isVitestConsoleSubscribed) {
91
+ isVitestConsoleSubscribed = true
92
+ // Vitest replaces the global console after tracer startup and before the first suite starts.
93
+ vitestSuiteStartCh.subscribe(() => wrapConsole(globalThis.console))
94
+ }
95
+ })
96
+
97
+ module.exports = { wrapConsole, wrapJestConsole }
@@ -12,6 +12,7 @@ const {
12
12
  getEfdRetryCountForDuration,
13
13
  hasEfdRetries,
14
14
  } = require('../../dd-trace/src/ci-visibility/efd-retry-policy')
15
+ const { getDynamicAtrRetryCount } = require('../../dd-trace/src/ci-visibility/dynamic-atr-retries')
15
16
  const {
16
17
  getCoveredFilesFromCoverage,
17
18
  getExecutableFilesFromCoverage,
@@ -77,7 +78,6 @@ const CUCUMBER_RETRY_NAME_SUFFIX = / ?\(attempt \d+(?:, retried)?\) ?$/
77
78
  *
78
79
  * @param {string} testName
79
80
  * @param {boolean} isRetry
80
- * @returns {string}
81
81
  */
82
82
  function getCucumberTestName (testName, isRetry) {
83
83
  return isRetry ? testName.replace(CUCUMBER_RETRY_NAME_SUFFIX, '') : testName
@@ -129,6 +129,8 @@ let earlyFlakeDetectionRetryPolicy = EMPTY_EFD_RETRY_POLICY
129
129
  let earlyFlakeDetectionFaultyThreshold = 0
130
130
  let isEarlyFlakeDetectionFaulty = false
131
131
  let isFlakyTestRetriesEnabled = false
132
+ let isDynamicAtrEnabled = false
133
+ let dynamicAtrBuckets
132
134
  let isKnownTestsEnabled = false
133
135
  let isTestManagementTestsEnabled = false
134
136
  let isImpactedTestsEnabled = false
@@ -142,9 +144,6 @@ let isSuitesSkipped = false
142
144
  let areAllSuitesSkipped = false
143
145
  let repositoryRoot
144
146
 
145
- /**
146
- * @returns {boolean}
147
- */
148
147
  function shouldRunEarlyFlakeDetection () {
149
148
  return isEarlyFlakeDetectionEnabled && hasEfdRetries(earlyFlakeDetectionRetryPolicy)
150
149
  }
@@ -243,7 +242,9 @@ function configureParallelWorkerWorldParameters (options) {
243
242
  isKnownTestsEnabled = false
244
243
  options.worldParameters._ddIsEarlyFlakeDetectionEnabled = false
245
244
  options.worldParameters._ddIsKnownTestsEnabled = false
246
- options.worldParameters._ddEarlyFlakeDetectionRetryPolicy = EMPTY_EFD_RETRY_POLICY
245
+ options.worldParameters._ddEarlyFlakeDetectionRetryPolicy = isDynamicAtrEnabled
246
+ ? earlyFlakeDetectionRetryPolicy
247
+ : EMPTY_EFD_RETRY_POLICY
247
248
  }
248
249
 
249
250
  if (isImpactedTestsEnabled) {
@@ -253,6 +254,8 @@ function configureParallelWorkerWorldParameters (options) {
253
254
 
254
255
  options.worldParameters._ddIsFlakyTestRetriesEnabled = isFlakyTestRetriesEnabled
255
256
  options.worldParameters._ddNumTestRetries = numTestRetries
257
+ options.worldParameters._ddIsDynamicAtrEnabled = isDynamicAtrEnabled
258
+ options.worldParameters._ddDynamicAtrBuckets = dynamicAtrBuckets
256
259
 
257
260
  if (isTestManagementTestsEnabled) {
258
261
  options.worldParameters._ddIsTestManagementTestsEnabled = true
@@ -282,8 +285,7 @@ function readParallelWorkerWorldParameters (options) {
282
285
  if (isImpactedTestsEnabled) {
283
286
  modifiedFiles = worldParameters._ddModifiedFiles
284
287
  }
285
- isFlakyTestRetriesEnabled = !!worldParameters._ddIsFlakyTestRetriesEnabled
286
- numTestRetries = worldParameters._ddNumTestRetries ?? 0
288
+ readParallelWorkerAtrParameters(worldParameters)
287
289
  isTestManagementTestsEnabled = !!worldParameters._ddIsTestManagementTestsEnabled
288
290
  if (isTestManagementTestsEnabled) {
289
291
  testManagementTests = worldParameters._ddTestManagementTests
@@ -291,6 +293,25 @@ function readParallelWorkerWorldParameters (options) {
291
293
  }
292
294
  }
293
295
 
296
+ /**
297
+ * @param {object} worldParameters
298
+ * @param {boolean} [worldParameters._ddIsFlakyTestRetriesEnabled]
299
+ * @param {number} [worldParameters._ddNumTestRetries]
300
+ * @param {boolean} [worldParameters._ddIsDynamicAtrEnabled]
301
+ * @param {number[]} [worldParameters._ddDynamicAtrBuckets]
302
+ * @param {import('../../dd-trace/src/ci-visibility/efd-retry-policy').EfdRetryPolicy}
303
+ * [worldParameters._ddEarlyFlakeDetectionRetryPolicy]
304
+ */
305
+ function readParallelWorkerAtrParameters (worldParameters) {
306
+ isFlakyTestRetriesEnabled = !!worldParameters._ddIsFlakyTestRetriesEnabled
307
+ numTestRetries = worldParameters._ddNumTestRetries ?? 0
308
+ isDynamicAtrEnabled = !!worldParameters._ddIsDynamicAtrEnabled
309
+ dynamicAtrBuckets = worldParameters._ddDynamicAtrBuckets
310
+ if (isDynamicAtrEnabled) {
311
+ earlyFlakeDetectionRetryPolicy = worldParameters._ddEarlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY
312
+ }
313
+ }
314
+
294
315
  function handleDdWorkerMessage (message) {
295
316
  if (Array.isArray(message)) {
296
317
  const [messageCode, payload] = message
@@ -430,7 +451,8 @@ function getWrappedHandleWorkerThreadEvent (handleEventFromWorker) {
430
451
 
431
452
  const result = handleEventFromWorker.apply(this, arguments)
432
453
 
433
- if (envelope.testCaseFinished && assembledTestCase?.pickle && eventDataCollector) {
454
+ if (envelope.testCaseFinished && !envelope.testCaseFinished.willBeRetried &&
455
+ assembledTestCase?.pickle && eventDataCollector) {
434
456
  const worstTestStepResult =
435
457
  eventDataCollector.getTestCaseAttempt(envelope.testCaseFinished.testCaseStartedId).worstTestStepResult
436
458
  handleParallelTestCaseFinished(assembledTestCase.pickle, worstTestStepResult)
@@ -713,6 +735,17 @@ function publishRetriedAttempt (runner, state) {
713
735
  const isFirstAttempt = currentAttempt === 0
714
736
  const isAtrRetry = !isFirstAttempt && isFlakyTestRetriesEnabled
715
737
 
738
+ if (isFirstAttempt && isDynamicAtrEnabled && isFlakyTestRetriesEnabled) {
739
+ state.dynamicAtrRetryCount = getDynamicAtrRetryCount(
740
+ performance.now() - state.executionStart,
741
+ earlyFlakeDetectionRetryPolicy,
742
+ dynamicAtrBuckets
743
+ )
744
+ // Native retries revisit maxAttempts before the next attempt in both runner
745
+ // generations. EFD and Attempt to Fix disable native retries, so never reach here.
746
+ runner.maxAttempts = state.dynamicAtrRetryCount + 1
747
+ }
748
+
716
749
  // ATR: record this attempt as failed so when run().finally runs (after retry) we have all statuses
717
750
  if (isFlakyTestRetriesEnabled) {
718
751
  const nameForKey = getCucumberTestName(runner.pickle.name, currentAttempt > 0)
@@ -768,6 +801,12 @@ function wrapRun (pl, isLatestVersion, version) {
768
801
  return run.apply(this, args)
769
802
  }
770
803
 
804
+ // Cucumber 8–10 workers construct runners directly, without the newer
805
+ // runTestCase wrapper that reads the coordinator's configuration.
806
+ if (getEnvironmentVariable('CUCUMBER_WORKER_ID') && satisfies(version, '>=8.0.0 <11.0.0')) {
807
+ readParallelWorkerAtrParameters(this.worldParameters)
808
+ }
809
+
771
810
  const testFileAbsolutePath = this.pickle.uri
772
811
  const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
773
812
 
@@ -808,6 +847,7 @@ function wrapRun (pl, isLatestVersion, version) {
808
847
  }
809
848
  let promise
810
849
  const executionStart = performance.now()
850
+ state.executionStart = executionStart
811
851
 
812
852
  testFnCh.runStores(ctx, () => {
813
853
  promise = run.apply(this, args)
@@ -922,7 +962,9 @@ function wrapRun (pl, isLatestVersion, version) {
922
962
  const atrStatuses = atrStatusesByScenarioKey.get(atrKey)
923
963
  const pickleStatuses = lastStatusByPickleId.get(this.pickle.id)
924
964
  const statusesToCheck = atrStatuses?.length >= (numTestRetries + 1) ? atrStatuses : pickleStatuses
925
- if (statusesToCheck && statusesToCheck.length === numTestRetries + 1 &&
965
+ if (state.dynamicAtrRetryCount !== undefined) {
966
+ hasFailedAllRetries = status === 'fail' && state.numAttempt === state.dynamicAtrRetryCount
967
+ } else if (statusesToCheck && statusesToCheck.length === numTestRetries + 1 &&
926
968
  statusesToCheck.every(s => s === 'fail')) {
927
969
  hasFailedAllRetries = true
928
970
  }
@@ -959,7 +1001,8 @@ function wrapRun (pl, isLatestVersion, version) {
959
1001
 
960
1002
  // Notice that ATR is handled using cucumber native retries features.
961
1003
  // Therefore, if we reach this point, we are certain that it's the last ATR execution
962
- const isLastAtrRetry = isFlakyTestRetriesEnabled && !isAttemptToFix && !isEfdRetry && numTestRetries > 0
1004
+ const isLastAtrRetry = isFlakyTestRetriesEnabled && !isAttemptToFix && !isEfdRetry &&
1005
+ numTestRetries > 0 && this.maxAttempts > 1
963
1006
 
964
1007
  const statuses = lastStatusByPickleId.get(this.pickle.id)
965
1008
  const isLastEfdRetry = isEfdRetry && statuses?.length === efdRetryCount + 1
@@ -1100,8 +1143,17 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
1100
1143
  isSuitesSkippingEnabled = isItrEnabled && configurationResponse.libraryConfig?.isSuitesSkippingEnabled
1101
1144
  isCoverageReportUploadEnabled = configurationResponse.libraryConfig?.isCoverageReportUploadEnabled
1102
1145
  isFlakyTestRetriesEnabled = configurationResponse.libraryConfig?.isFlakyTestRetriesEnabled
1146
+ isDynamicAtrEnabled = configurationResponse.libraryConfig?.isDynamicAtrEnabled === true &&
1147
+ satisfies(frameworkVersion, '>=8.0.0')
1148
+ dynamicAtrBuckets = configurationResponse.libraryConfig?.dynamicAtrBuckets
1103
1149
  const configRetryCount = configurationResponse.libraryConfig?.flakyTestRetriesCount
1104
1150
  numTestRetries = (typeof configRetryCount === 'number' && configRetryCount > 0) ? configRetryCount : 0
1151
+ if (isDynamicAtrEnabled) {
1152
+ // Reserve enough native attempts until the first failure determines its budget.
1153
+ numTestRetries = Math.max(1, dynamicAtrBuckets
1154
+ ? Math.max(...dynamicAtrBuckets)
1155
+ : earlyFlakeDetectionRetryPolicy.schedulingRetryCount)
1156
+ }
1105
1157
  isKnownTestsEnabled = configurationResponse.libraryConfig?.isKnownTestsEnabled
1106
1158
  isTestManagementTestsEnabled = configurationResponse.libraryConfig?.isTestManagementEnabled
1107
1159
  testManagementAttemptToFixRetries = configurationResponse.libraryConfig?.testManagementAttemptToFixRetries
@@ -1204,6 +1256,10 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
1204
1256
  options.retry = numTestRetries
1205
1257
  }
1206
1258
 
1259
+ if (isParallel && !isCoordinator) {
1260
+ configureParallelWorkerWorldParameters(options)
1261
+ }
1262
+
1207
1263
  atrStatusesByScenarioKey.clear()
1208
1264
  attemptToFixTestsByTestFullname.clear()
1209
1265
  efdRetryCountByPickleId.clear()
@@ -1272,8 +1328,17 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
1272
1328
  global.__coverage__ = fromCoverageMapToCoverage(originalCoverageMap)
1273
1329
  }
1274
1330
 
1331
+ const testCaseAttempts = (this.eventDataCollector || eventDataCollector).getTestCaseAttempts()
1332
+ const getStatus = satisfies(frameworkVersion, '>=7.3.0') ? getStatusFromResultLatest : getStatusFromResult
1333
+ const hasExecutedTests = testCaseAttempts.some(({ worstTestStepResult }) =>
1334
+ getStatus(worstTestStepResult).status !== 'skip'
1335
+ )
1336
+ const testSessionEmptyReason = success && !hasExecutedTests
1337
+ ? (testCaseAttempts.length > 0 || skippedSuites.length > 0 ? 'all_tests_skipped' : 'zero_tests')
1338
+ : undefined
1275
1339
  const flushPromise = getChannelPromise(sessionFinishCh, {
1276
- status: success ? 'pass' : 'fail',
1340
+ status: testSessionEmptyReason ? 'skip' : (success ? 'pass' : 'fail'),
1341
+ testSessionEmptyReason,
1277
1342
  isSuitesSkipped,
1278
1343
  testCodeCoverageLinesTotal,
1279
1344
  testSessionCoverageFiles,
@@ -1550,7 +1615,7 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion,
1550
1615
  const parseWorkerResponse = parseWorkerMessageFunction.apply(this, arguments)
1551
1616
 
1552
1617
  // after calling `parseWorkerMessageFunction`, the test status can already be read
1553
- if (parsed.testCaseFinished) {
1618
+ if (parsed.testCaseFinished && !parsed.testCaseFinished.willBeRetried) {
1554
1619
  let worstTestStepResult
1555
1620
  if (isNewVersion && eventDataCollector) {
1556
1621
  pickle = this.inProgress[worker.id].pickle