dd-trace 6.15.0 → 6.17.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.
- package/README.md +15 -0
- package/ci/diagnose.js +0 -23
- package/ci/test-optimization-validation/approval-artifacts.js +0 -3
- package/ci/test-optimization-validation/approval.js +0 -6
- package/ci/test-optimization-validation/artifact-id.js +0 -1
- package/ci/test-optimization-validation/bounded-json.js +0 -1
- package/ci/test-optimization-validation/cli.js +0 -12
- package/ci/test-optimization-validation/command-output-policy.js +0 -1
- package/ci/test-optimization-validation/command-runner.js +0 -3
- package/ci/test-optimization-validation/environment.js +0 -4
- package/ci/test-optimization-validation/executable-approval.js +0 -1
- package/ci/test-optimization-validation/executable.js +0 -5
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +4 -8
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -3
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -6
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -4
- package/ci/test-optimization-validation/generated-test-contract.js +0 -5
- package/ci/test-optimization-validation/generated-verifier.js +0 -1
- package/ci/test-optimization-validation/literal-environment.js +0 -1
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -17
- package/ci/test-optimization-validation/manifest-schema.js +0 -21
- package/ci/test-optimization-validation/offline-fixtures.js +0 -4
- package/ci/test-optimization-validation/package-check.js +4 -1
- package/ci/test-optimization-validation/plan-writer.js +0 -11
- package/ci/test-optimization-validation/preflight-runner.js +0 -1
- package/ci/test-optimization-validation/redaction.js +0 -4
- package/ci/test-optimization-validation/report-writer.js +0 -16
- package/ci/test-optimization-validation/runner-command.js +0 -3
- package/ci/test-optimization-validation/runner-contract.js +0 -4
- package/ci/test-optimization-validation/safe-files.js +0 -1
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -1
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +1 -2
- package/ci/test-optimization-validation/source-text.js +0 -3
- package/ci/vitest-no-worker-init-setup.mjs +41 -16
- package/index.d.ts +169 -0
- package/next.d.ts +27 -0
- package/next.js +3 -0
- package/package.json +28 -23
- package/packages/datadog-esbuild/index.js +14 -1
- package/packages/datadog-esbuild/src/resolver.js +284 -0
- package/packages/datadog-esbuild/src/utils.js +162 -120
- package/packages/datadog-instrumentations/src/aerospike.js +28 -6
- package/packages/datadog-instrumentations/src/ai.js +39 -97
- package/packages/datadog-instrumentations/src/anthropic.js +76 -134
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +1 -3
- package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/azure-cosmos.js +1 -1
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +23 -9
- package/packages/datadog-instrumentations/src/azure-functions.js +48 -0
- package/packages/datadog-instrumentations/src/bullmq.js +1 -1
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +1 -3
- package/packages/datadog-instrumentations/src/console.js +97 -0
- package/packages/datadog-instrumentations/src/cucumber.js +72 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +0 -23
- package/packages/datadog-instrumentations/src/dd-trace-api.js +2 -2
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +39 -14
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +25 -8
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +69 -0
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +13 -64
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +109 -29
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +39 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/azure-durable-functions.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -16
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +36 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/supabase.js +128 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +6 -7
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +99 -75
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
- package/packages/datadog-instrumentations/src/jest.js +141 -51
- package/packages/datadog-instrumentations/src/knex.js +0 -1
- package/packages/datadog-instrumentations/src/langchain.js +1 -1
- package/packages/datadog-instrumentations/src/langgraph.js +1 -1
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +0 -24
- package/packages/datadog-instrumentations/src/mariadb.js +0 -2
- package/packages/datadog-instrumentations/src/mercurius.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/common.js +0 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +22 -25
- package/packages/datadog-instrumentations/src/mocha/utils.js +119 -49
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +0 -6
- package/packages/datadog-instrumentations/src/mocha/worker.js +14 -17
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +0 -2
- package/packages/datadog-instrumentations/src/openai-agents.js +1 -1
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +241 -0
- package/packages/datadog-instrumentations/src/openai-realtime/events.js +76 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +301 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +998 -0
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +211 -0
- package/packages/datadog-instrumentations/src/openai.js +97 -80
- package/packages/datadog-instrumentations/src/oracledb.js +9 -3
- package/packages/datadog-instrumentations/src/playwright-reporter.js +3 -16
- package/packages/datadog-instrumentations/src/playwright.js +238 -55
- package/packages/datadog-instrumentations/src/postgres.js +7 -0
- package/packages/datadog-instrumentations/src/router.js +0 -2
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +0 -2
- package/packages/datadog-instrumentations/src/sequelize.js +0 -1
- package/packages/datadog-instrumentations/src/supabase.js +15 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +37 -17
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +56 -23
- package/packages/datadog-instrumentations/src/webdriverio.js +23 -42
- package/packages/datadog-instrumentations/src/ws.js +0 -1
- package/packages/datadog-plugin-ai/src/utils.js +0 -2
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +0 -1
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +0 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +7 -2
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/util.js +0 -1
- package/packages/datadog-plugin-azure-cosmos/src/index.js +1 -1
- package/packages/datadog-plugin-azure-durable-functions/src/index.js +95 -1
- package/packages/datadog-plugin-cucumber/src/index.js +10 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +171 -75
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +0 -4
- package/packages/datadog-plugin-cypress/src/support.js +52 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -24
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +2 -36
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +31 -0
- package/packages/datadog-plugin-graphql/src/resolve-error.js +32 -11
- package/packages/datadog-plugin-graphql/src/utils.js +0 -5
- package/packages/datadog-plugin-jest/src/index.js +13 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +39 -11
- package/packages/datadog-plugin-mongodb-core/src/query.js +0 -1
- package/packages/datadog-plugin-openai/src/index.js +16 -1
- package/packages/datadog-plugin-openai/src/realtime.js +144 -0
- package/packages/datadog-plugin-openai-agents/src/integration.js +0 -4
- package/packages/datadog-plugin-openai-agents/src/util.js +0 -1
- package/packages/datadog-plugin-playwright/src/index.js +76 -9
- package/packages/datadog-plugin-postgres/src/index.js +167 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +0 -1
- package/packages/datadog-plugin-redis/src/index.js +15 -1
- package/packages/datadog-plugin-supabase/src/error.js +18 -0
- package/packages/datadog-plugin-supabase/src/index.js +21 -0
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +69 -0
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +70 -0
- package/packages/datadog-plugin-supabase/src/supabase-postgrest-js-postgrestbuilder-then.js +122 -0
- package/packages/datadog-plugin-supabase/src/supabase-realtime-js-realtimechannel-send.js +66 -0
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +93 -0
- package/packages/datadog-plugin-supabase/src/url.js +17 -0
- package/packages/datadog-plugin-vitest/src/index.js +10 -0
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-turbopack/index.js +206 -0
- package/packages/datadog-turbopack/src/constants.js +5 -0
- package/packages/datadog-turbopack/src/loader.js +484 -0
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/aiguard/client.js +2 -3
- package/packages/dd-trace/src/aiguard/evaluation.js +6 -12
- package/packages/dd-trace/src/aiguard/index.js +3 -2
- package/packages/dd-trace/src/aiguard/integrations/anthropic.js +53 -25
- package/packages/dd-trace/src/aiguard/integrations/evaluate.js +49 -25
- package/packages/dd-trace/src/aiguard/integrations/index.js +4 -3
- package/packages/dd-trace/src/aiguard/integrations/openai.js +132 -29
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +116 -42
- package/packages/dd-trace/src/aiguard/messages/anthropic.js +0 -2
- package/packages/dd-trace/src/aiguard/messages/openai.js +64 -1
- package/packages/dd-trace/src/aiguard/messages/utils.js +29 -2
- package/packages/dd-trace/src/aiguard/messages/vercel-ai.js +25 -0
- package/packages/dd-trace/src/aiguard/redaction.js +0 -1
- package/packages/dd-trace/src/aiguard/sdk.js +1 -1
- package/packages/dd-trace/src/appsec/activation.js +1 -1
- package/packages/dd-trace/src/appsec/api_security/normalized-route.js +0 -5
- package/packages/dd-trace/src/appsec/api_security/sampler.js +0 -4
- package/packages/dd-trace/src/appsec/blocking/index.js +3 -3
- package/packages/dd-trace/src/appsec/downstream_requests.js +1 -4
- package/packages/dd-trace/src/appsec/iast/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +5 -5
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +3 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +8 -10
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +4 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +7 -7
- package/packages/dd-trace/src/appsec/index.js +2 -2
- package/packages/dd-trace/src/appsec/lambda.js +71 -2
- package/packages/dd-trace/src/appsec/rasp/utils.js +5 -1
- package/packages/dd-trace/src/appsec/remote_config.js +8 -6
- package/packages/dd-trace/src/appsec/reporter.js +10 -6
- package/packages/dd-trace/src/appsec/rule_manager.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +0 -2
- package/packages/dd-trace/src/appsec/telemetry/api_security.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/common.js +4 -0
- package/packages/dd-trace/src/appsec/telemetry/index.js +23 -5
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +1 -20
- package/packages/dd-trace/src/appsec/telemetry/user.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/waf.js +1 -20
- package/packages/dd-trace/src/appsec/waf/index.js +2 -2
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +8 -5
- package/packages/dd-trace/src/carrier.js +0 -5
- package/packages/dd-trace/src/ci-visibility/dynamic-atr-retries.js +104 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +0 -2
- package/packages/dd-trace/src/ci-visibility/efd-retry-policy.js +34 -3
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -4
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +37 -15
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -3
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +0 -11
- package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +0 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +0 -6
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -2
- package/packages/dd-trace/src/ci-visibility/requests/rate-limit.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +0 -5
- package/packages/dd-trace/src/ci-visibility/requests/video-request.js +0 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +13 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +0 -1
- package/packages/dd-trace/src/ci-visibility/test-screenshot.js +0 -2
- package/packages/dd-trace/src/ci-visibility/test-video.js +0 -1
- package/packages/dd-trace/src/config/defaults.js +3 -2
- package/packages/dd-trace/src/config/generated-config-types.d.ts +74 -66
- package/packages/dd-trace/src/config/helper.js +9 -2
- package/packages/dd-trace/src/config/index.js +44 -29
- package/packages/dd-trace/src/config/parsers.js +34 -6
- package/packages/dd-trace/src/config/remote_config.js +25 -109
- package/packages/dd-trace/src/config/supported-configurations.json +146 -9
- package/packages/dd-trace/src/datastreams/encoding.js +0 -1
- package/packages/dd-trace/src/datastreams/pathway.js +0 -1
- package/packages/dd-trace/src/debugger/constants.js +10 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +76 -17
- package/packages/dd-trace/src/debugger/devtools_client/config.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/guardrail-metrics.js +15 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +103 -27
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +50 -7
- package/packages/dd-trace/src/debugger/devtools_client/log.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +34 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +40 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +53 -13
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +118 -71
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +20 -6
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +50 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +0 -3
- package/packages/dd-trace/src/debugger/probe_sampler.js +133 -9
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +31 -1
- package/packages/dd-trace/src/dogstatsd.js +0 -23
- package/packages/dd-trace/src/encode/0.4-cross-payload.js +0 -3
- package/packages/dd-trace/src/encode/0.4.js +0 -7
- package/packages/dd-trace/src/encode/0.5.js +0 -2
- package/packages/dd-trace/src/encode/tags-processors.js +0 -1
- package/packages/dd-trace/src/evp_proxy/discovery.js +3 -5
- package/packages/dd-trace/src/evp_proxy/path.js +11 -4
- package/packages/dd-trace/src/exporters/agent/writer.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/intake.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/writer.js +0 -3
- package/packages/dd-trace/src/exporters/common/docker.js +4 -1
- package/packages/dd-trace/src/exporters/common/final-flush-request-tracker.js +0 -6
- package/packages/dd-trace/src/exporters/common/proxy.js +3 -0
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/common/url.js +0 -2
- package/packages/dd-trace/src/exporters/common/writer.js +0 -2
- package/packages/dd-trace/src/id.js +0 -11
- package/packages/dd-trace/src/llmobs/audio-codec.js +192 -0
- package/packages/dd-trace/src/llmobs/audio-utils.js +121 -0
- package/packages/dd-trace/src/llmobs/constants/audio.js +35 -0
- package/packages/dd-trace/src/llmobs/constants/prompts.js +14 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +17 -0
- package/packages/dd-trace/src/llmobs/eval-metric.js +0 -6
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +0 -4
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +0 -3
- package/packages/dd-trace/src/llmobs/experiments/index.js +7 -6
- package/packages/dd-trace/src/llmobs/experiments/util.js +1 -11
- package/packages/dd-trace/src/llmobs/index.js +1 -3
- package/packages/dd-trace/src/llmobs/noop.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +0 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +285 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +16 -3
- package/packages/dd-trace/src/llmobs/prompts/cache.js +272 -0
- package/packages/dd-trace/src/llmobs/prompts/manager.js +639 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +92 -0
- package/packages/dd-trace/src/llmobs/sdk.js +21 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +81 -2
- package/packages/dd-trace/src/llmobs/tagger.js +30 -7
- package/packages/dd-trace/src/llmobs/telemetry.js +36 -4
- package/packages/dd-trace/src/llmobs/util.js +0 -34
- package/packages/dd-trace/src/llmobs/writers/base.js +0 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/channels.js +3 -0
- package/packages/dd-trace/src/log/index.js +23 -5
- package/packages/dd-trace/src/log-submission/log-submission-plugin.js +74 -6
- package/packages/dd-trace/src/msgpack/chunk.js +0 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +0 -12
- package/packages/dd-trace/src/openfeature/encoding.js +0 -2
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/index.js +0 -4
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/span-enrichment.js +0 -4
- package/packages/dd-trace/src/openfeature/writers/base.js +0 -6
- package/packages/dd-trace/src/openfeature/writers/exposures.js +0 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +0 -4
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +0 -2
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +103 -35
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +36 -13
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +0 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +0 -3
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +0 -6
- package/packages/dd-trace/src/opentracing/span_context.js +0 -1
- package/packages/dd-trace/src/otel-thread-ctx.js +38 -11
- package/packages/dd-trace/src/payload-tagging/tagging.js +15 -3
- package/packages/dd-trace/src/plugin_manager.js +9 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +0 -1
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +8 -0
- package/packages/dd-trace/src/plugins/plugin.js +0 -4
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +1 -3
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +0 -1
- package/packages/dd-trace/src/plugins/util/llm.js +0 -2
- package/packages/dd-trace/src/plugins/util/status-validator.js +0 -1
- package/packages/dd-trace/src/plugins/util/test.js +25 -21
- package/packages/dd-trace/src/plugins/util/url.js +0 -5
- package/packages/dd-trace/src/priority_sampler.js +0 -6
- package/packages/dd-trace/src/process-tags/index.js +0 -1
- package/packages/dd-trace/src/profiler.js +132 -35
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +0 -1
- package/packages/dd-trace/src/profiling/profiler.js +101 -41
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +29 -15
- package/packages/dd-trace/src/propagation-hash/index.js +0 -1
- package/packages/dd-trace/src/proxy.js +21 -45
- package/packages/dd-trace/src/random_sampler.js +0 -4
- package/packages/dd-trace/src/rate_limiter.js +0 -4
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -9
- package/packages/dd-trace/src/remote_config/index.js +0 -1
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +0 -3
- package/packages/dd-trace/src/sampler.js +0 -4
- package/packages/dd-trace/src/sampling_rule.js +0 -7
- package/packages/dd-trace/src/serverless/vercel.js +0 -1
- package/packages/dd-trace/src/serverless.js +0 -1
- package/packages/dd-trace/src/service-naming/index.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +7 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +5 -0
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/span_sampler.js +0 -1
- package/packages/dd-trace/src/standalone/product.js +2 -2
- package/packages/dd-trace/src/standalone/tracesource.js +0 -1
- package/packages/dd-trace/src/startup-log.js +1 -1
- package/packages/dd-trace/src/telemetry/endpoints.js +0 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +16 -5
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +16 -6
- package/packages/dd-trace/src/telemetry/metrics.js +0 -2
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +0 -10
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const log = require('../log')
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
retriesForDuration,
|
|
7
|
+
retryBucketIndexForDuration,
|
|
8
|
+
} = require('./efd-retry-policy')
|
|
9
|
+
|
|
10
|
+
const DYNAMIC_ATR_ENABLED_ENV = 'DD_CIVISIBILITY_DYNAMIC_ATR_ENABLED'
|
|
11
|
+
const DYNAMIC_ATR_BUCKETS_ENV = 'DD_CIVISIBILITY_DYNAMIC_ATR_BUCKETS'
|
|
12
|
+
|
|
13
|
+
const RETRY_BUCKET_COUNT = 5
|
|
14
|
+
const MAX_RETRIES_PER_BUCKET = 20
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns whether duration-based ATR retry budgets are enabled.
|
|
18
|
+
*
|
|
19
|
+
* @param {unknown} value A parsed test-optimization configuration value.
|
|
20
|
+
*/
|
|
21
|
+
function isDynamicAtrEnabled (value) {
|
|
22
|
+
return value === true
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Parses and validates custom ATR retry buckets from the parsed
|
|
27
|
+
* test-optimization configuration.
|
|
28
|
+
*
|
|
29
|
+
* Returns a frozen array of 5 positive integers in [1, 20], or `null`
|
|
30
|
+
* when the value is unset/empty or invalid (in which case the EFD retry
|
|
31
|
+
* settings from the backend are used).
|
|
32
|
+
*
|
|
33
|
+
* @param {unknown} value A parsed test-optimization configuration value.
|
|
34
|
+
* @returns {number[] | null}
|
|
35
|
+
*/
|
|
36
|
+
function getDynamicAtrBuckets (value) {
|
|
37
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const parts = value
|
|
42
|
+
const raw = parts.join(',')
|
|
43
|
+
if (parts.length !== RETRY_BUCKET_COUNT) {
|
|
44
|
+
log.warn(
|
|
45
|
+
'Invalid %s value %o; expected five comma-separated integers in [1, %d]',
|
|
46
|
+
DYNAMIC_ATR_BUCKETS_ENV, raw, MAX_RETRIES_PER_BUCKET
|
|
47
|
+
)
|
|
48
|
+
return null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const buckets = []
|
|
52
|
+
for (const part of parts) {
|
|
53
|
+
const trimmedPart = typeof part === 'string' ? part.trim() : ''
|
|
54
|
+
if (!/^\d+$/.test(trimmedPart)) {
|
|
55
|
+
log.warn(
|
|
56
|
+
'Invalid %s value %o; expected five comma-separated integers in [1, %d]',
|
|
57
|
+
DYNAMIC_ATR_BUCKETS_ENV, raw, MAX_RETRIES_PER_BUCKET
|
|
58
|
+
)
|
|
59
|
+
return null
|
|
60
|
+
}
|
|
61
|
+
const value = Number(trimmedPart)
|
|
62
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > MAX_RETRIES_PER_BUCKET) {
|
|
63
|
+
log.warn(
|
|
64
|
+
'Invalid %s value %o; expected five comma-separated integers in [1, %d]',
|
|
65
|
+
DYNAMIC_ATR_BUCKETS_ENV, raw, MAX_RETRIES_PER_BUCKET
|
|
66
|
+
)
|
|
67
|
+
return null
|
|
68
|
+
}
|
|
69
|
+
buckets.push(value)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return Object.freeze(buckets)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Computes the dynamic ATR retry count for a test based on its initial-attempt
|
|
77
|
+
* duration.
|
|
78
|
+
*
|
|
79
|
+
* When `customBuckets` is provided, the bucket at the duration index is used.
|
|
80
|
+
* Otherwise, the EFD retry policy's `retriesForDuration` is used.
|
|
81
|
+
*
|
|
82
|
+
* The result is clamped to a minimum of 1.
|
|
83
|
+
*
|
|
84
|
+
* @param {number} durationMs - Initial-attempt duration in milliseconds.
|
|
85
|
+
* @param {import('./efd-retry-policy').EfdRetryPolicy} efdRetryPolicy
|
|
86
|
+
* @param {number[] | null} customBuckets
|
|
87
|
+
*/
|
|
88
|
+
function getDynamicAtrRetryCount (durationMs, efdRetryPolicy, customBuckets) {
|
|
89
|
+
let retryCount
|
|
90
|
+
if (customBuckets) {
|
|
91
|
+
retryCount = customBuckets[retryBucketIndexForDuration(durationMs)]
|
|
92
|
+
} else {
|
|
93
|
+
retryCount = retriesForDuration(durationMs, efdRetryPolicy)
|
|
94
|
+
}
|
|
95
|
+
return Math.max(1, retryCount)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = {
|
|
99
|
+
DYNAMIC_ATR_BUCKETS_ENV,
|
|
100
|
+
DYNAMIC_ATR_ENABLED_ENV,
|
|
101
|
+
getDynamicAtrBuckets,
|
|
102
|
+
getDynamicAtrRetryCount,
|
|
103
|
+
isDynamicAtrEnabled,
|
|
104
|
+
}
|
|
@@ -52,7 +52,6 @@ const limits = {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* @param {object} value - Snapshot object or sub-object.
|
|
55
|
-
* @returns {boolean}
|
|
56
55
|
*/
|
|
57
56
|
function isCapturedValue (value) {
|
|
58
57
|
return typeof value.type === 'string'
|
|
@@ -62,7 +61,6 @@ function isCapturedValue (value) {
|
|
|
62
61
|
* Remove empty capture containers before sending snapshots through the Test Optimization logs path.
|
|
63
62
|
*
|
|
64
63
|
* @param {object} value - Snapshot object or sub-object.
|
|
65
|
-
* @returns {void}
|
|
66
64
|
*/
|
|
67
65
|
function removeEmptyCaptureProperties (value) {
|
|
68
66
|
const stack = [value]
|
|
@@ -23,12 +23,43 @@ const EARLY_FLAKE_DETECTION_RETRY_BUCKETS =
|
|
|
23
23
|
* @property {number} schedulingRetryCount
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Returns the zero-based dynamic ATR retry-bucket index for a test duration.
|
|
28
|
+
*
|
|
29
|
+
* Bucket boundaries (ms): 5 000, 10 000, 30 000, 300 000.
|
|
30
|
+
* Durations at a boundary remain in that bucket.
|
|
31
|
+
*
|
|
32
|
+
* @param {number} durationMs
|
|
33
|
+
*/
|
|
34
|
+
function retryBucketIndexForDuration (durationMs) {
|
|
35
|
+
for (let index = 0; index < EARLY_FLAKE_DETECTION_RETRY_THRESHOLDS.length; index++) {
|
|
36
|
+
if (durationMs <= EARLY_FLAKE_DETECTION_RETRY_THRESHOLDS[index].limitMs) {
|
|
37
|
+
return index
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return EARLY_FLAKE_DETECTION_RETRY_THRESHOLDS.length // > 5 m bucket
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the backend retry budget using dynamic ATR's inclusive duration cutoffs.
|
|
45
|
+
*
|
|
46
|
+
* @param {number} durationMs
|
|
47
|
+
* @param {EfdRetryPolicy} retryPolicy
|
|
48
|
+
*/
|
|
49
|
+
function retriesForDuration (durationMs, retryPolicy) {
|
|
50
|
+
const index = retryBucketIndexForDuration(durationMs)
|
|
51
|
+
if (index < retryPolicy.durationRetryCounts.length) {
|
|
52
|
+
return retryPolicy.durationRetryCounts[index].retryCount
|
|
53
|
+
}
|
|
54
|
+
return 0
|
|
55
|
+
}
|
|
56
|
+
|
|
26
57
|
/**
|
|
27
58
|
* @param {number} durationMs
|
|
28
59
|
* @param {EfdRetryPolicy} retryPolicy
|
|
29
|
-
* @returns {number}
|
|
30
60
|
*/
|
|
31
61
|
function getEfdRetryCountForDuration (durationMs, retryPolicy) {
|
|
62
|
+
// EFD retains exclusive cutoffs, including no retries at exactly five minutes.
|
|
32
63
|
for (const { durationLimitMs, retryCount } of retryPolicy.durationRetryCounts) {
|
|
33
64
|
if (durationMs < durationLimitMs) {
|
|
34
65
|
return retryCount
|
|
@@ -62,7 +93,6 @@ function createEfdRetryPolicy (retriesByDuration = {}) {
|
|
|
62
93
|
|
|
63
94
|
/**
|
|
64
95
|
* @param {EfdRetryPolicy | undefined} retryPolicy
|
|
65
|
-
* @returns {boolean}
|
|
66
96
|
*/
|
|
67
97
|
function hasEfdRetries (retryPolicy) {
|
|
68
98
|
return (retryPolicy?.schedulingRetryCount ?? 0) > 0
|
|
@@ -71,7 +101,6 @@ function hasEfdRetries (retryPolicy) {
|
|
|
71
101
|
/**
|
|
72
102
|
* @param {number} retryIndex
|
|
73
103
|
* @param {number | undefined} retryCount
|
|
74
|
-
* @returns {boolean}
|
|
75
104
|
*/
|
|
76
105
|
function shouldSkipEfdRetry (retryIndex, retryCount) {
|
|
77
106
|
return retryCount !== undefined && retryIndex > retryCount
|
|
@@ -85,5 +114,7 @@ module.exports = {
|
|
|
85
114
|
createEfdRetryPolicy,
|
|
86
115
|
getEfdRetryCountForDuration,
|
|
87
116
|
hasEfdRetries,
|
|
117
|
+
retriesForDuration,
|
|
118
|
+
retryBucketIndexForDuration,
|
|
88
119
|
shouldSkipEfdRetry,
|
|
89
120
|
}
|
|
@@ -105,7 +105,6 @@ class CiValidationExporter extends CiVisibilityExporter {
|
|
|
105
105
|
/**
|
|
106
106
|
* Resolves the inherited git-upload gate without performing an upload.
|
|
107
107
|
*
|
|
108
|
-
* @returns {void}
|
|
109
108
|
*/
|
|
110
109
|
sendGitMetadata () {
|
|
111
110
|
this._resolveGit()
|
|
@@ -114,14 +113,12 @@ class CiValidationExporter extends CiVisibilityExporter {
|
|
|
114
113
|
/**
|
|
115
114
|
* Drops debugger logs in offline validation mode.
|
|
116
115
|
*
|
|
117
|
-
* @returns {void}
|
|
118
116
|
*/
|
|
119
117
|
exportDiLogs () {}
|
|
120
118
|
|
|
121
119
|
/**
|
|
122
120
|
* Reports that code coverage is outside the offline validator's scope.
|
|
123
121
|
*
|
|
124
|
-
* @returns {boolean} always false
|
|
125
122
|
*/
|
|
126
123
|
canReportCodeCoverage () {
|
|
127
124
|
return false
|
|
@@ -140,7 +137,6 @@ class CiValidationExporter extends CiVisibilityExporter {
|
|
|
140
137
|
/**
|
|
141
138
|
* Reports that screenshot upload is unavailable.
|
|
142
139
|
*
|
|
143
|
-
* @returns {boolean} always false
|
|
144
140
|
*/
|
|
145
141
|
canUploadTestScreenshots () {
|
|
146
142
|
return false
|
|
@@ -179,7 +179,6 @@ class CiValidationSink {
|
|
|
179
179
|
/**
|
|
180
180
|
* Atomically publishes this process's bounded completion evidence.
|
|
181
181
|
*
|
|
182
|
-
* @returns {boolean} whether the record was published
|
|
183
182
|
*/
|
|
184
183
|
#writeCompletionRecord () {
|
|
185
184
|
const directoryPath = path.join(this.#outputRoot, 'completions')
|
|
@@ -215,7 +214,6 @@ class CiValidationSink {
|
|
|
215
214
|
* Writes one completed JSON payload to a unique file.
|
|
216
215
|
*
|
|
217
216
|
* @param {Buffer} payload JSON payload
|
|
218
|
-
* @returns {boolean} whether the payload was written
|
|
219
217
|
*/
|
|
220
218
|
#writePayloadFile (payload) {
|
|
221
219
|
if (this.#fileCount >= MAX_OUTPUT_FILES) {
|
|
@@ -6,6 +6,10 @@ const URL = require('url').URL
|
|
|
6
6
|
|
|
7
7
|
const { version: tracerVersion } = require('../../../../../package.json')
|
|
8
8
|
const { EMPTY_EFD_RETRY_POLICY, createEfdRetryPolicy } = require('../efd-retry-policy')
|
|
9
|
+
const {
|
|
10
|
+
getDynamicAtrBuckets,
|
|
11
|
+
isDynamicAtrEnabled,
|
|
12
|
+
} = require('../dynamic-atr-retries')
|
|
9
13
|
const { getLibraryConfiguration: getLibraryConfigurationRequest } = require('../requests/get-library-configuration')
|
|
10
14
|
const { getCachePath, withCache, writeToCache } = require('../requests/fs-cache')
|
|
11
15
|
const { getSkippableSuites: getSkippableSuitesRequest } = require('../intelligent-test-runner/get-skippable-suites')
|
|
@@ -31,7 +35,7 @@ const {
|
|
|
31
35
|
FINAL_FLUSH_FALLBACK_DELAY,
|
|
32
36
|
FINAL_FLUSH_TIMEOUT,
|
|
33
37
|
} = require('../final-flush')
|
|
34
|
-
const { incrementCountMetric, TELEMETRY_ENDPOINT_PAYLOAD_DROPPED } = require('../telemetry')
|
|
38
|
+
const { incrementCountMetric, recordDynamicAtrRetries, TELEMETRY_ENDPOINT_PAYLOAD_DROPPED } = require('../telemetry')
|
|
35
39
|
const { sendGitMetadata: sendGitMetadataRequest } = require('./git/git_metadata')
|
|
36
40
|
const buildSettingsCacheKey = require('./settings-cache-key')
|
|
37
41
|
|
|
@@ -108,7 +112,6 @@ function isValidRetryCount (value) {
|
|
|
108
112
|
* Checks whether a cached EFD retry policy has the complete parsed shape.
|
|
109
113
|
*
|
|
110
114
|
* @param {unknown} retryPolicy - Candidate retry policy.
|
|
111
|
-
* @returns {boolean}
|
|
112
115
|
*/
|
|
113
116
|
function isValidCachedEfdRetryPolicy (retryPolicy) {
|
|
114
117
|
if (retryPolicy === null || typeof retryPolicy !== 'object' || Array.isArray(retryPolicy)) return false
|
|
@@ -208,6 +211,11 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
208
211
|
this._coverageTimer = undefined
|
|
209
212
|
this._logsTimer = undefined
|
|
210
213
|
this._coverageBuffer = []
|
|
214
|
+
const dynamicAtrEnabled = config?.testOptimization?.DD_CIVISIBILITY_DYNAMIC_ATR_ENABLED
|
|
215
|
+
const dynamicAtrBuckets = config?.testOptimization?.DD_CIVISIBILITY_DYNAMIC_ATR_BUCKETS
|
|
216
|
+
this._dynamicAtrEnabled = isDynamicAtrEnabled(dynamicAtrEnabled)
|
|
217
|
+
this._dynamicAtrBuckets = this._dynamicAtrEnabled ? getDynamicAtrBuckets(dynamicAtrBuckets) ?? undefined : undefined
|
|
218
|
+
this._hasRecordedDynamicAtrTelemetry = false
|
|
211
219
|
this._testOptimizationHttpCache = options.testOptimizationHttpCache || new TestOptimizationHttpCache()
|
|
212
220
|
this._isTestOptimizationCacheOnly = options.cacheOnly === true
|
|
213
221
|
const coverageReportFlags = parsers.ARRAY(config?.testOptimization?.DD_CODE_COVERAGE_FLAGS)
|
|
@@ -357,7 +365,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
357
365
|
*
|
|
358
366
|
* @param {TestConfiguration} testConfiguration
|
|
359
367
|
* @param {(error: Error | null, libraryConfig?: Readonly<Record<string, unknown>>) => void} callback
|
|
360
|
-
* @returns {void}
|
|
361
368
|
*/
|
|
362
369
|
getLibraryConfiguration (testConfiguration, callback) {
|
|
363
370
|
const { repositoryUrl } = testConfiguration
|
|
@@ -410,6 +417,7 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
410
417
|
// `_gitUploadPromise` itself. Do not call `_resolveGit()`.
|
|
411
418
|
writeSettingsToCache(libraryConfig)
|
|
412
419
|
this._libraryConfig = this.filterConfiguration(libraryConfig)
|
|
420
|
+
this._recordDynamicAtrTelemetry()
|
|
413
421
|
return callback(null, this._libraryConfig)
|
|
414
422
|
}
|
|
415
423
|
// Filesystem cache hit: no git upload was started in this process.
|
|
@@ -444,11 +452,11 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
444
452
|
* @param {string} repositoryUrl - Repository URL for git metadata upload.
|
|
445
453
|
* @param {boolean} isFilesystemCache - Whether settings came from the cross-process cache.
|
|
446
454
|
* @param {Function} callback - Completion callback.
|
|
447
|
-
* @returns {void}
|
|
448
455
|
*/
|
|
449
456
|
_applyCachedSettings (settings, configuration, repositoryUrl, isFilesystemCache, callback) {
|
|
450
457
|
writeSettingsToCache(settings)
|
|
451
458
|
this._libraryConfig = this.filterConfiguration(settings)
|
|
459
|
+
this._recordDynamicAtrTelemetry()
|
|
452
460
|
const canUseCachedSkippableSuites = !this.shouldRequestSkippableSuites() ||
|
|
453
461
|
this._testOptimizationHttpCache.hasValidSkippableSuites({
|
|
454
462
|
testLevel: configuration.testLevel,
|
|
@@ -471,7 +479,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
471
479
|
* @param {string} repositoryUrl - Repository URL for git metadata upload.
|
|
472
480
|
* @param {string|null} cacheKey - Filesystem cache key when this process owns the lock, null otherwise.
|
|
473
481
|
* @param {Function} done - Completion callback.
|
|
474
|
-
* @returns {void}
|
|
475
482
|
*/
|
|
476
483
|
_fetchLibraryConfigurationFromBackend (configuration, repositoryUrl, cacheKey, done) {
|
|
477
484
|
this.sendGitMetadata(repositoryUrl)
|
|
@@ -532,6 +539,7 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
532
539
|
DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES: configuredAttemptToFixRetries = 0,
|
|
533
540
|
DD_TEST_MANAGEMENT_ENABLED: isTestManagementAllowed,
|
|
534
541
|
} = testOptimization
|
|
542
|
+
|
|
535
543
|
const earlyFlakeDetectionRetryPolicy = earlyFlakeDetectionRetryCount === undefined
|
|
536
544
|
? remoteConfiguration.earlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY
|
|
537
545
|
: createEfdRetryPolicy({
|
|
@@ -543,6 +551,20 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
543
551
|
const testManagementAttemptToFixRetries =
|
|
544
552
|
remoteConfiguration.testManagementAttemptToFixRetries ?? configuredAttemptToFixRetries
|
|
545
553
|
|
|
554
|
+
const isFlakyTestRetriesEnabled =
|
|
555
|
+
remoteConfiguration.isFlakyTestRetriesEnabled === true && isFlakyTestRetriesAllowed === true
|
|
556
|
+
// Dynamic ATR only replaces the flat ATR policy when backend ATR is enabled.
|
|
557
|
+
const isDynamicAtrEnabled = isFlakyTestRetriesEnabled && this._dynamicAtrEnabled
|
|
558
|
+
let dynamicAtrBuckets
|
|
559
|
+
if (isDynamicAtrEnabled) {
|
|
560
|
+
// Resolve the backend fallback before local EFD overrides can reach any runner.
|
|
561
|
+
const backendPolicy = remoteConfiguration.earlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY
|
|
562
|
+
dynamicAtrBuckets = this._dynamicAtrBuckets ?? Object.freeze([
|
|
563
|
+
...backendPolicy.durationRetryCounts.map(({ retryCount }) => Math.max(1, retryCount)),
|
|
564
|
+
1,
|
|
565
|
+
])
|
|
566
|
+
}
|
|
567
|
+
|
|
546
568
|
return Object.freeze({
|
|
547
569
|
isCodeCoverageEnabled: remoteConfiguration.isCodeCoverageEnabled === true,
|
|
548
570
|
isSuitesSkippingEnabled: remoteConfiguration.isSuitesSkippingEnabled === true,
|
|
@@ -552,9 +574,10 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
552
574
|
remoteConfiguration.isEarlyFlakeDetectionEnabled === true && isEarlyFlakeDetectionAllowed === true,
|
|
553
575
|
earlyFlakeDetectionRetryPolicy,
|
|
554
576
|
earlyFlakeDetectionFaultyThreshold: remoteConfiguration.earlyFlakeDetectionFaultyThreshold ?? 30,
|
|
555
|
-
isFlakyTestRetriesEnabled
|
|
556
|
-
remoteConfiguration.isFlakyTestRetriesEnabled === true && isFlakyTestRetriesAllowed === true,
|
|
577
|
+
isFlakyTestRetriesEnabled,
|
|
557
578
|
flakyTestRetriesCount,
|
|
579
|
+
isDynamicAtrEnabled,
|
|
580
|
+
dynamicAtrBuckets,
|
|
558
581
|
isDiEnabled: remoteConfiguration.isDiEnabled === true && isFailedTestReplayAllowed === true,
|
|
559
582
|
isKnownTestsEnabled: remoteConfiguration.isKnownTestsEnabled === true,
|
|
560
583
|
isTestManagementEnabled:
|
|
@@ -566,6 +589,13 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
566
589
|
})
|
|
567
590
|
}
|
|
568
591
|
|
|
592
|
+
_recordDynamicAtrTelemetry () {
|
|
593
|
+
if (!this._hasRecordedDynamicAtrTelemetry && this._libraryConfig?.isDynamicAtrEnabled) {
|
|
594
|
+
this._hasRecordedDynamicAtrTelemetry = true
|
|
595
|
+
recordDynamicAtrRetries(this._dynamicAtrBuckets !== undefined)
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
569
599
|
sendGitMetadata (repositoryUrl) {
|
|
570
600
|
if (!this._config.testOptimization.DD_CIVISIBILITY_GIT_UPLOAD_ENABLED) {
|
|
571
601
|
this._resolveGit()
|
|
@@ -607,7 +637,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
607
637
|
* Exports spans that are not retained for late updates to session, module, or suite events.
|
|
608
638
|
*
|
|
609
639
|
* @param {Array<object>} trace
|
|
610
|
-
* @returns {void}
|
|
611
640
|
*/
|
|
612
641
|
#exportTrace (trace) {
|
|
613
642
|
// Until it's initialized, we just store the traces as is
|
|
@@ -633,7 +662,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
633
662
|
* Retries session, module, and suite traces rejected by writer backpressure within the final deadline.
|
|
634
663
|
*
|
|
635
664
|
* @param {{ deadline?: number }} options final-flush options
|
|
636
|
-
* @returns {void}
|
|
637
665
|
*/
|
|
638
666
|
#exportDeferredTestSessionTraces (options) {
|
|
639
667
|
if (!this._writer || !this.canReportSessionTraces()) return
|
|
@@ -859,7 +887,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
859
887
|
/**
|
|
860
888
|
* Allows later test activity to establish a new finalization boundary.
|
|
861
889
|
*
|
|
862
|
-
* @returns {void}
|
|
863
890
|
*/
|
|
864
891
|
#resetFinalFlush () {
|
|
865
892
|
this.#finalFlush = undefined
|
|
@@ -933,7 +960,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
933
960
|
/**
|
|
934
961
|
* Returns whether the exporter can upload test failure screenshots.
|
|
935
962
|
*
|
|
936
|
-
* @returns {boolean}
|
|
937
963
|
*/
|
|
938
964
|
canUploadTestScreenshots () {
|
|
939
965
|
return Boolean(this._testScreenshotUploadUrl) && this._isTestFailureScreenshotsEnabled
|
|
@@ -942,7 +968,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
942
968
|
/**
|
|
943
969
|
* Returns whether the exporter can upload test failure videos.
|
|
944
970
|
*
|
|
945
|
-
* @returns {boolean}
|
|
946
971
|
*/
|
|
947
972
|
canUploadTestVideos () {
|
|
948
973
|
return Boolean(this._testScreenshotUploadUrl) && this._isTestFailureVideosEnabled
|
|
@@ -985,7 +1010,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
985
1010
|
* @param {number} options.capturedAtMs - Capture time in epoch milliseconds
|
|
986
1011
|
* @param {AbortSignal} [options.signal] - Additional signal used to cancel the upload
|
|
987
1012
|
* @param {Function} callback - Callback function (err)
|
|
988
|
-
* @returns {void}
|
|
989
1013
|
*/
|
|
990
1014
|
uploadTestVideo (options, callback) {
|
|
991
1015
|
if (!this._testScreenshotUploadUrl) {
|
|
@@ -1006,7 +1030,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
1006
1030
|
* @param {number} options.capturedAtMs - Capture time in epoch milliseconds
|
|
1007
1031
|
* @param {AbortSignal} [options.signal] - Additional signal used to cancel the upload
|
|
1008
1032
|
* @param {Function} callback - Callback function (err)
|
|
1009
|
-
* @returns {void}
|
|
1010
1033
|
*/
|
|
1011
1034
|
uploadTestSuiteVideo (options, callback) {
|
|
1012
1035
|
if (!this._testScreenshotUploadUrl) {
|
|
@@ -1024,7 +1047,6 @@ class CiVisibilityExporter extends BufferingExporter {
|
|
|
1024
1047
|
* @param {AbortSignal} [uploadOptions.signal] - Additional signal used to cancel the upload
|
|
1025
1048
|
* @param {Function} callback - Callback function (err)
|
|
1026
1049
|
* @param {number} [timeoutMs] - Maximum background upload duration
|
|
1027
|
-
* @returns {void}
|
|
1028
1050
|
*/
|
|
1029
1051
|
#uploadTestMedia (uploadRequest, uploadOptions, callback, timeoutMs = FINAL_FLUSH_TIMEOUT) {
|
|
1030
1052
|
const { signal } = uploadOptions
|
|
@@ -70,7 +70,6 @@ function getCommonRequestOptions (url) {
|
|
|
70
70
|
*
|
|
71
71
|
* @param {GitUploadTarget & { latestCommits: string[] }} options
|
|
72
72
|
* @param {(error: Error | null, commitsToUpload?: string[]) => void} callback
|
|
73
|
-
* @returns {void}
|
|
74
73
|
*/
|
|
75
74
|
function getCommitsToUpload ({ url, repositoryUrl, latestCommits, isEvpProxy, evpProxyPrefix }, callback) {
|
|
76
75
|
const commonOptions = getCommonRequestOptions(url)
|
|
@@ -139,7 +138,6 @@ function getCommitsToUpload ({ url, repositoryUrl, latestCommits, isEvpProxy, ev
|
|
|
139
138
|
*
|
|
140
139
|
* @param {GitUploadTarget & { packFileToUpload: string, headCommit: string }} options
|
|
141
140
|
* @param {(error: Error | null, uploadSize?: number) => void} callback
|
|
142
|
-
* @returns {void}
|
|
143
141
|
*/
|
|
144
142
|
function uploadPackFile ({ url, isEvpProxy, evpProxyPrefix, packFileToUpload, repositoryUrl, headCommit }, callback) {
|
|
145
143
|
const form = new FormData()
|
|
@@ -263,7 +261,6 @@ function generateAndUploadPackFiles ({
|
|
|
263
261
|
* @param {EvpProxyConfiguration} evpProxyConfiguration
|
|
264
262
|
* @param {string | undefined} configRepositoryUrl repository URL from the configuration, if set
|
|
265
263
|
* @param {(error?: Error | null) => void} callback
|
|
266
|
-
* @returns {void}
|
|
267
264
|
*/
|
|
268
265
|
function sendGitMetadata (url, { isEvpProxy, evpProxyPrefix }, configRepositoryUrl, callback) {
|
|
269
266
|
if (!isGitAvailable()) {
|
|
@@ -35,7 +35,6 @@ const backpressureWaiters = new Set()
|
|
|
35
35
|
/**
|
|
36
36
|
* Keeps the shared polling timer alive only while an owned request is waiting.
|
|
37
37
|
*
|
|
38
|
-
* @returns {void}
|
|
39
38
|
*/
|
|
40
39
|
function updateBackpressureTimerRef () {
|
|
41
40
|
if (ownedBackpressureWaiters > 0) backpressureTimer.ref?.()
|
|
@@ -46,7 +45,6 @@ function updateBackpressureTimerRef () {
|
|
|
46
45
|
* Schedules the next shared backpressure poll.
|
|
47
46
|
*
|
|
48
47
|
* @param {number} due
|
|
49
|
-
* @returns {void}
|
|
50
48
|
*/
|
|
51
49
|
function setBackpressureTimer (due) {
|
|
52
50
|
clearTimeout(backpressureTimer)
|
|
@@ -61,7 +59,6 @@ function setBackpressureTimer (due) {
|
|
|
61
59
|
* @param {BackpressureWaiter} waiter
|
|
62
60
|
* @param {number} delay
|
|
63
61
|
* @param {number} attemptIndex
|
|
64
|
-
* @returns {void}
|
|
65
62
|
*/
|
|
66
63
|
function scheduleBackpressureRetry (waiter, delay, attemptIndex) {
|
|
67
64
|
waiter.attemptIndex = attemptIndex
|
|
@@ -81,7 +78,6 @@ function scheduleBackpressureRetry (waiter, delay, attemptIndex) {
|
|
|
81
78
|
* Removes a settled request from the shared backpressure poll.
|
|
82
79
|
*
|
|
83
80
|
* @param {BackpressureWaiter} waiter
|
|
84
|
-
* @returns {void}
|
|
85
81
|
*/
|
|
86
82
|
function removeBackpressureWaiter (waiter) {
|
|
87
83
|
if (!backpressureWaiters.delete(waiter)) return
|
|
@@ -99,7 +95,6 @@ function removeBackpressureWaiter (waiter) {
|
|
|
99
95
|
/**
|
|
100
96
|
* Retries every request whose shared backpressure delay has elapsed.
|
|
101
97
|
*
|
|
102
|
-
* @returns {void}
|
|
103
98
|
*/
|
|
104
99
|
function runBackpressureWaiters () {
|
|
105
100
|
const now = Date.now()
|
|
@@ -125,7 +120,6 @@ function runBackpressureWaiters () {
|
|
|
125
120
|
|
|
126
121
|
/**
|
|
127
122
|
* @param {Buffer|string|Array<Buffer|string>|(() => Readable)} data
|
|
128
|
-
* @returns {number}
|
|
129
123
|
*/
|
|
130
124
|
function getPayloadSize (data) {
|
|
131
125
|
// Factory-backed payloads are streamed by their custom transport and enforce their own concurrency limit.
|
|
@@ -166,7 +160,6 @@ function createRequestTimeoutError () {
|
|
|
166
160
|
|
|
167
161
|
/**
|
|
168
162
|
* @param {number} statusCode
|
|
169
|
-
* @returns {boolean}
|
|
170
163
|
*/
|
|
171
164
|
function isRetriableHttpStatusCode (statusCode) {
|
|
172
165
|
return statusCode === 408 || statusCode === 429 || (statusCode >= 500 && statusCode <= 599)
|
|
@@ -186,7 +179,6 @@ function getAbortError (signal) {
|
|
|
186
179
|
* @param {Readable} data
|
|
187
180
|
* @param {AbortSignal} [signal]
|
|
188
181
|
* @param {(error: Error|null, data?: Buffer, payloadSize?: number) => void} callback
|
|
189
|
-
* @returns {void}
|
|
190
182
|
*/
|
|
191
183
|
function bufferReadable (data, signal, callback) {
|
|
192
184
|
const chunks = []
|
|
@@ -256,7 +248,6 @@ function bufferReadable (data, signal, callback) {
|
|
|
256
248
|
* @param {object} options
|
|
257
249
|
* @param {(error: Error|null, result?: string|null, statusCode?: number,
|
|
258
250
|
* headers?: import('node:http').IncomingHttpHeaders) => void} callback
|
|
259
|
-
* @returns {void}
|
|
260
251
|
*/
|
|
261
252
|
function request (data, options, callback) {
|
|
262
253
|
const { signal } = options
|
|
@@ -281,7 +272,6 @@ function request (data, options, callback) {
|
|
|
281
272
|
* @param {(error: Error|null, result?: string|null, statusCode?: number,
|
|
282
273
|
* headers?: import('node:http').IncomingHttpHeaders) => void} callback
|
|
283
274
|
* @param {number} [reservedPayloadSize]
|
|
284
|
-
* @returns {void}
|
|
285
275
|
*/
|
|
286
276
|
function requestBuffered (data, options, callback, reservedPayloadSize) {
|
|
287
277
|
const { signal } = options
|
|
@@ -344,7 +334,6 @@ function requestBuffered (data, options, callback, reservedPayloadSize) {
|
|
|
344
334
|
|
|
345
335
|
/**
|
|
346
336
|
* @param {number} attemptIndex
|
|
347
|
-
* @returns {void}
|
|
348
337
|
*/
|
|
349
338
|
function attempt (attemptIndex) {
|
|
350
339
|
if (settled) return
|
|
@@ -10,7 +10,6 @@ const getConfig = require('../../config')
|
|
|
10
10
|
* applied while parsing the response.
|
|
11
11
|
*
|
|
12
12
|
* @param {object} configuration - Request configuration for the settings endpoint.
|
|
13
|
-
* @returns {string}
|
|
14
13
|
*/
|
|
15
14
|
function buildSettingsCacheKey (configuration) {
|
|
16
15
|
const config = getConfig()
|
|
@@ -86,7 +86,6 @@ function parseSkippableSuitesResponse (
|
|
|
86
86
|
* }} result - Parsed skippable response.
|
|
87
87
|
* @param {'suite'|'test'} testLevel - Test optimization skipping level.
|
|
88
88
|
* @param {boolean} shouldConsiderLineCoverage - Whether line coverage can affect suite skipping.
|
|
89
|
-
* @returns {void}
|
|
90
89
|
*/
|
|
91
90
|
function logSkippableSuitesResponse (result, testLevel, shouldConsiderLineCoverage) {
|
|
92
91
|
if (!shouldConsiderLineCoverage || result.numReceivedSkippableItems === undefined) {
|
|
@@ -16,7 +16,6 @@ const CACHE_LOCK_HEARTBEAT_MS = 30_000 // 30 seconds
|
|
|
16
16
|
/**
|
|
17
17
|
* Returns whether the filesystem cache is enabled via config.
|
|
18
18
|
*
|
|
19
|
-
* @returns {boolean}
|
|
20
19
|
*/
|
|
21
20
|
function isCacheEnabled () {
|
|
22
21
|
return getConfig().DD_EXPERIMENTAL_TEST_REQUESTS_FS_CACHE
|
|
@@ -27,7 +26,6 @@ function isCacheEnabled () {
|
|
|
27
26
|
*
|
|
28
27
|
* @param {string} prefix - Cache file prefix (e.g. 'known-tests', 'skippable', 'test-mgmt')
|
|
29
28
|
* @param {Array<unknown>} parts - Values that uniquely identify the cached response
|
|
30
|
-
* @returns {string}
|
|
31
29
|
*/
|
|
32
30
|
function buildCacheKey (prefix, parts) {
|
|
33
31
|
const hash = createHash('sha256').update(JSON.stringify(parts)).digest('hex').slice(0, 16)
|
|
@@ -36,7 +34,6 @@ function buildCacheKey (prefix, parts) {
|
|
|
36
34
|
|
|
37
35
|
/**
|
|
38
36
|
* @param {string} cacheKey
|
|
39
|
-
* @returns {string}
|
|
40
37
|
*/
|
|
41
38
|
function getCachePath (cacheKey) {
|
|
42
39
|
return path.join(tmpdir(), `dd-${cacheKey}.json`)
|
|
@@ -44,7 +41,6 @@ function getCachePath (cacheKey) {
|
|
|
44
41
|
|
|
45
42
|
/**
|
|
46
43
|
* @param {string} cacheKey
|
|
47
|
-
* @returns {string}
|
|
48
44
|
*/
|
|
49
45
|
function getLockPath (cacheKey) {
|
|
50
46
|
return path.join(tmpdir(), `dd-${cacheKey}.lock`)
|
|
@@ -138,7 +134,6 @@ function tryAcquireLock (cacheKey) {
|
|
|
138
134
|
* Removes the lock file.
|
|
139
135
|
*
|
|
140
136
|
* @param {string} cacheKey
|
|
141
|
-
* @returns {boolean}
|
|
142
137
|
*/
|
|
143
138
|
function releaseLock (cacheKey) {
|
|
144
139
|
try {
|
|
@@ -185,7 +180,6 @@ function startLockHeartbeat (cacheKey) {
|
|
|
185
180
|
* Checks whether the lock file is stale (older than the lock timeout).
|
|
186
181
|
*
|
|
187
182
|
* @param {string} cacheKey
|
|
188
|
-
* @returns {boolean}
|
|
189
183
|
*/
|
|
190
184
|
function isLockStale (cacheKey) {
|
|
191
185
|
try {
|
|
@@ -88,7 +88,7 @@ function parseSlowTestRetries (value) {
|
|
|
88
88
|
* @returns {EarlyFlakeDetectionSettings}
|
|
89
89
|
*/
|
|
90
90
|
function parseEarlyFlakeDetectionSettings (value, isKnownTestsEnabled) {
|
|
91
|
-
if (!isRecord(value)
|
|
91
|
+
if (!isRecord(value)) {
|
|
92
92
|
return {
|
|
93
93
|
enabled: false,
|
|
94
94
|
retryPolicy: DEFAULT_EARLY_FLAKE_DETECTION_RETRY_POLICY,
|
|
@@ -117,7 +117,7 @@ function parseEarlyFlakeDetectionSettings (value, isKnownTestsEnabled) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
return {
|
|
120
|
-
enabled: isKnownTestsEnabled && isValid,
|
|
120
|
+
enabled: value.enabled === true && isKnownTestsEnabled && isValid,
|
|
121
121
|
retryPolicy,
|
|
122
122
|
faultyThreshold,
|
|
123
123
|
}
|
|
@@ -6,7 +6,6 @@ const EPOCH_SECONDS_THRESHOLD = 1_000_000_000
|
|
|
6
6
|
* Returns the delay requested by a Test Optimization intake rate-limit response.
|
|
7
7
|
*
|
|
8
8
|
* @param {import('node:http').IncomingHttpHeaders} [headers]
|
|
9
|
-
* @returns {number}
|
|
10
9
|
*/
|
|
11
10
|
function getRateLimitResetDelay (headers) {
|
|
12
11
|
let retryAfter = headers?.['retry-after']
|