dd-trace 6.16.0 → 6.18.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/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 +0 -6
- 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/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 +0 -1
- package/ci/test-optimization-validation/source-text.js +0 -3
- package/ci/vitest-no-worker-init-setup.mjs +41 -16
- package/index.d.ts +208 -0
- package/package.json +17 -16
- package/packages/datadog-esbuild/src/utils.js +0 -2
- package/packages/datadog-instrumentations/src/aerospike.js +28 -6
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +0 -2
- package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/console.js +97 -0
- package/packages/datadog-instrumentations/src/cucumber.js +77 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +27 -38
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +2 -1
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -6
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +0 -3
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +24 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +111 -26
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -17
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +55 -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 +13 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +28 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +20 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
- package/packages/datadog-instrumentations/src/jest.js +165 -51
- package/packages/datadog-instrumentations/src/knex.js +0 -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/mocha/common.js +0 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +25 -26
- 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/mysql2.js +0 -2
- 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 +51 -12
- package/packages/datadog-instrumentations/src/oracledb.js +9 -3
- package/packages/datadog-instrumentations/src/playwright-reporter.js +6 -20
- package/packages/datadog-instrumentations/src/playwright.js +280 -56
- package/packages/datadog-instrumentations/src/{azure-cosmos.js → postgres.js} +1 -1
- 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/undici.js +7 -3
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +121 -30
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +49 -13
- package/packages/datadog-instrumentations/src/webdriverio.js +44 -47
- package/packages/datadog-instrumentations/src/ws.js +41 -2
- 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 +0 -1
- 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-durable-functions/src/index.js +0 -1
- package/packages/datadog-plugin-cucumber/src/index.js +9 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +211 -85
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/index.js +3 -1
- 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-graphql/src/resolve-error.js +1 -2
- package/packages/datadog-plugin-graphql/src/utils.js +0 -5
- package/packages/datadog-plugin-jest/src/index.js +12 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +38 -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 +81 -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 +9 -0
- package/packages/datadog-plugin-ws/src/producer.js +1 -1
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-shimmer/src/shimmer.js +14 -10
- package/packages/datadog-turbopack/index.js +4 -7
- package/packages/datadog-turbopack/src/loader.js +6 -18
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/agent/info.js +5 -4
- 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 +2 -2
- package/packages/dd-trace/src/aiguard/integrations/index.js +1 -1
- package/packages/dd-trace/src/aiguard/integrations/openai.js +81 -7
- 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 +0 -1
- 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-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/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 +88 -82
- package/packages/dd-trace/src/config/helper.js +0 -1
- package/packages/dd-trace/src/config/index.js +31 -30
- 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 +150 -10
- 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 +62 -10
- package/packages/dd-trace/src/debugger/devtools_client/config.js +4 -1
- 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 +21 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +41 -15
- 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/redaction.js +5 -3
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +21 -7
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +51 -3
- 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/constants.js +2 -0
- package/packages/dd-trace/src/evp_proxy/direct.js +17 -13
- package/packages/dd-trace/src/evp_proxy/discovery.js +14 -11
- package/packages/dd-trace/src/evp_proxy/path.js +21 -9
- 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/final-flush-request-tracker.js +0 -6
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/common/url.js +33 -4
- 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 +647 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +158 -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 +39 -11
- 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/configuration_source.js +4 -1
- 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/flagging_provider.js +3 -3
- package/packages/dd-trace/src/openfeature/index.js +6 -6
- 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 +90 -23
- package/packages/dd-trace/src/openfeature/writers/exposures.js +4 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +104 -37
- 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/meter_provider.js +0 -1
- 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 +1 -14
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +30 -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/opentracing/tracer.js +3 -3
- 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 +27 -8
- package/packages/dd-trace/src/plugins/ci_plugin.js +1 -2
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +7 -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 +26 -20
- 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 +23 -47
- 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/send-data.js +2 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/tracer.js +5 -4
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/packages/datadog-instrumentations/src/bullmq.js +0 -11
- package/packages/datadog-instrumentations/src/langchain.js +0 -7
- package/packages/datadog-instrumentations/src/langgraph.js +0 -7
- package/packages/datadog-instrumentations/src/mercurius.js +0 -11
|
@@ -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 =
|
|
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
|
-
|
|
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 &&
|
|
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 (
|
|
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 &&
|
|
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
|
|
@@ -51,7 +51,6 @@ const noopTask = {
|
|
|
51
51
|
/**
|
|
52
52
|
* @param {FileSystemError} error filesystem error
|
|
53
53
|
* @param {string} fallbackPath path used when the error does not include one
|
|
54
|
-
* @returns {string} concise error description
|
|
55
54
|
*/
|
|
56
55
|
function formatFileSystemError (error, fallbackPath) {
|
|
57
56
|
const code = error?.code || error?.name || 'UNKNOWN'
|
|
@@ -64,7 +63,6 @@ function formatFileSystemError (error, fallbackPath) {
|
|
|
64
63
|
* @param {FileCreationFailure[]} failures failed directory attempts
|
|
65
64
|
* @param {string} consequence effect on Cypress instrumentation
|
|
66
65
|
* @param {boolean} [customerVisible] whether to report the failure without requiring debug logging
|
|
67
|
-
* @returns {void}
|
|
68
66
|
*/
|
|
69
67
|
function warnFileCreationFailures (artifact, failures, consequence, customerVisible = false) {
|
|
70
68
|
let details = ''
|
|
@@ -89,7 +87,6 @@ function warnFileCreationFailures (artifact, failures, consequence, customerVisi
|
|
|
89
87
|
*
|
|
90
88
|
* @param {string} message printf-style error message
|
|
91
89
|
* @param {...unknown} args message arguments
|
|
92
|
-
* @returns {void}
|
|
93
90
|
*/
|
|
94
91
|
function logBrowserInstrumentationError (message, ...args) {
|
|
95
92
|
// eslint-disable-next-line no-console
|
|
@@ -98,7 +95,6 @@ function logBrowserInstrumentationError (message, ...args) {
|
|
|
98
95
|
|
|
99
96
|
/**
|
|
100
97
|
* @param {string} filePath generated file to remove
|
|
101
|
-
* @returns {void}
|
|
102
98
|
*/
|
|
103
99
|
function removeGeneratedFile (filePath) {
|
|
104
100
|
try {
|
|
@@ -118,7 +114,6 @@ function removeGeneratedFile (filePath) {
|
|
|
118
114
|
* Removes project-local support files when Cypress exits without firing
|
|
119
115
|
* after:run, as happens in open mode without experimental run events.
|
|
120
116
|
*
|
|
121
|
-
* @returns {void}
|
|
122
117
|
*/
|
|
123
118
|
function removeGeneratedFilesAtExit () {
|
|
124
119
|
exitCleanupRegistered = false
|
|
@@ -128,7 +123,6 @@ function removeGeneratedFilesAtExit () {
|
|
|
128
123
|
|
|
129
124
|
/**
|
|
130
125
|
* @param {string[]} filePaths generated support files
|
|
131
|
-
* @returns {void}
|
|
132
126
|
*/
|
|
133
127
|
function registerGeneratedFilesForExitCleanup (filePaths) {
|
|
134
128
|
for (const filePath of filePaths) generatedFilesForExitCleanup.add(filePath)
|
|
@@ -140,7 +134,6 @@ function registerGeneratedFilesForExitCleanup (filePaths) {
|
|
|
140
134
|
|
|
141
135
|
/**
|
|
142
136
|
* @param {string[]} filePaths generated support files
|
|
143
|
-
* @returns {void}
|
|
144
137
|
*/
|
|
145
138
|
function cleanupGeneratedFiles (filePaths) {
|
|
146
139
|
for (const filePath of filePaths) {
|
|
@@ -160,7 +153,6 @@ function cleanupGeneratedFiles (filePaths) {
|
|
|
160
153
|
*
|
|
161
154
|
* @param {string} filePath generated file path
|
|
162
155
|
* @param {string} content generated file content
|
|
163
|
-
* @returns {void}
|
|
164
156
|
*/
|
|
165
157
|
function writeExclusiveFile (filePath, content) {
|
|
166
158
|
let descriptor
|
|
@@ -189,7 +181,6 @@ function writeExclusiveFile (filePath, content) {
|
|
|
189
181
|
|
|
190
182
|
/**
|
|
191
183
|
* @param {unknown} handler Cypress task registration
|
|
192
|
-
* @returns {boolean}
|
|
193
184
|
*/
|
|
194
185
|
function isDatadogTaskRegistration (handler) {
|
|
195
186
|
return !!handler && typeof handler === 'object' &&
|
|
@@ -201,7 +192,6 @@ function isDatadogTaskRegistration (handler) {
|
|
|
201
192
|
|
|
202
193
|
/**
|
|
203
194
|
* @param {unknown} handler Cypress after:run handler
|
|
204
|
-
* @returns {boolean} whether this is the handler registered by the manual Datadog plugin
|
|
205
195
|
*/
|
|
206
196
|
function isDatadogAfterRunHandler (handler) {
|
|
207
197
|
return typeof handler === 'function' && handler[DD_CYPRESS_AFTER_RUN_HANDLER] === true
|
|
@@ -209,7 +199,6 @@ function isDatadogAfterRunHandler (handler) {
|
|
|
209
199
|
|
|
210
200
|
/**
|
|
211
201
|
* @param {unknown} handler Cypress after:spec handler
|
|
212
|
-
* @returns {boolean} whether this is the handler registered by the manual Datadog plugin
|
|
213
202
|
*/
|
|
214
203
|
function isDatadogAfterSpecHandler (handler) {
|
|
215
204
|
return typeof handler === 'function' && handler[DD_CYPRESS_AFTER_SPEC_HANDLER] === true
|
|
@@ -217,7 +206,6 @@ function isDatadogAfterSpecHandler (handler) {
|
|
|
217
206
|
|
|
218
207
|
/**
|
|
219
208
|
* @param {object} manualPlugin manual plugin registration state
|
|
220
|
-
* @returns {boolean} whether the manual plugin supports error-aware finalization
|
|
221
209
|
*/
|
|
222
210
|
function supportsErrorAwareFinalization (manualPlugin) {
|
|
223
211
|
return isDatadogAfterSpecHandler(manualPlugin.afterSpecHandler) &&
|
|
@@ -226,7 +214,6 @@ function supportsErrorAwareFinalization (manualPlugin) {
|
|
|
226
214
|
|
|
227
215
|
/**
|
|
228
216
|
* @param {unknown} handler Cypress task handler map
|
|
229
|
-
* @returns {boolean} whether the current manual Datadog plugin owns the task map
|
|
230
217
|
*/
|
|
231
218
|
function isCurrentDatadogTaskRegistration (handler) {
|
|
232
219
|
return !!handler && handler[DD_CYPRESS_TASK_HANDLER] === manualPluginOwner
|
|
@@ -234,7 +221,6 @@ function isCurrentDatadogTaskRegistration (handler) {
|
|
|
234
221
|
|
|
235
222
|
/**
|
|
236
223
|
* @param {unknown} handler Cypress task handler map
|
|
237
|
-
* @returns {boolean} whether the manual plugin registered only fallback tasks
|
|
238
224
|
*/
|
|
239
225
|
function isDatadogNoopTaskRegistration (handler) {
|
|
240
226
|
return !!handler && handler[DD_CYPRESS_NOOP_TASK_HANDLER] === true
|
|
@@ -242,7 +228,6 @@ function isDatadogNoopTaskRegistration (handler) {
|
|
|
242
228
|
|
|
243
229
|
/**
|
|
244
230
|
* @param {unknown} value
|
|
245
|
-
* @returns {boolean}
|
|
246
231
|
*/
|
|
247
232
|
function isPlainObject (value) {
|
|
248
233
|
if (!value || typeof value !== 'object') return false
|
|
@@ -278,7 +263,6 @@ function mergeReturnedConfig (config, updatedConfig) {
|
|
|
278
263
|
/**
|
|
279
264
|
* @param {string} rootPath parent path
|
|
280
265
|
* @param {string} candidatePath path that should be inside rootPath
|
|
281
|
-
* @returns {boolean}
|
|
282
266
|
*/
|
|
283
267
|
function isPathInside (rootPath, candidatePath) {
|
|
284
268
|
const relativePath = path.relative(path.resolve(rootPath), path.resolve(candidatePath))
|
|
@@ -288,7 +272,6 @@ function isPathInside (rootPath, candidatePath) {
|
|
|
288
272
|
/**
|
|
289
273
|
* @param {string} fromDirectory directory containing the importing file
|
|
290
274
|
* @param {string} importedFile file to import
|
|
291
|
-
* @returns {string}
|
|
292
275
|
*/
|
|
293
276
|
function getRelativeImportPath (fromDirectory, importedFile) {
|
|
294
277
|
let relativePath = path.relative(fromDirectory, importedFile).split(path.sep).join('/')
|
|
@@ -420,7 +403,6 @@ function injectSupportFile (config) {
|
|
|
420
403
|
* @param {Function} on Cypress event registration function
|
|
421
404
|
* @param {Function[]} handlers collected after:screenshot handlers
|
|
422
405
|
* @param {Function|undefined} datadogHandler manual Datadog screenshot handler
|
|
423
|
-
* @returns {void}
|
|
424
406
|
*/
|
|
425
407
|
function registerManualAfterScreenshotHandlers (on, handlers, datadogHandler) {
|
|
426
408
|
const userHandlers = handlers.filter(handler => handler !== datadogHandler)
|
|
@@ -444,16 +426,16 @@ function registerManualAfterScreenshotHandlers (on, handlers, datadogHandler) {
|
|
|
444
426
|
}
|
|
445
427
|
|
|
446
428
|
/**
|
|
447
|
-
* Registers one Cypress
|
|
429
|
+
* Registers one Cypress lifecycle handler that runs every collected handler
|
|
448
430
|
* in registration order. Cypress 10+ otherwise keeps only the last handler.
|
|
449
431
|
*
|
|
450
432
|
* @param {Function} on Cypress event registration function
|
|
451
|
-
* @param {
|
|
452
|
-
* @param {Function
|
|
433
|
+
* @param {'before:run'|'after:spec'} event lifecycle event
|
|
434
|
+
* @param {Function[]} handlers collected lifecycle handlers
|
|
435
|
+
* @param {Function} [datadogHandler] Datadog lifecycle handler
|
|
453
436
|
* @param {Function} [cleanup] removes generated support files after an error
|
|
454
|
-
* @returns {void}
|
|
455
437
|
*/
|
|
456
|
-
function
|
|
438
|
+
function registerLifecycleHandlers (on, event, handlers, datadogHandler, cleanup) {
|
|
457
439
|
const userHandlers = datadogHandler
|
|
458
440
|
? handlers.filter(handler => handler !== datadogHandler)
|
|
459
441
|
: handlers
|
|
@@ -461,27 +443,31 @@ function registerAfterSpecHandlers (on, handlers, datadogHandler, cleanup) {
|
|
|
461
443
|
if (userHandlers.length === 0) {
|
|
462
444
|
if (datadogHandler) {
|
|
463
445
|
if (cleanup) {
|
|
464
|
-
on(
|
|
446
|
+
on(event, (...args) => Promise.resolve().then(() => datadogHandler(...args)).catch((error) => {
|
|
465
447
|
cleanup()
|
|
466
448
|
throw error
|
|
467
449
|
}))
|
|
468
450
|
} else {
|
|
469
|
-
on(
|
|
451
|
+
on(event, datadogHandler)
|
|
470
452
|
}
|
|
471
453
|
}
|
|
472
454
|
return
|
|
473
455
|
}
|
|
474
456
|
|
|
475
|
-
on(
|
|
457
|
+
on(event, (...args) => {
|
|
476
458
|
const callHandler = datadogHandler
|
|
477
|
-
? handler => runUserHandler(() => handler(
|
|
478
|
-
: handler => handler(
|
|
459
|
+
? handler => runUserHandler(() => handler(...args))
|
|
460
|
+
: handler => handler(...args)
|
|
479
461
|
const chain = userHandlers.reduce(
|
|
480
462
|
(promise, handler) => promise.then(() => callHandler(handler)),
|
|
481
463
|
Promise.resolve()
|
|
482
464
|
)
|
|
483
465
|
if (!datadogHandler) return chain
|
|
484
|
-
const finalization = finalizeAfterUserHandlers(chain, (...
|
|
466
|
+
const finalization = finalizeAfterUserHandlers(chain, (...errors) => {
|
|
467
|
+
// A failed setup hook must abort the run before Datadog starts its session.
|
|
468
|
+
if (event === 'before:run' && errors.length > 0) return
|
|
469
|
+
return datadogHandler(...args, ...errors)
|
|
470
|
+
})
|
|
485
471
|
if (!cleanup) return finalization
|
|
486
472
|
return finalization.catch((error) => {
|
|
487
473
|
cleanup()
|
|
@@ -495,7 +481,6 @@ function registerAfterSpecHandlers (on, handlers, datadogHandler, cleanup) {
|
|
|
495
481
|
* sessions in interactive mode.
|
|
496
482
|
*
|
|
497
483
|
* @param {object} config Cypress resolved config object
|
|
498
|
-
* @returns {void}
|
|
499
484
|
*/
|
|
500
485
|
function enableInteractiveRunEvents (config) {
|
|
501
486
|
if (config.isInteractive && config.experimentalInteractiveRunEvents !== true) {
|
|
@@ -534,6 +519,9 @@ function registerDdTraceHooks (
|
|
|
534
519
|
if (generatedSupportFiles) registerGeneratedFilesForExitCleanup(generatedSupportFiles)
|
|
535
520
|
|
|
536
521
|
const cleanupWrapper = () => {
|
|
522
|
+
// Open mode reuses this support file across runs, including failed setup attempts.
|
|
523
|
+
// The registered process-exit cleanup owns its lifetime instead.
|
|
524
|
+
if (config.isInteractive) return
|
|
537
525
|
if (generatedSupportFiles) cleanupGeneratedFiles(generatedSupportFiles)
|
|
538
526
|
}
|
|
539
527
|
|
|
@@ -557,8 +545,13 @@ function registerDdTraceHooks (
|
|
|
557
545
|
})
|
|
558
546
|
}
|
|
559
547
|
|
|
548
|
+
const registerBeforeRun = handler => {
|
|
549
|
+
registerLifecycleHandlers(on, 'before:run', userBeforeRunHandlers, handler, cleanupWrapper)
|
|
550
|
+
}
|
|
551
|
+
|
|
560
552
|
const registerNoopHandlers = () => {
|
|
561
|
-
|
|
553
|
+
registerBeforeRun()
|
|
554
|
+
registerLifecycleHandlers(on, 'after:spec', userAfterSpecHandlers)
|
|
562
555
|
for (const h of userAfterScreenshotHandlers) on('after:screenshot', h)
|
|
563
556
|
registerAfterRunWithCleanup()
|
|
564
557
|
on('task', noopTask)
|
|
@@ -575,8 +568,8 @@ function registerDdTraceHooks (
|
|
|
575
568
|
manualPlugin.initialConfig.experimentalInteractiveRunEvents = config.experimentalInteractiveRunEvents
|
|
576
569
|
}
|
|
577
570
|
}
|
|
578
|
-
|
|
579
|
-
|
|
571
|
+
registerBeforeRun(manualPlugin.beforeRunHandler)
|
|
572
|
+
registerLifecycleHandlers(on, 'after:spec', userAfterSpecHandlers, manualPlugin.afterSpecHandler, cleanupWrapper)
|
|
580
573
|
registerManualAfterScreenshotHandlers(on, userAfterScreenshotHandlers, manualPlugin.afterScreenshotHandler)
|
|
581
574
|
registerAfterRunWithCleanup(manualPlugin.afterRunHandler)
|
|
582
575
|
on('task', manualPlugin.taskHandler)
|
|
@@ -592,8 +585,6 @@ function registerDdTraceHooks (
|
|
|
592
585
|
)
|
|
593
586
|
}
|
|
594
587
|
|
|
595
|
-
for (const handler of userBeforeRunHandlers) on('before:run', handler)
|
|
596
|
-
|
|
597
588
|
if (!setupNodeEventsCh.hasSubscribers) {
|
|
598
589
|
registerNoopHandlers()
|
|
599
590
|
return config
|
|
@@ -608,6 +599,7 @@ function registerDdTraceHooks (
|
|
|
608
599
|
userAfterSpecHandlers,
|
|
609
600
|
userAfterRunHandlers,
|
|
610
601
|
userAfterScreenshotHandlers,
|
|
602
|
+
registerBeforeRun,
|
|
611
603
|
cleanupWrapper,
|
|
612
604
|
registered: false,
|
|
613
605
|
configPromise: undefined,
|
|
@@ -740,7 +732,6 @@ function wrapConfig (config) {
|
|
|
740
732
|
* (`.js`, `.ts`) are loaded as ESM or CJS.
|
|
741
733
|
*
|
|
742
734
|
* @param {string} filePath absolute path to a file under the project
|
|
743
|
-
* @returns {boolean}
|
|
744
735
|
*/
|
|
745
736
|
function isUnderEsmPackage (filePath) {
|
|
746
737
|
let dir = path.dirname(filePath)
|
|
@@ -759,7 +750,6 @@ function isUnderEsmPackage (filePath) {
|
|
|
759
750
|
/**
|
|
760
751
|
* @param {string} originalConfigFile absolute path to the original config file
|
|
761
752
|
* @param {string} wrapperDirectory directory for the generated wrapper
|
|
762
|
-
* @returns {string} path to the generated wrapper file
|
|
763
753
|
*/
|
|
764
754
|
function createConfigWrapper (originalConfigFile, wrapperDirectory) {
|
|
765
755
|
// Match the module mode Cypress would use for the user's original config
|
|
@@ -815,7 +805,6 @@ module.exports = cypressConfig.wrapConfig(originalConfig)
|
|
|
815
805
|
|
|
816
806
|
/**
|
|
817
807
|
* @param {string} projectRoot
|
|
818
|
-
* @returns {boolean}
|
|
819
808
|
*/
|
|
820
809
|
function isTypeScript6OrNewer (projectRoot) {
|
|
821
810
|
try {
|
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
} = require('./instrumentation-utils')
|
|
14
14
|
const hooks = require('./hooks')
|
|
15
15
|
const instrumentations = require('./instrumentations')
|
|
16
|
+
const { isRewriteActivationEnabled } = require('./rewriter/targets')
|
|
16
17
|
const disabledInstrumentations = getDisabledInstrumentations()
|
|
17
18
|
|
|
18
19
|
// register.js has now set up ritm (require-in-the-middle). In bundled
|
|
@@ -94,6 +95,11 @@ dc.subscribe(CHANNEL, (message) => {
|
|
|
94
95
|
const name = payload.package
|
|
95
96
|
if (disabledInstrumentations.has(name)) return
|
|
96
97
|
|
|
98
|
+
if (payload.activate && isRewriteActivationEnabled(name)) {
|
|
99
|
+
loadChannel.publish({ name })
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
97
103
|
const isPrefixedWithNode = name.startsWith('node:')
|
|
98
104
|
const isNodeModule = isPrefixedWithNode || !hooks[name]
|
|
99
105
|
|
|
@@ -20,7 +20,6 @@ function getCompletion (onDone) {
|
|
|
20
20
|
* @param {import('node:diagnostics_channel').Channel} channel
|
|
21
21
|
* @param {Record<string, unknown>} payload
|
|
22
22
|
* @param {(...args: T) => void} onDone
|
|
23
|
-
* @returns {void}
|
|
24
23
|
*/
|
|
25
24
|
function publishWithCompletion (channel, payload, onDone) {
|
|
26
25
|
const complete = getCompletion(onDone)
|
|
@@ -33,7 +32,6 @@ function publishWithCompletion (channel, payload, onDone) {
|
|
|
33
32
|
* @param {import('node:diagnostics_channel').Channel} channel
|
|
34
33
|
* @param {Record<string, unknown> & { onDone?: (...args: T) => void }} payload
|
|
35
34
|
* @param {(...args: T) => void} onDone
|
|
36
|
-
* @returns {void}
|
|
37
35
|
*/
|
|
38
36
|
function runStoresWithCompletion (channel, payload, onDone) {
|
|
39
37
|
const complete = getCompletion(onDone)
|
|
@@ -69,6 +69,7 @@ const earlyLoadFrameworks = new Map([
|
|
|
69
69
|
*/
|
|
70
70
|
module.exports.checkForRequiredModules = function () {
|
|
71
71
|
const packages = require('./hooks')
|
|
72
|
+
const { isRewriteTargetName } = require('./rewriter/targets')
|
|
72
73
|
const naughties = new Set()
|
|
73
74
|
const frameworksSeen = new Set()
|
|
74
75
|
let didWarn = false
|
|
@@ -98,7 +99,7 @@ module.exports.checkForRequiredModules = function () {
|
|
|
98
99
|
continue
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
if (naughties.has(pkg) || !(pkg in packages)) continue
|
|
102
|
+
if (naughties.has(pkg) || (!(pkg in packages) && !isRewriteTargetName(pkg))) continue
|
|
102
103
|
|
|
103
104
|
loadOrderWarnings.push(
|
|
104
105
|
() => `Warning: Package '${pkg}' was loaded before dd-trace! This may break instrumentation.`
|