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
|
@@ -9,7 +9,11 @@ const { isMainThread, parentPort } = require('node:worker_threads')
|
|
|
9
9
|
const { channel } = require('dc-polyfill')
|
|
10
10
|
const shimmer = require('../../datadog-shimmer')
|
|
11
11
|
const log = require('../../dd-trace/src/log')
|
|
12
|
-
const {
|
|
12
|
+
const {
|
|
13
|
+
getEfdRetryCountForDuration,
|
|
14
|
+
EMPTY_EFD_RETRY_POLICY,
|
|
15
|
+
} = require('../../dd-trace/src/ci-visibility/efd-retry-policy')
|
|
16
|
+
const { getDynamicAtrRetryCount } = require('../../dd-trace/src/ci-visibility/dynamic-atr-retries')
|
|
13
17
|
const {
|
|
14
18
|
DYNAMIC_NAME_RE,
|
|
15
19
|
getTestSuitePath,
|
|
@@ -63,6 +67,8 @@ const modifiedTasks = new WeakSet()
|
|
|
63
67
|
const efdRetryTasks = new WeakSet()
|
|
64
68
|
const efdDeterminedRetries = new WeakMap()
|
|
65
69
|
const efdSlowAbortedTasks = new WeakSet()
|
|
70
|
+
// Each native repetition selects its own budget from its first attempt.
|
|
71
|
+
const dynamicAtrStateByTask = new WeakMap()
|
|
66
72
|
const efdExecutionStartByTask = new WeakMap()
|
|
67
73
|
const efdSkippedRetryResults = new WeakMap()
|
|
68
74
|
const attemptToFixExecutions = new Map()
|
|
@@ -184,7 +190,6 @@ function getVitestCoverageOptions () {
|
|
|
184
190
|
/**
|
|
185
191
|
* Check whether the current Vitest worker reuses its module cache across test suites.
|
|
186
192
|
*
|
|
187
|
-
* @returns {boolean}
|
|
188
193
|
*/
|
|
189
194
|
function isNonIsolatedRun () {
|
|
190
195
|
const config = globalThis.__vitest_worker__?.config
|
|
@@ -287,7 +292,6 @@ function getFinalAttemptToFixStatus (task, state, isSwitchedStatus, testCtx) {
|
|
|
287
292
|
* Return the normalized test suite path prepared by the main process for a Vitest task.
|
|
288
293
|
*
|
|
289
294
|
* @param {{ file: { filepath: string } }} task
|
|
290
|
-
* @returns {string}
|
|
291
295
|
*/
|
|
292
296
|
function getTaskTestSuite (task) {
|
|
293
297
|
return taskToTestProperties.get(task)?.testSuite || task.file.filepath
|
|
@@ -343,7 +347,6 @@ function wrapBeforeEachCleanupResult (task, result) {
|
|
|
343
347
|
* Returns whether a Vitest task tree includes any concurrent task.
|
|
344
348
|
*
|
|
345
349
|
* @param {Array<{ type?: string, concurrent?: boolean, tasks?: object[] }>|undefined} tasks
|
|
346
|
-
* @returns {boolean}
|
|
347
350
|
*/
|
|
348
351
|
function hasConcurrentTask (tasks) {
|
|
349
352
|
if (!tasks) return false
|
|
@@ -360,7 +363,6 @@ function hasConcurrentTask (tasks) {
|
|
|
360
363
|
* Returns whether a Vitest file includes any concurrent test.
|
|
361
364
|
*
|
|
362
365
|
* @param {{ tasks?: object[] }} file
|
|
363
|
-
* @returns {boolean}
|
|
364
366
|
*/
|
|
365
367
|
function hasConcurrentTests (file) {
|
|
366
368
|
const cached = fileToHasConcurrentTests.get(file)
|
|
@@ -376,7 +378,6 @@ function hasConcurrentTests (file) {
|
|
|
376
378
|
*
|
|
377
379
|
* @param {{ filepath: string, tasks?: object[] }} file
|
|
378
380
|
* @param {object} providedContext
|
|
379
|
-
* @returns {boolean}
|
|
380
381
|
*/
|
|
381
382
|
function hasRunnableNewTest (file, providedContext) {
|
|
382
383
|
for (const task of getTypeTasks(file.tasks)) {
|
|
@@ -395,7 +396,6 @@ function hasRunnableNewTest (file, providedContext) {
|
|
|
395
396
|
*
|
|
396
397
|
* @param {number} requestId
|
|
397
398
|
* @param {boolean} allowed
|
|
398
|
-
* @returns {void}
|
|
399
399
|
*/
|
|
400
400
|
function finishEfdSuiteAdmissionRequest (requestId, allowed) {
|
|
401
401
|
const request = pendingEfdSuiteAdmissionRequests.get(requestId)
|
|
@@ -410,7 +410,6 @@ function finishEfdSuiteAdmissionRequest (requestId, allowed) {
|
|
|
410
410
|
* Handles an EFD suite admission response from the Vitest main process.
|
|
411
411
|
*
|
|
412
412
|
* @param {unknown} message
|
|
413
|
-
* @returns {void}
|
|
414
413
|
*/
|
|
415
414
|
function handleEfdSuiteAdmissionResponse (message) {
|
|
416
415
|
if (!Array.isArray(message) || message[0] !== VITEST_WORKER_EFD_SUITE_ADMISSION_RESPONSE_CODE) return
|
|
@@ -591,6 +590,31 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
591
590
|
}
|
|
592
591
|
}
|
|
593
592
|
|
|
593
|
+
if (
|
|
594
|
+
providedContext.isDynamicAtrEnabled &&
|
|
595
|
+
isFlakyTestRetriesEnabledForTask(providedContext, task) &&
|
|
596
|
+
!attemptToFixTasks.has(task) &&
|
|
597
|
+
!efdRetryTasks.has(task) &&
|
|
598
|
+
task.retry?.__ddTestOptAtr && task.retry.count > 0
|
|
599
|
+
) {
|
|
600
|
+
const state = { executionStart: process.uptime(), retryOffset: 0, retryCount: undefined }
|
|
601
|
+
dynamicAtrStateByTask.set(task, state)
|
|
602
|
+
// The runner caches count, but evaluates condition after hooks and fixture cleanup.
|
|
603
|
+
task.retry = {
|
|
604
|
+
...task.retry,
|
|
605
|
+
condition () {
|
|
606
|
+
if (state.retryCount === undefined) {
|
|
607
|
+
state.retryCount = getDynamicAtrRetryCount(
|
|
608
|
+
(process.uptime() - state.executionStart) * 1000,
|
|
609
|
+
earlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY,
|
|
610
|
+
providedContext.dynamicAtrBuckets
|
|
611
|
+
)
|
|
612
|
+
}
|
|
613
|
+
return task.result.retryCount - state.retryOffset < state.retryCount
|
|
614
|
+
},
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
594
618
|
return onBeforeRunTask.apply(this, arguments)
|
|
595
619
|
})
|
|
596
620
|
|
|
@@ -653,6 +677,13 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
653
677
|
}
|
|
654
678
|
|
|
655
679
|
const { retry: numAttempt, repeats: numRepetition } = retryInfo
|
|
680
|
+
const dynamicAtrState = dynamicAtrStateByTask.get(task)
|
|
681
|
+
if (dynamicAtrState && numAttempt === 0) {
|
|
682
|
+
if (numRepetition > 0) dynamicAtrState.executionStart = process.uptime()
|
|
683
|
+
// Vitest accumulates result.retryCount across native repetitions.
|
|
684
|
+
dynamicAtrState.retryOffset = task.result.retryCount
|
|
685
|
+
dynamicAtrState.retryCount = undefined
|
|
686
|
+
}
|
|
656
687
|
const isFailedTestReplayAllowed = !hasConcurrentTests(task.file)
|
|
657
688
|
const isEfdManagedTask = efdRetryTasks.has(task)
|
|
658
689
|
|
|
@@ -836,15 +867,16 @@ function wrapVitestTestRunner (VitestTestRunner) {
|
|
|
836
867
|
}
|
|
837
868
|
const result = await onAfterTryTask.apply(this, arguments)
|
|
838
869
|
|
|
870
|
+
const providedContext = getProvidedContext()
|
|
839
871
|
const {
|
|
840
872
|
testManagementAttemptToFixRetries,
|
|
841
873
|
earlyFlakeDetectionRetryPolicy,
|
|
842
|
-
} =
|
|
874
|
+
} = providedContext
|
|
843
875
|
|
|
844
876
|
const status = getVitestTestStatus(task, retryInfo.retry)
|
|
845
877
|
const ctx = taskToCtx.get(task)
|
|
846
878
|
|
|
847
|
-
const { isDiEnabled } =
|
|
879
|
+
const { isDiEnabled } = providedContext
|
|
848
880
|
const isFailedTestReplayAllowed = !hasConcurrentTests(task.file)
|
|
849
881
|
|
|
850
882
|
if (efdSkippedRetryResults.has(task)) {
|
|
@@ -1113,10 +1145,14 @@ function getStartTestsWrapper (frameworkVersion) {
|
|
|
1113
1145
|
|
|
1114
1146
|
// ATR: set hasFailedAllRetries when all auto test retries were exhausted and every attempt failed
|
|
1115
1147
|
const isAtrRetry = isFlakyTestRetriesEnabledForTask(providedContext, task) && !attemptToFixTasks.has(task) &&
|
|
1116
|
-
!
|
|
1148
|
+
!efdRetryTasks.has(task)
|
|
1117
1149
|
if (isAtrRetry) {
|
|
1118
|
-
|
|
1119
|
-
|
|
1150
|
+
// Dynamic ATR: use the per-test duration-based count instead of the flat limit.
|
|
1151
|
+
const dynamicAtrState = dynamicAtrStateByTask.get(task)
|
|
1152
|
+
const maxRetries = dynamicAtrState?.retryCount === undefined
|
|
1153
|
+
? (providedContext.flakyTestRetriesCount ?? 0)
|
|
1154
|
+
: dynamicAtrState.retryOffset + dynamicAtrState.retryCount
|
|
1155
|
+
if (maxRetries > 0 && task.result?.retryCount >= maxRetries) {
|
|
1120
1156
|
hasFailedAllRetries = true
|
|
1121
1157
|
}
|
|
1122
1158
|
}
|
|
@@ -63,6 +63,7 @@ const baseReporterWaitForSyncCh = tracingChannel('orchestrion:@wdio/runner:BaseR
|
|
|
63
63
|
const runnerRunCh = tracingChannel('orchestrion:@wdio/runner:Runner_run')
|
|
64
64
|
const executeAsyncCh = tracingChannel('orchestrion:@wdio/utils:executeAsync')
|
|
65
65
|
const launcherStartInstanceCh = tracingChannel('orchestrion:@wdio/cli:Launcher_startInstance')
|
|
66
|
+
const configParserShardCh = tracingChannel('orchestrion:@wdio/config:ConfigParser_shard')
|
|
66
67
|
const localRunnerRunCh = tracingChannel('orchestrion:@wdio/local-runner:LocalRunner_run')
|
|
67
68
|
const localRunnerShutdownCh = tracingChannel('orchestrion:@wdio/local-runner:LocalRunner_shutdown')
|
|
68
69
|
const testFrameworkFnWrapperCh = tracingChannel('orchestrion:@wdio/utils:testFrameworkFnWrapper')
|
|
@@ -87,6 +88,7 @@ if (loadCh.hasSubscribers) {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
const coordinatorStates = new WeakMap()
|
|
91
|
+
const emptyShardConfigurations = new WeakSet()
|
|
90
92
|
const localRunnerVersions = new WeakMap()
|
|
91
93
|
const rumBrowsers = new Set()
|
|
92
94
|
const rumCorrelationBrowsers = new Set()
|
|
@@ -119,7 +121,6 @@ addHook({
|
|
|
119
121
|
* Returns whether this browser can preload and clean correlation across every browsing context.
|
|
120
122
|
*
|
|
121
123
|
* @param {object} browser
|
|
122
|
-
* @returns {boolean}
|
|
123
124
|
*/
|
|
124
125
|
function canCorrelateRumBrowser (browser) {
|
|
125
126
|
return browser?.isBidi &&
|
|
@@ -132,7 +133,6 @@ function canCorrelateRumBrowser (browser) {
|
|
|
132
133
|
* Releases retained state when a WebDriver session ends.
|
|
133
134
|
*
|
|
134
135
|
* @param {object} browser
|
|
135
|
-
* @returns {void}
|
|
136
136
|
*/
|
|
137
137
|
function releaseRumBrowser (browser) {
|
|
138
138
|
rumBrowsers.delete(browser)
|
|
@@ -152,7 +152,6 @@ function releaseRumBrowser (browser) {
|
|
|
152
152
|
* Retains a browser and watches for WebDriver's deleteSession result event.
|
|
153
153
|
*
|
|
154
154
|
* @param {object} browser
|
|
155
|
-
* @returns {void}
|
|
156
155
|
*/
|
|
157
156
|
function retainRumBrowser (browser) {
|
|
158
157
|
rumBrowsers.add(browser)
|
|
@@ -171,7 +170,6 @@ function retainRumBrowser (browser) {
|
|
|
171
170
|
* Returns whether RUM is inactive because its configured sampling rate is below 100%.
|
|
172
171
|
*
|
|
173
172
|
* @param {{isRumActive: boolean, isRumInstrumented: boolean, rumSamplingRate: number|null}} rumState
|
|
174
|
-
* @returns {boolean}
|
|
175
173
|
*/
|
|
176
174
|
function isRumSampledOut (rumState) {
|
|
177
175
|
return rumState.isRumInstrumented && !rumState.isRumActive &&
|
|
@@ -652,7 +650,6 @@ function handleRumProtocolCommand (command) {
|
|
|
652
650
|
* Wraps only WebDriver commands that need to wait for RUM work before their request starts.
|
|
653
651
|
*
|
|
654
652
|
* @param {{arguments?: unknown[], result?: Function}} context
|
|
655
|
-
* @returns {void}
|
|
656
653
|
*/
|
|
657
654
|
function wrapRumProtocolCommand (context) {
|
|
658
655
|
const command = context.arguments?.[2]?.command
|
|
@@ -675,7 +672,6 @@ function wrapRumProtocolCommand (context) {
|
|
|
675
672
|
* A tracing-channel start subscriber is synchronous and cannot delay the static async handler itself.
|
|
676
673
|
*
|
|
677
674
|
* @param {{result?: {_bidiHandler?: {value?: object}}}} context
|
|
678
|
-
* @returns {void}
|
|
679
675
|
*/
|
|
680
676
|
function wrapRumBidiNavigation (context) {
|
|
681
677
|
const bidiHandler = context.result?._bidiHandler?.value
|
|
@@ -844,7 +840,6 @@ async function retryRumBrowsers (testExecutionId) {
|
|
|
844
840
|
* Delays BiDi navigation until its RUM correlation preload is installed.
|
|
845
841
|
*
|
|
846
842
|
* @param {{rumPreloadCallback?: () => Promise<void>}} context
|
|
847
|
-
* @returns {void}
|
|
848
843
|
*/
|
|
849
844
|
function waitForRumNavigationStart (context) {
|
|
850
845
|
if (!rumPageNavigateCh.hasSubscribers) return
|
|
@@ -860,7 +855,6 @@ function waitForRumNavigationStart (context) {
|
|
|
860
855
|
* }} context
|
|
861
856
|
* @param {() => Promise<unknown>} operation
|
|
862
857
|
* @param {boolean} [waitForResolve]
|
|
863
|
-
* @returns {void}
|
|
864
858
|
*/
|
|
865
859
|
function setRumWaitCallbacks (context, operation, waitForResolve = true) {
|
|
866
860
|
const waitForOperation = onDone => operation().then(onDone, onDone)
|
|
@@ -872,7 +866,6 @@ function setRumWaitCallbacks (context, operation, waitForResolve = true) {
|
|
|
872
866
|
* Delays URL completion until RUM detection and correlation settle.
|
|
873
867
|
*
|
|
874
868
|
* @param {object} context
|
|
875
|
-
* @returns {void}
|
|
876
869
|
*/
|
|
877
870
|
function waitForRumNavigation (context) {
|
|
878
871
|
if (!rumPageNavigateCh.hasSubscribers) return
|
|
@@ -884,7 +877,6 @@ function waitForRumNavigation (context) {
|
|
|
884
877
|
* Correlation remains active until every afterEach hook has run.
|
|
885
878
|
*
|
|
886
879
|
* @param {{arguments?: unknown[]}} context
|
|
887
|
-
* @returns {void}
|
|
888
880
|
*/
|
|
889
881
|
function waitForRumCleanup (context) {
|
|
890
882
|
const type = context.arguments?.[1]
|
|
@@ -904,7 +896,6 @@ function waitForRumCleanup (context) {
|
|
|
904
896
|
* Correlation remains active until every afterEach hook has run.
|
|
905
897
|
*
|
|
906
898
|
* @param {{arguments?: unknown[]}} context
|
|
907
|
-
* @returns {void}
|
|
908
899
|
*/
|
|
909
900
|
function waitForFailedRumCleanup (context) {
|
|
910
901
|
const type = context.arguments?.[1]
|
|
@@ -928,7 +919,6 @@ function waitForFailedRumCleanup (context) {
|
|
|
928
919
|
* Prepares retained RUM state before the next test or non-afterEach hook starts.
|
|
929
920
|
*
|
|
930
921
|
* @param {{arguments?: unknown[], rumCleanupCallback?: () => Promise<void>}} context
|
|
931
|
-
* @returns {void}
|
|
932
922
|
*/
|
|
933
923
|
function waitForRumTestStart (context) {
|
|
934
924
|
const type = context.arguments?.[1]
|
|
@@ -948,6 +938,7 @@ function waitForRumTestStart (context) {
|
|
|
948
938
|
* @property {string} framework
|
|
949
939
|
* @property {string|undefined} rootDir
|
|
950
940
|
* @property {typeof process.env|undefined} runnerEnv
|
|
941
|
+
* @property {{total: number}|undefined} shard
|
|
951
942
|
*/
|
|
952
943
|
|
|
953
944
|
/**
|
|
@@ -1014,12 +1005,14 @@ function waitForRumTestStart (context) {
|
|
|
1014
1005
|
*/
|
|
1015
1006
|
function createWorkerConfiguration () {
|
|
1016
1007
|
return {
|
|
1008
|
+
dynamicAtrBuckets: undefined,
|
|
1017
1009
|
earlyFlakeDetectionFaultyThreshold: 30,
|
|
1018
1010
|
earlyFlakeDetectionRetryPolicy: EMPTY_EFD_RETRY_POLICY,
|
|
1019
1011
|
flakyTestRetriesCount: 0,
|
|
1020
1012
|
isCodeCoverageEnabled: false,
|
|
1021
1013
|
isCoverageReportUploadEnabled: false,
|
|
1022
1014
|
isDiEnabled: false,
|
|
1015
|
+
isDynamicAtrEnabled: false,
|
|
1023
1016
|
isEarlyFlakeDetectionEnabled: false,
|
|
1024
1017
|
isFlakyTestRetriesEnabled: false,
|
|
1025
1018
|
isImpactedTestsEnabled: false,
|
|
@@ -1046,7 +1039,6 @@ function createWorkerConfiguration () {
|
|
|
1046
1039
|
* resolveCallback?: (onDone: () => void) => void,
|
|
1047
1040
|
* rejectCallback?: (onDone: () => void) => void
|
|
1048
1041
|
* }} context
|
|
1049
|
-
* @returns {void}
|
|
1050
1042
|
*/
|
|
1051
1043
|
function initializeJasmineWorker (adapter, context) {
|
|
1052
1044
|
if (!isWebdriverioWorker) {
|
|
@@ -1061,7 +1053,6 @@ function initializeJasmineWorker (adapter, context) {
|
|
|
1061
1053
|
* Publishes run-level failures that are absent from suiteDone.
|
|
1062
1054
|
*
|
|
1063
1055
|
* @param {object} result
|
|
1064
|
-
* @returns {void}
|
|
1065
1056
|
*/
|
|
1066
1057
|
jasmineDone (result) {
|
|
1067
1058
|
jasmineDoneCh.publish({ result })
|
|
@@ -1073,7 +1064,6 @@ function initializeJasmineWorker (adapter, context) {
|
|
|
1073
1064
|
* Waits until the coordinator has started this worker's parent spans.
|
|
1074
1065
|
*
|
|
1075
1066
|
* @param {() => void} onDone
|
|
1076
|
-
* @returns {void}
|
|
1077
1067
|
*/
|
|
1078
1068
|
const waitForCoordinator = onDone => {
|
|
1079
1069
|
const requestId = `${process.pid}-${++jasmineWorkerRequestId}`
|
|
@@ -1083,7 +1073,6 @@ function initializeJasmineWorker (adapter, context) {
|
|
|
1083
1073
|
* Releases Jasmine initialization exactly once.
|
|
1084
1074
|
*
|
|
1085
1075
|
* @param {object} [configuration]
|
|
1086
|
-
* @returns {void}
|
|
1087
1076
|
*/
|
|
1088
1077
|
function finish (configuration = createWorkerConfiguration()) {
|
|
1089
1078
|
if (finished) {
|
|
@@ -1107,7 +1096,6 @@ function initializeJasmineWorker (adapter, context) {
|
|
|
1107
1096
|
* Receives coordinator readiness for this worker.
|
|
1108
1097
|
*
|
|
1109
1098
|
* @param {object} message
|
|
1110
|
-
* @returns {void}
|
|
1111
1099
|
*/
|
|
1112
1100
|
function onMessage (message) {
|
|
1113
1101
|
if (message?.name === WORKER_READY_RESPONSE && message.content?.requestId === requestId) {
|
|
@@ -1190,7 +1178,6 @@ function getCoordinatorState (localRunner) {
|
|
|
1190
1178
|
* Normalizes a WebdriverIO spec identifier to a filesystem path.
|
|
1191
1179
|
*
|
|
1192
1180
|
* @param {string} file
|
|
1193
|
-
* @returns {string}
|
|
1194
1181
|
*/
|
|
1195
1182
|
function normalizeFile (file) {
|
|
1196
1183
|
return file.startsWith('file://') ? fileURLToPath(file) : file
|
|
@@ -1201,7 +1188,6 @@ function normalizeFile (file) {
|
|
|
1201
1188
|
*
|
|
1202
1189
|
* @param {CoordinatorState} state
|
|
1203
1190
|
* @param {string[]} files
|
|
1204
|
-
* @returns {void}
|
|
1205
1191
|
*/
|
|
1206
1192
|
function addScheduledFiles (state, files) {
|
|
1207
1193
|
for (const file of files) {
|
|
@@ -1214,7 +1200,6 @@ function addScheduledFiles (state, files) {
|
|
|
1214
1200
|
*
|
|
1215
1201
|
* @param {string|undefined} workerNodeOptions
|
|
1216
1202
|
* @param {string} launcherNodeOptions
|
|
1217
|
-
* @returns {boolean}
|
|
1218
1203
|
*/
|
|
1219
1204
|
function includesNodeOptions (workerNodeOptions, launcherNodeOptions) {
|
|
1220
1205
|
if (!workerNodeOptions) {
|
|
@@ -1240,7 +1225,6 @@ function includesNodeOptions (workerNodeOptions, launcherNodeOptions) {
|
|
|
1240
1225
|
* Starts the single test session owned by the WebdriverIO launcher.
|
|
1241
1226
|
*
|
|
1242
1227
|
* @param {CoordinatorState} state
|
|
1243
|
-
* @returns {void}
|
|
1244
1228
|
*/
|
|
1245
1229
|
function startSession (state) {
|
|
1246
1230
|
if (state.sessionStarted) {
|
|
@@ -1264,7 +1248,6 @@ function startSession (state) {
|
|
|
1264
1248
|
* Completes coordinator initialization and releases waiting workers.
|
|
1265
1249
|
*
|
|
1266
1250
|
* @param {CoordinatorState} state
|
|
1267
|
-
* @returns {void}
|
|
1268
1251
|
*/
|
|
1269
1252
|
function completeCoordinatorInitialization (state) {
|
|
1270
1253
|
if (state.initialized) {
|
|
@@ -1288,7 +1271,6 @@ function completeCoordinatorInitialization (state) {
|
|
|
1288
1271
|
* @param {CoordinatorState} state
|
|
1289
1272
|
* @param {import('node:diagnostics_channel').Channel} requestChannel
|
|
1290
1273
|
* @param {(response: object) => void} onDone
|
|
1291
|
-
* @returns {void}
|
|
1292
1274
|
*/
|
|
1293
1275
|
function requestCoordinatorData (state, requestChannel, onDone) {
|
|
1294
1276
|
if (!requestChannel.hasSubscribers) {
|
|
@@ -1320,7 +1302,6 @@ function getMochaFrameworkData (frameworkData) {
|
|
|
1320
1302
|
* Applies the worker configuration for an EFD session with faulty known-tests data.
|
|
1321
1303
|
*
|
|
1322
1304
|
* @param {object} configuration
|
|
1323
|
-
* @returns {void}
|
|
1324
1305
|
*/
|
|
1325
1306
|
function setEarlyFlakeDetectionFaulty (configuration) {
|
|
1326
1307
|
configuration.isEarlyFlakeDetectionEnabled = false
|
|
@@ -1333,7 +1314,6 @@ function setEarlyFlakeDetectionFaulty (configuration) {
|
|
|
1333
1314
|
*
|
|
1334
1315
|
* @param {CoordinatorState} state
|
|
1335
1316
|
* @param {object|undefined} response
|
|
1336
|
-
* @returns {void}
|
|
1337
1317
|
*/
|
|
1338
1318
|
function configureCoordinator (state, response) {
|
|
1339
1319
|
const { configuration } = state
|
|
@@ -1354,10 +1334,14 @@ function configureCoordinator (state, response) {
|
|
|
1354
1334
|
return
|
|
1355
1335
|
}
|
|
1356
1336
|
|
|
1337
|
+
configuration.dynamicAtrBuckets = libraryConfig.isDynamicAtrEnabled === true
|
|
1338
|
+
? libraryConfig.dynamicAtrBuckets
|
|
1339
|
+
: undefined
|
|
1357
1340
|
configuration.earlyFlakeDetectionFaultyThreshold = libraryConfig.earlyFlakeDetectionFaultyThreshold
|
|
1358
1341
|
configuration.earlyFlakeDetectionRetryPolicy = libraryConfig.earlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY
|
|
1359
1342
|
configuration.flakyTestRetriesCount = libraryConfig.flakyTestRetriesCount
|
|
1360
1343
|
configuration.isDiEnabled = libraryConfig.isDiEnabled
|
|
1344
|
+
configuration.isDynamicAtrEnabled = libraryConfig.isDynamicAtrEnabled === true
|
|
1361
1345
|
configuration.isEarlyFlakeDetectionEnabled = libraryConfig.isEarlyFlakeDetectionEnabled
|
|
1362
1346
|
configuration.isFlakyTestRetriesEnabled = libraryConfig.isFlakyTestRetriesEnabled
|
|
1363
1347
|
configuration.isImpactedTestsEnabled = libraryConfig.isImpactedTestsEnabled
|
|
@@ -1371,7 +1355,6 @@ function configureCoordinator (state, response) {
|
|
|
1371
1355
|
/**
|
|
1372
1356
|
* Completes initialization after all enabled requests settle.
|
|
1373
1357
|
*
|
|
1374
|
-
* @returns {void}
|
|
1375
1358
|
*/
|
|
1376
1359
|
function finishRequest () {
|
|
1377
1360
|
pendingRequests--
|
|
@@ -1430,7 +1413,6 @@ function configureCoordinator (state, response) {
|
|
|
1430
1413
|
*
|
|
1431
1414
|
* @param {CoordinatorState} state
|
|
1432
1415
|
* @param {(configuration: object) => void} [onDone]
|
|
1433
|
-
* @returns {void}
|
|
1434
1416
|
*/
|
|
1435
1417
|
function initializeCoordinator (state, onDone) {
|
|
1436
1418
|
if (state.initialized) {
|
|
@@ -1474,7 +1456,6 @@ function initializeCoordinator (state, onDone) {
|
|
|
1474
1456
|
*
|
|
1475
1457
|
* @param {WorkerRecord} workerRecord
|
|
1476
1458
|
* @param {string[]} files
|
|
1477
|
-
* @returns {void}
|
|
1478
1459
|
*/
|
|
1479
1460
|
function startWorkerSuites (workerRecord, files) {
|
|
1480
1461
|
for (const rawFile of files) {
|
|
@@ -1502,7 +1483,6 @@ function startWorkerSuites (workerRecord, files) {
|
|
|
1502
1483
|
* @param {WorkerRecord} workerRecord
|
|
1503
1484
|
* @param {string} rawFile
|
|
1504
1485
|
* @param {string} status
|
|
1505
|
-
* @returns {void}
|
|
1506
1486
|
*/
|
|
1507
1487
|
function finishWorkerSuite (state, workerRecord, rawFile, status) {
|
|
1508
1488
|
const file = normalizeFile(rawFile)
|
|
@@ -1524,7 +1504,6 @@ function finishWorkerSuite (state, workerRecord, rawFile, status) {
|
|
|
1524
1504
|
* @param {CoordinatorState} state
|
|
1525
1505
|
* @param {WorkerRecord} workerRecord
|
|
1526
1506
|
* @param {string} status
|
|
1527
|
-
* @returns {void}
|
|
1528
1507
|
*/
|
|
1529
1508
|
function finishAllWorkerSuites (state, workerRecord, status) {
|
|
1530
1509
|
let hasFailedSuite = false
|
|
@@ -1549,7 +1528,6 @@ function finishAllWorkerSuites (state, workerRecord, status) {
|
|
|
1549
1528
|
*
|
|
1550
1529
|
* @param {WorkerRecord} workerRecord
|
|
1551
1530
|
* @param {object} message
|
|
1552
|
-
* @returns {void}
|
|
1553
1531
|
*/
|
|
1554
1532
|
function sendWorkerMessage (workerRecord, message) {
|
|
1555
1533
|
const childProcess = workerRecord.worker.childProcess
|
|
@@ -1570,7 +1548,6 @@ function sendWorkerMessage (workerRecord, message) {
|
|
|
1570
1548
|
* @param {CoordinatorState} state
|
|
1571
1549
|
* @param {WorkerRecord} workerRecord
|
|
1572
1550
|
* @param {object} message
|
|
1573
|
-
* @returns {void}
|
|
1574
1551
|
*/
|
|
1575
1552
|
function handleConfigurationRequest (state, workerRecord, message) {
|
|
1576
1553
|
const { files = [], requestId } = message.content || {}
|
|
@@ -1594,7 +1571,6 @@ function handleConfigurationRequest (state, workerRecord, message) {
|
|
|
1594
1571
|
*
|
|
1595
1572
|
* @param {CoordinatorState} state
|
|
1596
1573
|
* @param {string[]} files
|
|
1597
|
-
* @returns {void}
|
|
1598
1574
|
*/
|
|
1599
1575
|
function updateEarlyFlakeDetectionFaultyState (state, files) {
|
|
1600
1576
|
const { configuration } = state
|
|
@@ -1641,7 +1617,6 @@ function getWebdriverioSuiteError (error) {
|
|
|
1641
1617
|
*
|
|
1642
1618
|
* @param {WorkerRecord} workerRecord
|
|
1643
1619
|
* @param {object} message
|
|
1644
|
-
* @returns {void}
|
|
1645
1620
|
*/
|
|
1646
1621
|
function handleSuiteResults (workerRecord, message) {
|
|
1647
1622
|
const { results = [] } = message.content || {}
|
|
@@ -1662,7 +1637,6 @@ function handleSuiteResults (workerRecord, message) {
|
|
|
1662
1637
|
* @param {CoordinatorState} state
|
|
1663
1638
|
* @param {WorkerRecord} workerRecord
|
|
1664
1639
|
* @param {object|unknown[]} message
|
|
1665
|
-
* @returns {void}
|
|
1666
1640
|
*/
|
|
1667
1641
|
function handleWorkerMessage (state, workerRecord, message) {
|
|
1668
1642
|
if (message?.origin === WEBDRIVERIO_WORKER_ORIGIN && message.name === WEBDRIVERIO_WORKER_EVENT) {
|
|
@@ -1756,7 +1730,6 @@ function handleWorkerMessage (state, workerRecord, message) {
|
|
|
1756
1730
|
* @param {CoordinatorState} state
|
|
1757
1731
|
* @param {WorkerRecord} workerRecord
|
|
1758
1732
|
* @param {object} exit
|
|
1759
|
-
* @returns {void}
|
|
1760
1733
|
*/
|
|
1761
1734
|
function handleWorkerExit (state, workerRecord, exit) {
|
|
1762
1735
|
state.activeWorkers--
|
|
@@ -1779,7 +1752,6 @@ function handleWorkerExit (state, workerRecord, exit) {
|
|
|
1779
1752
|
* @param {CoordinatorState} state
|
|
1780
1753
|
* @param {object} worker
|
|
1781
1754
|
* @param {string[]} specs
|
|
1782
|
-
* @returns {void}
|
|
1783
1755
|
*/
|
|
1784
1756
|
function registerWorker (state, worker, specs) {
|
|
1785
1757
|
const normalizedSpecs = []
|
|
@@ -1811,7 +1783,6 @@ function registerWorker (state, worker, specs) {
|
|
|
1811
1783
|
* Calculates the final status for the coordinated session.
|
|
1812
1784
|
*
|
|
1813
1785
|
* @param {CoordinatorState} state
|
|
1814
|
-
* @returns {string}
|
|
1815
1786
|
*/
|
|
1816
1787
|
function getSessionStatus (state) {
|
|
1817
1788
|
let hasPassingSuite = false
|
|
@@ -1837,13 +1808,27 @@ function getSessionStatus (state) {
|
|
|
1837
1808
|
return hasPassingSuite ? 'pass' : 'skip'
|
|
1838
1809
|
}
|
|
1839
1810
|
|
|
1811
|
+
/**
|
|
1812
|
+
* Explains a skipped session using the workers' discovery results.
|
|
1813
|
+
*
|
|
1814
|
+
* @param {CoordinatorState} state
|
|
1815
|
+
*/
|
|
1816
|
+
function getTestSessionEmptyReason (state) {
|
|
1817
|
+
if (state.workers.size === 0 && emptyShardConfigurations.has(getRunnerConfiguration(state.localRunner))) {
|
|
1818
|
+
return 'zero_test_shard'
|
|
1819
|
+
}
|
|
1820
|
+
for (const workerRecord of state.workers) {
|
|
1821
|
+
if (workerRecord.hasTests !== false) return 'all_tests_skipped'
|
|
1822
|
+
}
|
|
1823
|
+
return 'zero_tests'
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1840
1826
|
/**
|
|
1841
1827
|
* Finishes the single WebdriverIO-owned test session.
|
|
1842
1828
|
*
|
|
1843
1829
|
* @param {CoordinatorState} state
|
|
1844
1830
|
* @param {unknown} error
|
|
1845
1831
|
* @param {() => void} onDone
|
|
1846
|
-
* @returns {void}
|
|
1847
1832
|
*/
|
|
1848
1833
|
function finishCoordinator (state, error, onDone) {
|
|
1849
1834
|
if (state.finished) {
|
|
@@ -1851,9 +1836,9 @@ function finishCoordinator (state, error, onDone) {
|
|
|
1851
1836
|
return
|
|
1852
1837
|
}
|
|
1853
1838
|
if (!state.sessionStarted) {
|
|
1854
|
-
if (!error &&
|
|
1855
|
-
|
|
1856
|
-
|
|
1839
|
+
if (!error && state.workers.size === 0 &&
|
|
1840
|
+
!emptyShardConfigurations.has(getRunnerConfiguration(state.localRunner))) {
|
|
1841
|
+
error = new Error('No test files were found.')
|
|
1857
1842
|
}
|
|
1858
1843
|
initializeCoordinator(state, () => finishCoordinator(state, error, onDone))
|
|
1859
1844
|
return
|
|
@@ -1877,8 +1862,10 @@ function finishCoordinator (state, error, onDone) {
|
|
|
1877
1862
|
return
|
|
1878
1863
|
}
|
|
1879
1864
|
|
|
1865
|
+
const status = error ? 'fail' : getSessionStatus(state)
|
|
1880
1866
|
testSessionFinishCh.publish({
|
|
1881
|
-
status
|
|
1867
|
+
status,
|
|
1868
|
+
testSessionEmptyReason: status === 'skip' ? getTestSessionEmptyReason(state) : undefined,
|
|
1882
1869
|
error,
|
|
1883
1870
|
isEarlyFlakeDetectionEnabled: state.configuration.isEarlyFlakeDetectionEnabled,
|
|
1884
1871
|
isEarlyFlakeDetectionFaulty: state.configuration.isEarlyFlakeDetectionFaulty,
|
|
@@ -1901,7 +1888,6 @@ function finishCoordinator (state, error, onDone) {
|
|
|
1901
1888
|
* resolveCallback?: (onDone: () => void) => void,
|
|
1902
1889
|
* rejectCallback?: (onDone: () => void) => void
|
|
1903
1890
|
* }} context
|
|
1904
|
-
* @returns {void}
|
|
1905
1891
|
*/
|
|
1906
1892
|
function waitForLogSubmissionAtWorkerExit (context) {
|
|
1907
1893
|
const shouldCleanRum = rumBrowsers.size > 0
|
|
@@ -1926,7 +1912,6 @@ function waitForLogSubmissionAtWorkerExit (context) {
|
|
|
1926
1912
|
* Cleans retained RUM browsers before WebdriverIO deletes the worker session.
|
|
1927
1913
|
*
|
|
1928
1914
|
* @param {{rumCleanupCallback?: () => Promise<void>}} context
|
|
1929
|
-
* @returns {void}
|
|
1930
1915
|
*/
|
|
1931
1916
|
function waitForRumCleanupBeforeSessionEnd (context) {
|
|
1932
1917
|
context.rumCleanupCallback = cleanupAllRumBrowsers
|
|
@@ -1995,6 +1980,17 @@ jasmineAdapterInitCh.subscribe({
|
|
|
1995
1980
|
|
|
1996
1981
|
// dc-polyfill supports partial tracing-channel subscribers, unlike the Node.js type definition.
|
|
1997
1982
|
// @ts-expect-error
|
|
1983
|
+
configParserShardCh.subscribe({
|
|
1984
|
+
end (context) {
|
|
1985
|
+
const config = context.self._config
|
|
1986
|
+
if (testFinishCh.hasSubscribers && config?.shard?.total > 1 &&
|
|
1987
|
+
context.arguments[0].length > 0 && context.result?.length === 0) {
|
|
1988
|
+
emptyShardConfigurations.add(config)
|
|
1989
|
+
}
|
|
1990
|
+
},
|
|
1991
|
+
})
|
|
1992
|
+
|
|
1993
|
+
// @ts-expect-error See the partial tracing-channel subscriber above.
|
|
1998
1994
|
launcherStartInstanceCh.subscribe({
|
|
1999
1995
|
start (context) {
|
|
2000
1996
|
const localRunner = context.self?.runner
|
|
@@ -2069,10 +2065,11 @@ localRunnerRunCh.subscribe({
|
|
|
2069
2065
|
// @ts-expect-error See the partial tracing-channel subscriber above.
|
|
2070
2066
|
localRunnerShutdownCh.subscribe({
|
|
2071
2067
|
asyncEnd (context) {
|
|
2072
|
-
const
|
|
2073
|
-
if (!
|
|
2068
|
+
const runnerConfiguration = getRunnerConfiguration(context.self)
|
|
2069
|
+
if (!testFinishCh.hasSubscribers || !SUPPORTED_FRAMEWORK_ADAPTERS.has(runnerConfiguration?.framework)) {
|
|
2074
2070
|
return
|
|
2075
2071
|
}
|
|
2072
|
+
const state = getCoordinatorState(context.self)
|
|
2076
2073
|
|
|
2077
2074
|
// Orchestrion uses the callback for the matching settlement path to delay LocalRunner.shutdown.
|
|
2078
2075
|
const waitForCoordinator = onDone => {
|
|
@@ -94,9 +94,22 @@ function wrapSend (send) {
|
|
|
94
94
|
return send.apply(this, arguments)
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
const socket = this._sender?._socket
|
|
98
|
+
// No socket is attached before the handshake completes or after it is torn down.
|
|
99
|
+
if (!socket) {
|
|
100
|
+
return send.apply(this, arguments)
|
|
101
|
+
}
|
|
102
|
+
|
|
97
103
|
const [data, options, cb] = arguments
|
|
98
104
|
|
|
99
|
-
|
|
105
|
+
// `ws` stringifies numbers, then spreads `options` over its own inferred default, so an
|
|
106
|
+
// explicitly passed `binary` wins even when it is nullish and the frame goes out as text.
|
|
107
|
+
const payload = typeof data === 'number' ? data.toString() : data
|
|
108
|
+
const binary = options != null && Object.hasOwn(options, 'binary')
|
|
109
|
+
? Boolean(options.binary)
|
|
110
|
+
: typeof payload !== 'string'
|
|
111
|
+
const byteLength = sentDataLength(payload)
|
|
112
|
+
const ctx = { data, binary, socket, byteLength }
|
|
100
113
|
|
|
101
114
|
return typeof cb === 'function'
|
|
102
115
|
? producerCh.traceCallback(send, undefined, ctx, this, data, options, cb)
|
|
@@ -241,9 +254,35 @@ addHook({
|
|
|
241
254
|
return Receiver
|
|
242
255
|
})
|
|
243
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Byte length of an outgoing payload, following the coercion `ws` applies in `Sender.send`:
|
|
259
|
+
* strings and blobs are measured directly and everything else goes through `toBuffer()`, which
|
|
260
|
+
* yields one byte per element for plain arrays rather than concatenating them. Blob-likes carry
|
|
261
|
+
* neither a `byteLength` nor an array shape, so they are matched last to keep the common
|
|
262
|
+
* buffer path first.
|
|
263
|
+
*
|
|
264
|
+
* @param {WebSocketMessageData | number | undefined} data
|
|
265
|
+
*/
|
|
266
|
+
function sentDataLength (data) {
|
|
267
|
+
if (typeof data === 'string') {
|
|
268
|
+
return Buffer.byteLength(data)
|
|
269
|
+
}
|
|
270
|
+
// An array is one byte per element even when it carries an unrelated `byteLength`.
|
|
271
|
+
if (Array.isArray(data)) {
|
|
272
|
+
return data.length
|
|
273
|
+
}
|
|
274
|
+
// Covers views as well as `ArrayBuffer` and `SharedArrayBuffer`.
|
|
275
|
+
if (typeof (/** @type {{ byteLength?: unknown }} */ (data)?.byteLength) === 'number') {
|
|
276
|
+
return /** @type {{ byteLength: number }} */ (data).byteLength
|
|
277
|
+
}
|
|
278
|
+
// Blobs and files, detected the way `ws` does: structurally, so shimmed and cross-realm
|
|
279
|
+
// implementations it accepts are measured instead of silently reported as empty.
|
|
280
|
+
const { size } = /** @type {{ size?: unknown }} */ (data) ?? {}
|
|
281
|
+
return typeof size === 'number' ? size : 0
|
|
282
|
+
}
|
|
283
|
+
|
|
244
284
|
/**
|
|
245
285
|
* @param {WebSocketMessageData} data
|
|
246
|
-
* @returns {number}
|
|
247
286
|
*/
|
|
248
287
|
function dataLength (data) {
|
|
249
288
|
if (typeof data === 'string') {
|
|
@@ -7,7 +7,6 @@ const { parseModelId: parseBedrockModelId } = require('../../datadog-plugin-aws-
|
|
|
7
7
|
* This is normalized to LLM Observability model provider standards.
|
|
8
8
|
*
|
|
9
9
|
* @param {Record<string, string>} tags
|
|
10
|
-
* @returns {string}
|
|
11
10
|
*/
|
|
12
11
|
function getModelProvider (tags) {
|
|
13
12
|
const modelProviderTag = tags['ai.model.provider']
|
|
@@ -21,7 +20,6 @@ function getModelProvider (tags) {
|
|
|
21
20
|
*
|
|
22
21
|
* @param {string} rawProvider
|
|
23
22
|
* @param {string} modelId
|
|
24
|
-
* @returns {string}
|
|
25
23
|
*/
|
|
26
24
|
function parseModelProvider (rawProvider, modelId) {
|
|
27
25
|
const providerParts = rawProvider?.split('.')
|
|
@@ -66,7 +66,6 @@ function overrideParentId (headers, parentId) {
|
|
|
66
66
|
* Whether the current trace context warrants a new checkpoint over the previously-saved one.
|
|
67
67
|
* @param {Record<string, string>} currentHeaders
|
|
68
68
|
* @param {Record<string, string>} previousHeaders
|
|
69
|
-
* @returns {boolean}
|
|
70
69
|
*/
|
|
71
70
|
function needsCheckpointUpdate (currentHeaders, previousHeaders) {
|
|
72
71
|
for (const key of Object.keys(currentHeaders)) {
|