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
|
@@ -149,7 +149,6 @@ function createPoolAcquisition (pool, options, queryCtx, mode) {
|
|
|
149
149
|
* Queues a delayed acquisition for pool events that no longer carry its async-local context.
|
|
150
150
|
*
|
|
151
151
|
* @param {PoolAcquisition} acquisition
|
|
152
|
-
* @returns {void}
|
|
153
152
|
*/
|
|
154
153
|
function queuePoolAcquisition (acquisition) {
|
|
155
154
|
let pending = pendingPoolAcquisitions.get(acquisition.pool)
|
|
@@ -164,7 +163,6 @@ function queuePoolAcquisition (acquisition) {
|
|
|
164
163
|
* Reports whether an acquisition still needs a matching pool event.
|
|
165
164
|
*
|
|
166
165
|
* @param {PoolAcquisition} acquisition
|
|
167
|
-
* @returns {boolean}
|
|
168
166
|
*/
|
|
169
167
|
function isPoolAcquisitionPending (acquisition) {
|
|
170
168
|
return !acquisition.acquired && !acquisition.finished && !acquisition.errorReported
|
|
@@ -174,7 +172,6 @@ function isPoolAcquisitionPending (acquisition) {
|
|
|
174
172
|
* Releases a consumed acquisition and periodically compacts its queue.
|
|
175
173
|
*
|
|
176
174
|
* @param {PendingPoolAcquisitions} pending
|
|
177
|
-
* @returns {void}
|
|
178
175
|
*/
|
|
179
176
|
function discardPoolAcquisition (pending) {
|
|
180
177
|
pending.acquisitions[pending.index++] = undefined
|
|
@@ -195,7 +192,6 @@ function discardPoolAcquisition (pending) {
|
|
|
195
192
|
* Removes completed entries from the front of a pool's acquisition queue.
|
|
196
193
|
*
|
|
197
194
|
* @param {object} pool
|
|
198
|
-
* @returns {void}
|
|
199
195
|
*/
|
|
200
196
|
function prunePoolAcquisitions (pool) {
|
|
201
197
|
const pending = pendingPoolAcquisitions.get(pool)
|
|
@@ -235,7 +231,6 @@ function takePoolAcquisition (pool) {
|
|
|
235
231
|
* Records the pool wait when MariaDB announces that the calling operation acquired a connection.
|
|
236
232
|
*
|
|
237
233
|
* @param {object} pool
|
|
238
|
-
* @returns {void}
|
|
239
234
|
*/
|
|
240
235
|
function recordPoolAcquisition (pool) {
|
|
241
236
|
let acquisition = poolAcquisitionStorage?.getStore()
|
|
@@ -263,7 +258,6 @@ function recordPoolAcquisition (pool) {
|
|
|
263
258
|
* Starts a pooled command after MariaDB has acquired the connection that will execute it.
|
|
264
259
|
*
|
|
265
260
|
* @param {PoolAcquisition} acquisition
|
|
266
|
-
* @returns {void}
|
|
267
261
|
*/
|
|
268
262
|
function startPoolCommand (acquisition) {
|
|
269
263
|
const queryCtx = acquisition.queryCtx
|
|
@@ -277,7 +271,6 @@ function startPoolCommand (acquisition) {
|
|
|
277
271
|
* Starts a command lifecycle without running connector work inside its span store.
|
|
278
272
|
*
|
|
279
273
|
* @param {object} ctx
|
|
280
|
-
* @returns {void}
|
|
281
274
|
*/
|
|
282
275
|
function runCommandStart (ctx) {
|
|
283
276
|
startCh.runStores(ctx, noop)
|
|
@@ -288,7 +281,6 @@ function runCommandStart (ctx) {
|
|
|
288
281
|
*
|
|
289
282
|
* @param {PoolAcquisition | undefined} acquisition
|
|
290
283
|
* @param {unknown} error
|
|
291
|
-
* @returns {void}
|
|
292
284
|
*/
|
|
293
285
|
function reportPoolQueryAcquireError (acquisition, error) {
|
|
294
286
|
if (acquisition === undefined || acquisition.acquired || acquisition.errorReported) return
|
|
@@ -346,7 +338,6 @@ function runPoolAcquisition (acquisition, method, receiver, args) {
|
|
|
346
338
|
*
|
|
347
339
|
* @param {PoolAcquisition | undefined} acquisition
|
|
348
340
|
* @param {unknown} [error]
|
|
349
|
-
* @returns {void}
|
|
350
341
|
*/
|
|
351
342
|
function finishPoolCommandAcquisition (acquisition, error) {
|
|
352
343
|
if (acquisition === undefined) return
|
|
@@ -375,7 +366,6 @@ function runSkippedPoolMethod (method, receiver, args) {
|
|
|
375
366
|
*
|
|
376
367
|
* @param {PoolAcquisition} acquisition
|
|
377
368
|
* @param {unknown} [error]
|
|
378
|
-
* @returns {void}
|
|
379
369
|
*/
|
|
380
370
|
function finishExplicitPoolAcquisition (acquisition, error) {
|
|
381
371
|
if (acquisition.finished) return
|
|
@@ -395,7 +385,6 @@ function finishExplicitPoolAcquisition (acquisition, error) {
|
|
|
395
385
|
*
|
|
396
386
|
* @param {object} pool
|
|
397
387
|
* @param {Function} observer
|
|
398
|
-
* @returns {void}
|
|
399
388
|
*/
|
|
400
389
|
function restorePoolAcquisitionObserver (pool, observer) {
|
|
401
390
|
const listeners = pool.listeners('acquire')
|
|
@@ -409,7 +398,6 @@ function restorePoolAcquisitionObserver (pool, observer) {
|
|
|
409
398
|
* Observes public acquire events forwarded by a bundled pool.
|
|
410
399
|
*
|
|
411
400
|
* @param {object} pool
|
|
412
|
-
* @returns {void}
|
|
413
401
|
*/
|
|
414
402
|
function observePoolAcquisitions (pool) {
|
|
415
403
|
const observer = () => {
|
|
@@ -428,7 +416,6 @@ function observePoolAcquisitions (pool) {
|
|
|
428
416
|
* Marks a command as active on its owning public connection.
|
|
429
417
|
*
|
|
430
418
|
* @param {object | undefined} owner
|
|
431
|
-
* @returns {void}
|
|
432
419
|
*/
|
|
433
420
|
function startCommand (owner) {
|
|
434
421
|
if (owner === undefined) return
|
|
@@ -439,7 +426,6 @@ function startCommand (owner) {
|
|
|
439
426
|
* Releases one active command without clearing concurrent commands.
|
|
440
427
|
*
|
|
441
428
|
* @param {object | undefined} owner
|
|
442
|
-
* @returns {void}
|
|
443
429
|
*/
|
|
444
430
|
function endCommand (owner) {
|
|
445
431
|
if (owner === undefined) return
|
|
@@ -458,7 +444,6 @@ function endCommand (owner) {
|
|
|
458
444
|
* @param {object | undefined} owner
|
|
459
445
|
* @param {Error} [error]
|
|
460
446
|
* @param {unknown} [result]
|
|
461
|
-
* @returns {void}
|
|
462
447
|
*/
|
|
463
448
|
function finishCommandState (ctx, owner, error, result) {
|
|
464
449
|
endCommand(owner)
|
|
@@ -476,7 +461,6 @@ function finishCommandState (ctx, owner, error, result) {
|
|
|
476
461
|
* @param {object | undefined} owner
|
|
477
462
|
* @param {Error} [error]
|
|
478
463
|
* @param {unknown} [result]
|
|
479
|
-
* @returns {void}
|
|
480
464
|
*/
|
|
481
465
|
function finishCommand (ctx, owner, error, result) {
|
|
482
466
|
finishCommandState(ctx, owner, error, result)
|
|
@@ -490,7 +474,6 @@ function finishCommand (ctx, owner, error, result) {
|
|
|
490
474
|
* @param {number} callbackIndex
|
|
491
475
|
* @param {unknown} callback
|
|
492
476
|
* @param {(callback?: Function) => Function} createCallback
|
|
493
|
-
* @returns {void}
|
|
494
477
|
*/
|
|
495
478
|
function setCommandCallback (args, callbackIndex, callback, createCallback) {
|
|
496
479
|
if (typeof callback === 'function') {
|
|
@@ -750,7 +733,6 @@ function createWrapStream (options, preparedSql, commandOwner) {
|
|
|
750
733
|
*
|
|
751
734
|
* @param {object} client
|
|
752
735
|
* @param {(command: Function) => Function} wrapper
|
|
753
|
-
* @returns {void}
|
|
754
736
|
*/
|
|
755
737
|
function wrapClientCommands (client, wrapper) {
|
|
756
738
|
if (wrappedClients.has(client)) return
|
|
@@ -769,7 +751,6 @@ function wrapClientCommands (client, wrapper) {
|
|
|
769
751
|
* @param {(options: object, sql?: unknown, owner?: object, commandArity?: number,
|
|
770
752
|
* trackActiveCommands?: boolean, poolAcquisition?: 'measure' | 'observe') =>
|
|
771
753
|
* (command: Function) => Function} createWrapper
|
|
772
|
-
* @returns {void}
|
|
773
754
|
*/
|
|
774
755
|
function wrapPoolCommands (pool, options, createWrapper) {
|
|
775
756
|
if (wrappedClients.has(pool)) return
|
|
@@ -789,7 +770,6 @@ function wrapPoolCommands (pool, options, createWrapper) {
|
|
|
789
770
|
* @param {object} options
|
|
790
771
|
* @param {(options: object, sql: string, owner?: object, commandArity?: number) =>
|
|
791
772
|
* (command: Function) => Function} createWrapper
|
|
792
|
-
* @returns {void}
|
|
793
773
|
*/
|
|
794
774
|
function wrapTransactionMethods (client, options, createWrapper) {
|
|
795
775
|
for (const [method, sql] of transactionMethods) {
|
|
@@ -1115,7 +1095,6 @@ function createWrapCallbackGetConnection (options) {
|
|
|
1115
1095
|
* @param {object} pool
|
|
1116
1096
|
* @param {object} options
|
|
1117
1097
|
* @param {(connection: object, options: object) => object} wrapConnection
|
|
1118
|
-
* @returns {void}
|
|
1119
1098
|
*/
|
|
1120
1099
|
function wrapPoolConnectionEvent (pool, options, wrapConnection) {
|
|
1121
1100
|
shimmer.wrap(pool, 'emit', emit => function (event, connection) {
|
|
@@ -1131,7 +1110,6 @@ function wrapPoolConnectionEvent (pool, options, wrapConnection) {
|
|
|
1131
1110
|
* @param {object} cluster
|
|
1132
1111
|
* @param {Function} defaultOptions
|
|
1133
1112
|
* @param {ClusterSelectionStorage} selectionStorage
|
|
1134
|
-
* @returns {void}
|
|
1135
1113
|
*/
|
|
1136
1114
|
function captureClusterOptions (cluster, defaultOptions, selectionStorage) {
|
|
1137
1115
|
/** @type {Map<string, ClusterNodeOptions>} */
|
|
@@ -1198,7 +1176,6 @@ function captureClusterOptions (cluster, defaultOptions, selectionStorage) {
|
|
|
1198
1176
|
*
|
|
1199
1177
|
* @param {Map<string, ClusterNodeOptions>} optionsByIdentifier
|
|
1200
1178
|
* @param {string} pattern
|
|
1201
|
-
* @returns {void}
|
|
1202
1179
|
*/
|
|
1203
1180
|
function removeClusterOptions (optionsByIdentifier, pattern) {
|
|
1204
1181
|
const regularExpression = new RegExp(pattern)
|
|
@@ -1227,7 +1204,6 @@ function runClusterGetConnection (getConnection, receiver, args) {
|
|
|
1227
1204
|
* @param {ClusterSelection} selection
|
|
1228
1205
|
* @param {number | undefined} start
|
|
1229
1206
|
* @param {unknown} error
|
|
1230
|
-
* @returns {void}
|
|
1231
1207
|
*/
|
|
1232
1208
|
function reportBundledClusterAcquireError (selection, start, error) {
|
|
1233
1209
|
if (!acquireStartCh.hasSubscribers) return
|
|
@@ -208,7 +208,6 @@ function wrapPoolQuery (method) {
|
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
210
|
* @param {Function} Pool
|
|
211
|
-
* @returns {boolean}
|
|
212
211
|
*/
|
|
213
212
|
function claimPoolWrap (Pool) {
|
|
214
213
|
if (wrappedPools.has(Pool)) return false
|
|
@@ -267,7 +266,6 @@ function startPoolAcquireTiming (timing) {
|
|
|
267
266
|
|
|
268
267
|
/**
|
|
269
268
|
* @param {PoolAcquireTiming} timing
|
|
270
|
-
* @returns {number}
|
|
271
269
|
*/
|
|
272
270
|
function finishPoolAcquireTiming (timing) {
|
|
273
271
|
const poolWaitTime = (timing.poolWaitTime ?? 0) + acquireWait(timing.poolAcquireStart)
|
|
@@ -16,7 +16,6 @@ const patched = new WeakSet()
|
|
|
16
16
|
*
|
|
17
17
|
* @param {string[]} versions
|
|
18
18
|
* @param {(Mocha: Function, frameworkVersion: string) => Function} wrapMochaRun
|
|
19
|
-
* @returns {void}
|
|
20
19
|
*/
|
|
21
20
|
function addMochaRunHooks (versions, wrapMochaRun) {
|
|
22
21
|
const patchedMochaConstructors = new WeakSet()
|
|
@@ -224,7 +224,6 @@ function getCoverageRootDir () {
|
|
|
224
224
|
* from the suite path.
|
|
225
225
|
*
|
|
226
226
|
* @param {string} testSuiteAbsolutePath
|
|
227
|
-
* @returns {boolean}
|
|
228
227
|
*/
|
|
229
228
|
function isModifiedTestSuite (testSuiteAbsolutePath) {
|
|
230
229
|
const testPath = getTestSuitePath(testSuiteAbsolutePath, getCoverageRootDir())
|
|
@@ -317,8 +316,8 @@ function getOnEndHandler (isParallel, onDone) {
|
|
|
317
316
|
let status = 'pass'
|
|
318
317
|
let error = frameworkError
|
|
319
318
|
if (this.stats) {
|
|
320
|
-
status = this.stats.failures === 0 ? 'pass' : 'fail'
|
|
321
|
-
if (this.stats.tests ===
|
|
319
|
+
status = this.stats.failures === 0 && this.failures === 0 ? 'pass' : 'fail'
|
|
320
|
+
if (this.stats.tests === this.stats.pending && status === 'pass') {
|
|
322
321
|
status = 'skip'
|
|
323
322
|
}
|
|
324
323
|
} else if (this.failures !== 0) {
|
|
@@ -330,6 +329,9 @@ function getOnEndHandler (isParallel, onDone) {
|
|
|
330
329
|
} else if (status === 'fail') {
|
|
331
330
|
error = new Error(`Failed tests: ${this.failures}.`)
|
|
332
331
|
}
|
|
332
|
+
const testSessionEmptyReason = status === 'skip'
|
|
333
|
+
? (this.stats.pending > 0 || skippedSuites.length > 0 ? 'all_tests_skipped' : 'zero_tests')
|
|
334
|
+
: undefined
|
|
333
335
|
|
|
334
336
|
testFileToSuiteCtx.clear()
|
|
335
337
|
|
|
@@ -373,6 +375,7 @@ function getOnEndHandler (isParallel, onDone) {
|
|
|
373
375
|
isTestManagementEnabled: config.isTestManagementTestsEnabled,
|
|
374
376
|
isParallel,
|
|
375
377
|
isFrameworkError: arguments.length > 0,
|
|
378
|
+
testSessionEmptyReason,
|
|
376
379
|
}, () => {
|
|
377
380
|
try {
|
|
378
381
|
onDone()
|
|
@@ -394,7 +397,6 @@ function getOnEndHandler (isParallel, onDone) {
|
|
|
394
397
|
* Applies Test Optimization failure suppression once per runner execution.
|
|
395
398
|
*
|
|
396
399
|
* @param {object} runner
|
|
397
|
-
* @returns {void}
|
|
398
400
|
*/
|
|
399
401
|
function adjustRunnerFailuresOnce (runner) {
|
|
400
402
|
if (runnerFailuresAdjusted.has(runner)) return
|
|
@@ -427,7 +429,6 @@ function getRunnerRecoveryState (runner) {
|
|
|
427
429
|
*
|
|
428
430
|
* @param {object} runner
|
|
429
431
|
* @param {object} test
|
|
430
|
-
* @returns {void}
|
|
431
432
|
*/
|
|
432
433
|
function markTestPending (runner, test) {
|
|
433
434
|
const state = getRunnerRecoveryState(runner)
|
|
@@ -447,7 +448,6 @@ function markTestPending (runner, test) {
|
|
|
447
448
|
*
|
|
448
449
|
* @param {object} runner
|
|
449
450
|
* @param {object} test
|
|
450
|
-
* @returns {void}
|
|
451
451
|
*/
|
|
452
452
|
function markTestTerminal (runner, test) {
|
|
453
453
|
getRunnerRecoveryState(runner).tests.add(test)
|
|
@@ -458,7 +458,6 @@ function markTestTerminal (runner, test) {
|
|
|
458
458
|
* Restores test and hook state changed only to abort the current run.
|
|
459
459
|
*
|
|
460
460
|
* @param {object} runner
|
|
461
|
-
* @returns {void}
|
|
462
461
|
*/
|
|
463
462
|
function restoreReporterMutations (runner) {
|
|
464
463
|
const state = runnerRecoveryStates.get(runner)
|
|
@@ -490,7 +489,6 @@ function restoreReporterMutations (runner) {
|
|
|
490
489
|
*
|
|
491
490
|
* @param {object} runner
|
|
492
491
|
* @param {object} test
|
|
493
|
-
* @returns {void}
|
|
494
492
|
*/
|
|
495
493
|
function stopCurrentTest (runner, test) {
|
|
496
494
|
const hookDown = runner.hookDown
|
|
@@ -512,7 +510,6 @@ function stopCurrentTest (runner, test) {
|
|
|
512
510
|
*
|
|
513
511
|
* @param {object} runner
|
|
514
512
|
* @param {object} hook
|
|
515
|
-
* @returns {void}
|
|
516
513
|
*/
|
|
517
514
|
function stopCurrentHook (runner, hook) {
|
|
518
515
|
const hookMethod = runner.hook
|
|
@@ -556,7 +553,6 @@ function stopCurrentHook (runner, hook) {
|
|
|
556
553
|
*
|
|
557
554
|
* @param {object} runner
|
|
558
555
|
* @param {object} test
|
|
559
|
-
* @returns {void}
|
|
560
556
|
*/
|
|
561
557
|
function stopAfterEachHooks (runner, test) {
|
|
562
558
|
const hookUp = runner.hookUp
|
|
@@ -572,7 +568,6 @@ function stopAfterEachHooks (runner, test) {
|
|
|
572
568
|
* Prevents Mocha from entering any subsequent user hooks after a reporter error.
|
|
573
569
|
*
|
|
574
570
|
* @param {object} runner
|
|
575
|
-
* @returns {void}
|
|
576
571
|
*/
|
|
577
572
|
function stopFutureHooks (runner) {
|
|
578
573
|
if (runnerHookMethods.has(runner)) return
|
|
@@ -587,7 +582,6 @@ function stopFutureHooks (runner) {
|
|
|
587
582
|
* Restores the runner hook method after reporter-error finalization.
|
|
588
583
|
*
|
|
589
584
|
* @param {object} runner
|
|
590
|
-
* @returns {void}
|
|
591
585
|
*/
|
|
592
586
|
function restoreFutureHooks (runner) {
|
|
593
587
|
const hook = runnerHookMethods.get(runner)
|
|
@@ -602,7 +596,6 @@ function restoreFutureHooks (runner) {
|
|
|
602
596
|
*
|
|
603
597
|
* @param {object} runner
|
|
604
598
|
* @param {object} hook
|
|
605
|
-
* @returns {boolean} whether the completed hook was a before-each hook
|
|
606
599
|
*/
|
|
607
600
|
function stopRemainingCurrentHooks (runner, hook) {
|
|
608
601
|
const hookLists = [hook.parent?._beforeAll, hook.parent?._beforeEach, hook.parent?._afterEach, hook.parent?._afterAll]
|
|
@@ -631,7 +624,6 @@ function stopRemainingCurrentHooks (runner, hook) {
|
|
|
631
624
|
*
|
|
632
625
|
* @param {object} runner
|
|
633
626
|
* @param {object} hook
|
|
634
|
-
* @returns {void}
|
|
635
627
|
*/
|
|
636
628
|
function stopAfterHookEnd (runner, hook) {
|
|
637
629
|
if (!stopRemainingCurrentHooks(runner, hook) || !runner.test) return
|
|
@@ -643,7 +635,6 @@ function stopAfterHookEnd (runner, hook) {
|
|
|
643
635
|
* Prevents Mocha from entering the root suite after a run-start reporter error.
|
|
644
636
|
*
|
|
645
637
|
* @param {object} runner
|
|
646
|
-
* @returns {void}
|
|
647
638
|
*/
|
|
648
639
|
function stopRootSuite (runner) {
|
|
649
640
|
const runSuite = runner.runSuite
|
|
@@ -664,7 +655,6 @@ function createSkippedParallelFileRunner () {
|
|
|
664
655
|
* Prevents a parallel run-start reporter error from scheduling test workers.
|
|
665
656
|
*
|
|
666
657
|
* @param {object} runner
|
|
667
|
-
* @returns {void}
|
|
668
658
|
*/
|
|
669
659
|
function stopParallelWorkers (runner) {
|
|
670
660
|
const state = getRunnerRecoveryState(runner)
|
|
@@ -680,7 +670,6 @@ function stopParallelWorkers (runner) {
|
|
|
680
670
|
* Resets suite coverage after every reporter has observed the completed suite.
|
|
681
671
|
*
|
|
682
672
|
* @param {object} runner
|
|
683
|
-
* @returns {void}
|
|
684
673
|
*/
|
|
685
674
|
function resetPendingSuiteCoverage (runner) {
|
|
686
675
|
if (!runnersWithPendingCoverageReset.delete(runner) || !global.__coverage__) return
|
|
@@ -734,7 +723,6 @@ function getFrameworkFinalizationError (frameworkError) {
|
|
|
734
723
|
* runs Datadog's end handler and propagates the original error after finalization.
|
|
735
724
|
*
|
|
736
725
|
* @param {Function} Runner
|
|
737
|
-
* @returns {void}
|
|
738
726
|
*/
|
|
739
727
|
function wrapRunnerEmit (Runner) {
|
|
740
728
|
if (wrappedRunnerEmitPrototypes.has(Runner.prototype)) return
|
|
@@ -875,7 +863,6 @@ function isFailedTestReplayEnabled () {
|
|
|
875
863
|
* Mirrors Mocha 5's private exclusivity check.
|
|
876
864
|
*
|
|
877
865
|
* @param {MochaSuite} suite
|
|
878
|
-
* @returns {boolean}
|
|
879
866
|
*/
|
|
880
867
|
function hasOnly (suite) {
|
|
881
868
|
if (suite._onlyTests.length || suite._onlySuites.length) return true
|
|
@@ -890,7 +877,6 @@ function hasOnly (suite) {
|
|
|
890
877
|
* Mirrors Mocha 5's private exclusivity filter.
|
|
891
878
|
*
|
|
892
879
|
* @param {MochaSuite} suite
|
|
893
|
-
* @returns {boolean}
|
|
894
880
|
*/
|
|
895
881
|
function filterOnly (suite) {
|
|
896
882
|
if (suite._onlyTests.length) {
|
|
@@ -1038,6 +1024,8 @@ function getExecutionConfiguration (runner, isParallel, frameworkVersion, onFini
|
|
|
1038
1024
|
config.isSuitesSkippingEnabled = config.isItrEnabled && libraryConfig.isSuitesSkippingEnabled
|
|
1039
1025
|
config.isFlakyTestRetriesEnabled = libraryConfig.isFlakyTestRetriesEnabled
|
|
1040
1026
|
config.flakyTestRetriesCount = libraryConfig.flakyTestRetriesCount
|
|
1027
|
+
config.isDynamicAtrEnabled = libraryConfig.isDynamicAtrEnabled && satisfies(frameworkVersion, '>=8.0.0')
|
|
1028
|
+
config.dynamicAtrBuckets = libraryConfig.dynamicAtrBuckets
|
|
1041
1029
|
config.isDiEnabled = libraryConfig.isDiEnabled
|
|
1042
1030
|
config.isTestDynamicInstrumentationEnabled = isTestDynamicInstrumentationEnabled
|
|
1043
1031
|
|
|
@@ -1072,7 +1060,6 @@ function getExecutionConfiguration (runner, isParallel, frameworkVersion, onFini
|
|
|
1072
1060
|
|
|
1073
1061
|
/**
|
|
1074
1062
|
* @param {import('mocha').Runner} runner
|
|
1075
|
-
* @returns {void}
|
|
1076
1063
|
*/
|
|
1077
1064
|
function startMochaRunner (runner) {
|
|
1078
1065
|
if (readyRunners.has(runner)) {
|
|
@@ -1122,9 +1109,16 @@ function wrapMochaRun (Mocha, frameworkVersion) {
|
|
|
1122
1109
|
|
|
1123
1110
|
// `options.delay` does not work in parallel mode, so we can't delay the execution this way
|
|
1124
1111
|
// This needs to be both here and in `runMocha` hook. Read the comment in `runMocha` hook for more info.
|
|
1112
|
+
const originalDelay = this.options.delay
|
|
1125
1113
|
this.options.delay = true
|
|
1126
1114
|
|
|
1127
|
-
|
|
1115
|
+
let runner
|
|
1116
|
+
try {
|
|
1117
|
+
runner = run.apply(this, args)
|
|
1118
|
+
} finally {
|
|
1119
|
+
// Only this runner needs the configuration delay, including when the next run disables the plugin.
|
|
1120
|
+
this.options.delay = originalDelay
|
|
1121
|
+
}
|
|
1128
1122
|
|
|
1129
1123
|
this.files.forEach((path) => {
|
|
1130
1124
|
const isUnskippable = isMarkedAsUnskippable({ path })
|
|
@@ -1134,7 +1128,7 @@ function wrapMochaRun (Mocha, frameworkVersion) {
|
|
|
1134
1128
|
})
|
|
1135
1129
|
|
|
1136
1130
|
getExecutionConfiguration(runner, false, frameworkVersion, () => {
|
|
1137
|
-
if (isFailedTestReplayEnabled()) {
|
|
1131
|
+
if (isFailedTestReplayEnabled() || config.isFlakyTestRetriesEnabled) {
|
|
1138
1132
|
patchFailedTestReplayHookUp(runner.constructor)
|
|
1139
1133
|
}
|
|
1140
1134
|
if (config.isKnownTestsEnabled) {
|
|
@@ -1204,8 +1198,10 @@ addHook({
|
|
|
1204
1198
|
name: 'mocha',
|
|
1205
1199
|
versions: [MINIMUM_MOCHA_VERSION],
|
|
1206
1200
|
filePattern: String.raw`lib/runner\.(?:c?js)$`,
|
|
1207
|
-
}, function (
|
|
1208
|
-
|
|
1201
|
+
}, function (runnerPackage, frameworkVersion) {
|
|
1202
|
+
const Runner = runnerPackage.Runner ?? runnerPackage.default ?? runnerPackage
|
|
1203
|
+
if (typeof Runner !== 'function') return
|
|
1204
|
+
if (patched.has(Runner)) return
|
|
1209
1205
|
|
|
1210
1206
|
patched.add(Runner)
|
|
1211
1207
|
wrapRunnerEmit(Runner)
|
|
@@ -1214,6 +1210,7 @@ addHook({
|
|
|
1214
1210
|
|
|
1215
1211
|
shimmer.wrap(Runner.prototype, 'run', run => function (...args) {
|
|
1216
1212
|
if (!testFinishCh.hasSubscribers) {
|
|
1213
|
+
resetRunState(this.suite)
|
|
1217
1214
|
return runMochaRunner(run, this, args)
|
|
1218
1215
|
}
|
|
1219
1216
|
|
|
@@ -1550,7 +1547,7 @@ addHook({
|
|
|
1550
1547
|
return runMochaRunner(run, this, args)
|
|
1551
1548
|
})
|
|
1552
1549
|
|
|
1553
|
-
return
|
|
1550
|
+
return runnerPackage
|
|
1554
1551
|
})
|
|
1555
1552
|
|
|
1556
1553
|
// Used both in serial and parallel mode, and by both the main process and the workers
|
|
@@ -1796,6 +1793,8 @@ addHook({
|
|
|
1796
1793
|
if (config.isFlakyTestRetriesEnabled) {
|
|
1797
1794
|
newWorkerArgs._ddIsFlakyTestRetriesEnabled = true
|
|
1798
1795
|
newWorkerArgs._ddFlakyTestRetriesCount = config.flakyTestRetriesCount
|
|
1796
|
+
newWorkerArgs._ddIsDynamicAtrEnabled = config.isDynamicAtrEnabled
|
|
1797
|
+
newWorkerArgs._ddDynamicAtrBuckets = config.dynamicAtrBuckets
|
|
1799
1798
|
}
|
|
1800
1799
|
|
|
1801
1800
|
if (isFailedTestReplayEnabled()) {
|