dd-trace 6.16.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +165 -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 +72 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +0 -23
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +0 -3
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +4 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +72 -24
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +39 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -17
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +36 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/supabase.js +128 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +16 -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 +141 -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 +22 -25
- package/packages/datadog-instrumentations/src/mocha/utils.js +119 -49
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +0 -6
- package/packages/datadog-instrumentations/src/mocha/worker.js +14 -17
- package/packages/datadog-instrumentations/src/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 +3 -16
- package/packages/datadog-instrumentations/src/playwright.js +238 -55
- package/packages/datadog-instrumentations/src/postgres.js +7 -0
- package/packages/datadog-instrumentations/src/router.js +0 -2
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +0 -2
- package/packages/datadog-instrumentations/src/sequelize.js +0 -1
- package/packages/datadog-instrumentations/src/supabase.js +15 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +37 -17
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +49 -13
- package/packages/datadog-instrumentations/src/webdriverio.js +23 -42
- package/packages/datadog-instrumentations/src/ws.js +0 -1
- package/packages/datadog-plugin-ai/src/utils.js +0 -2
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +0 -1
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +0 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +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 +10 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +171 -75
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +0 -4
- package/packages/datadog-plugin-cypress/src/support.js +52 -7
- package/packages/datadog-plugin-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 +13 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +39 -11
- package/packages/datadog-plugin-mongodb-core/src/query.js +0 -1
- package/packages/datadog-plugin-openai/src/index.js +16 -1
- package/packages/datadog-plugin-openai/src/realtime.js +144 -0
- package/packages/datadog-plugin-openai-agents/src/integration.js +0 -4
- package/packages/datadog-plugin-openai-agents/src/util.js +0 -1
- package/packages/datadog-plugin-playwright/src/index.js +76 -9
- package/packages/datadog-plugin-postgres/src/index.js +167 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +0 -1
- package/packages/datadog-plugin-redis/src/index.js +15 -1
- package/packages/datadog-plugin-supabase/src/error.js +18 -0
- package/packages/datadog-plugin-supabase/src/index.js +21 -0
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +69 -0
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +70 -0
- package/packages/datadog-plugin-supabase/src/supabase-postgrest-js-postgrestbuilder-then.js +122 -0
- package/packages/datadog-plugin-supabase/src/supabase-realtime-js-realtimechannel-send.js +66 -0
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +93 -0
- package/packages/datadog-plugin-supabase/src/url.js +17 -0
- package/packages/datadog-plugin-vitest/src/index.js +10 -0
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-turbopack/index.js +0 -6
- package/packages/datadog-turbopack/src/loader.js +0 -16
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/aiguard/client.js +2 -3
- package/packages/dd-trace/src/aiguard/evaluation.js +6 -12
- package/packages/dd-trace/src/aiguard/index.js +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 +73 -67
- package/packages/dd-trace/src/config/helper.js +0 -1
- package/packages/dd-trace/src/config/index.js +24 -24
- 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 +139 -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 +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/guardrail-metrics.js +15 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +103 -27
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +50 -7
- package/packages/dd-trace/src/debugger/devtools_client/log.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +21 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +40 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +53 -13
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +118 -71
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +20 -6
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +50 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +0 -3
- package/packages/dd-trace/src/debugger/probe_sampler.js +133 -9
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +31 -1
- package/packages/dd-trace/src/dogstatsd.js +0 -23
- package/packages/dd-trace/src/encode/0.4-cross-payload.js +0 -3
- package/packages/dd-trace/src/encode/0.4.js +0 -7
- package/packages/dd-trace/src/encode/0.5.js +0 -2
- package/packages/dd-trace/src/encode/tags-processors.js +0 -1
- package/packages/dd-trace/src/evp_proxy/discovery.js +0 -1
- package/packages/dd-trace/src/evp_proxy/path.js +0 -2
- 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 +0 -2
- package/packages/dd-trace/src/exporters/common/writer.js +0 -2
- package/packages/dd-trace/src/id.js +0 -11
- package/packages/dd-trace/src/llmobs/audio-codec.js +192 -0
- package/packages/dd-trace/src/llmobs/audio-utils.js +121 -0
- package/packages/dd-trace/src/llmobs/constants/audio.js +35 -0
- package/packages/dd-trace/src/llmobs/constants/prompts.js +14 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +17 -0
- package/packages/dd-trace/src/llmobs/eval-metric.js +0 -6
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +0 -4
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +0 -3
- package/packages/dd-trace/src/llmobs/experiments/index.js +7 -6
- package/packages/dd-trace/src/llmobs/experiments/util.js +1 -11
- package/packages/dd-trace/src/llmobs/index.js +1 -3
- package/packages/dd-trace/src/llmobs/noop.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +0 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +285 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +16 -3
- package/packages/dd-trace/src/llmobs/prompts/cache.js +272 -0
- package/packages/dd-trace/src/llmobs/prompts/manager.js +639 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +92 -0
- package/packages/dd-trace/src/llmobs/sdk.js +21 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +81 -2
- package/packages/dd-trace/src/llmobs/tagger.js +30 -7
- package/packages/dd-trace/src/llmobs/telemetry.js +36 -4
- package/packages/dd-trace/src/llmobs/util.js +0 -34
- package/packages/dd-trace/src/llmobs/writers/base.js +0 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/channels.js +3 -0
- package/packages/dd-trace/src/log/index.js +23 -5
- package/packages/dd-trace/src/log-submission/log-submission-plugin.js +74 -6
- package/packages/dd-trace/src/msgpack/chunk.js +0 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +0 -12
- package/packages/dd-trace/src/openfeature/encoding.js +0 -2
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/index.js +0 -4
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/span-enrichment.js +0 -4
- package/packages/dd-trace/src/openfeature/writers/base.js +0 -6
- package/packages/dd-trace/src/openfeature/writers/exposures.js +0 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +0 -4
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +0 -2
- package/packages/dd-trace/src/opentelemetry/metrics/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/otel-thread-ctx.js +38 -11
- package/packages/dd-trace/src/payload-tagging/tagging.js +15 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +0 -1
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +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 +21 -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 +21 -45
- package/packages/dd-trace/src/random_sampler.js +0 -4
- package/packages/dd-trace/src/rate_limiter.js +0 -4
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -9
- package/packages/dd-trace/src/remote_config/index.js +0 -1
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +0 -3
- package/packages/dd-trace/src/sampler.js +0 -4
- package/packages/dd-trace/src/sampling_rule.js +0 -7
- package/packages/dd-trace/src/serverless/vercel.js +0 -1
- package/packages/dd-trace/src/serverless.js +0 -1
- package/packages/dd-trace/src/service-naming/index.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +7 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +5 -0
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/span_sampler.js +0 -1
- package/packages/dd-trace/src/standalone/product.js +2 -2
- package/packages/dd-trace/src/standalone/tracesource.js +0 -1
- package/packages/dd-trace/src/startup-log.js +1 -1
- package/packages/dd-trace/src/telemetry/endpoints.js +0 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +16 -5
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +16 -6
- package/packages/dd-trace/src/telemetry/metrics.js +0 -2
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const shimmer = require('../../datadog-shimmer')
|
|
4
|
+
const { channel } = require('./helpers/instrument')
|
|
5
|
+
|
|
6
|
+
const configureCh = channel('ci:log-submission:console:configure')
|
|
7
|
+
const logSubmissionCh = channel('ci:log-submission:console')
|
|
8
|
+
const vitestSuiteStartCh = channel('ci:vitest:test-suite:start')
|
|
9
|
+
const methods = ['error', 'warn']
|
|
10
|
+
const methodSet = new Set(methods)
|
|
11
|
+
const wrappedTargets = new WeakSet()
|
|
12
|
+
|
|
13
|
+
let callDepth = 0
|
|
14
|
+
let configuredGetLogHolder
|
|
15
|
+
let isVitestConsoleSubscribed = false
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} method
|
|
19
|
+
* @param {unknown[]} args
|
|
20
|
+
* @param {(() => { dd: object } | undefined) | undefined} getLogHolder
|
|
21
|
+
*/
|
|
22
|
+
function publishLog (method, args, getLogHolder) {
|
|
23
|
+
if (!logSubmissionCh.hasSubscribers) return
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const logHolder = (getLogHolder || configuredGetLogHolder)?.()
|
|
27
|
+
if (logHolder) logSubmissionCh.publish({ args, logHolder, method })
|
|
28
|
+
} catch {}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {object} target
|
|
33
|
+
* @param {(() => { dd: object } | undefined) | undefined} [getLogHolder]
|
|
34
|
+
*/
|
|
35
|
+
function wrapConsole (target, getLogHolder) {
|
|
36
|
+
if (!target || wrappedTargets.has(target)) return
|
|
37
|
+
|
|
38
|
+
wrappedTargets.add(target)
|
|
39
|
+
for (const method of methods) {
|
|
40
|
+
if (typeof target[method] !== 'function') continue
|
|
41
|
+
|
|
42
|
+
// Global console methods are bound at runtime, so source rewriting cannot intercept them.
|
|
43
|
+
try {
|
|
44
|
+
shimmer.wrap(target, method, original => function () {
|
|
45
|
+
const shouldPublish = callDepth++ === 0
|
|
46
|
+
try {
|
|
47
|
+
const result = original.apply(this, arguments)
|
|
48
|
+
if (shouldPublish) publishLog(method, [...arguments], getLogHolder)
|
|
49
|
+
return result
|
|
50
|
+
} finally {
|
|
51
|
+
callDepth--
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
} catch {}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {{ BufferedConsole?: Function, CustomConsole?: Function }} jestConsole
|
|
60
|
+
* @param {(() => { dd: object } | undefined) | undefined} [getLogHolder]
|
|
61
|
+
*/
|
|
62
|
+
function wrapJestConsole (jestConsole, getLogHolder) {
|
|
63
|
+
if (!getLogHolder && !configuredGetLogHolder) return
|
|
64
|
+
|
|
65
|
+
const { BufferedConsole, CustomConsole } = jestConsole
|
|
66
|
+
|
|
67
|
+
if (BufferedConsole && !wrappedTargets.has(BufferedConsole)) {
|
|
68
|
+
wrappedTargets.add(BufferedConsole)
|
|
69
|
+
// Jest bundles and exports these adapter classes differently across versions, so wrap their runtime exports.
|
|
70
|
+
shimmer.wrap(BufferedConsole, 'write', original => function (buffer, method, message) {
|
|
71
|
+
const result = original.apply(this, arguments)
|
|
72
|
+
if (methodSet.has(method)) publishLog(method, [message], getLogHolder)
|
|
73
|
+
return result
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (CustomConsole && !wrappedTargets.has(CustomConsole)) {
|
|
78
|
+
wrappedTargets.add(CustomConsole)
|
|
79
|
+
shimmer.wrap(CustomConsole.prototype, '_logError', original => function (method, message) {
|
|
80
|
+
const result = original.apply(this, arguments)
|
|
81
|
+
if (methodSet.has(method)) publishLog(method, [message], getLogHolder)
|
|
82
|
+
return result
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
configureCh.subscribe(({ getLogHolder } = {}) => {
|
|
88
|
+
configuredGetLogHolder = getLogHolder
|
|
89
|
+
wrapConsole(globalThis.console)
|
|
90
|
+
if (!isVitestConsoleSubscribed) {
|
|
91
|
+
isVitestConsoleSubscribed = true
|
|
92
|
+
// Vitest replaces the global console after tracer startup and before the first suite starts.
|
|
93
|
+
vitestSuiteStartCh.subscribe(() => wrapConsole(globalThis.console))
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
module.exports = { wrapConsole, wrapJestConsole }
|
|
@@ -12,6 +12,7 @@ const {
|
|
|
12
12
|
getEfdRetryCountForDuration,
|
|
13
13
|
hasEfdRetries,
|
|
14
14
|
} = require('../../dd-trace/src/ci-visibility/efd-retry-policy')
|
|
15
|
+
const { getDynamicAtrRetryCount } = require('../../dd-trace/src/ci-visibility/dynamic-atr-retries')
|
|
15
16
|
const {
|
|
16
17
|
getCoveredFilesFromCoverage,
|
|
17
18
|
getExecutableFilesFromCoverage,
|
|
@@ -77,7 +78,6 @@ const CUCUMBER_RETRY_NAME_SUFFIX = / ?\(attempt \d+(?:, retried)?\) ?$/
|
|
|
77
78
|
*
|
|
78
79
|
* @param {string} testName
|
|
79
80
|
* @param {boolean} isRetry
|
|
80
|
-
* @returns {string}
|
|
81
81
|
*/
|
|
82
82
|
function getCucumberTestName (testName, isRetry) {
|
|
83
83
|
return isRetry ? testName.replace(CUCUMBER_RETRY_NAME_SUFFIX, '') : testName
|
|
@@ -129,6 +129,8 @@ let earlyFlakeDetectionRetryPolicy = EMPTY_EFD_RETRY_POLICY
|
|
|
129
129
|
let earlyFlakeDetectionFaultyThreshold = 0
|
|
130
130
|
let isEarlyFlakeDetectionFaulty = false
|
|
131
131
|
let isFlakyTestRetriesEnabled = false
|
|
132
|
+
let isDynamicAtrEnabled = false
|
|
133
|
+
let dynamicAtrBuckets
|
|
132
134
|
let isKnownTestsEnabled = false
|
|
133
135
|
let isTestManagementTestsEnabled = false
|
|
134
136
|
let isImpactedTestsEnabled = false
|
|
@@ -140,11 +142,9 @@ let knownTests = {}
|
|
|
140
142
|
let skippedSuites = []
|
|
141
143
|
let isSuitesSkipped = false
|
|
142
144
|
let areAllSuitesSkipped = false
|
|
145
|
+
let hasTestsToRun = false
|
|
143
146
|
let repositoryRoot
|
|
144
147
|
|
|
145
|
-
/**
|
|
146
|
-
* @returns {boolean}
|
|
147
|
-
*/
|
|
148
148
|
function shouldRunEarlyFlakeDetection () {
|
|
149
149
|
return isEarlyFlakeDetectionEnabled && hasEfdRetries(earlyFlakeDetectionRetryPolicy)
|
|
150
150
|
}
|
|
@@ -243,7 +243,9 @@ function configureParallelWorkerWorldParameters (options) {
|
|
|
243
243
|
isKnownTestsEnabled = false
|
|
244
244
|
options.worldParameters._ddIsEarlyFlakeDetectionEnabled = false
|
|
245
245
|
options.worldParameters._ddIsKnownTestsEnabled = false
|
|
246
|
-
options.worldParameters._ddEarlyFlakeDetectionRetryPolicy =
|
|
246
|
+
options.worldParameters._ddEarlyFlakeDetectionRetryPolicy = isDynamicAtrEnabled
|
|
247
|
+
? earlyFlakeDetectionRetryPolicy
|
|
248
|
+
: EMPTY_EFD_RETRY_POLICY
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
if (isImpactedTestsEnabled) {
|
|
@@ -253,6 +255,8 @@ function configureParallelWorkerWorldParameters (options) {
|
|
|
253
255
|
|
|
254
256
|
options.worldParameters._ddIsFlakyTestRetriesEnabled = isFlakyTestRetriesEnabled
|
|
255
257
|
options.worldParameters._ddNumTestRetries = numTestRetries
|
|
258
|
+
options.worldParameters._ddIsDynamicAtrEnabled = isDynamicAtrEnabled
|
|
259
|
+
options.worldParameters._ddDynamicAtrBuckets = dynamicAtrBuckets
|
|
256
260
|
|
|
257
261
|
if (isTestManagementTestsEnabled) {
|
|
258
262
|
options.worldParameters._ddIsTestManagementTestsEnabled = true
|
|
@@ -282,8 +286,7 @@ function readParallelWorkerWorldParameters (options) {
|
|
|
282
286
|
if (isImpactedTestsEnabled) {
|
|
283
287
|
modifiedFiles = worldParameters._ddModifiedFiles
|
|
284
288
|
}
|
|
285
|
-
|
|
286
|
-
numTestRetries = worldParameters._ddNumTestRetries ?? 0
|
|
289
|
+
readParallelWorkerAtrParameters(worldParameters)
|
|
287
290
|
isTestManagementTestsEnabled = !!worldParameters._ddIsTestManagementTestsEnabled
|
|
288
291
|
if (isTestManagementTestsEnabled) {
|
|
289
292
|
testManagementTests = worldParameters._ddTestManagementTests
|
|
@@ -291,6 +294,25 @@ function readParallelWorkerWorldParameters (options) {
|
|
|
291
294
|
}
|
|
292
295
|
}
|
|
293
296
|
|
|
297
|
+
/**
|
|
298
|
+
* @param {object} worldParameters
|
|
299
|
+
* @param {boolean} [worldParameters._ddIsFlakyTestRetriesEnabled]
|
|
300
|
+
* @param {number} [worldParameters._ddNumTestRetries]
|
|
301
|
+
* @param {boolean} [worldParameters._ddIsDynamicAtrEnabled]
|
|
302
|
+
* @param {number[]} [worldParameters._ddDynamicAtrBuckets]
|
|
303
|
+
* @param {import('../../dd-trace/src/ci-visibility/efd-retry-policy').EfdRetryPolicy}
|
|
304
|
+
* [worldParameters._ddEarlyFlakeDetectionRetryPolicy]
|
|
305
|
+
*/
|
|
306
|
+
function readParallelWorkerAtrParameters (worldParameters) {
|
|
307
|
+
isFlakyTestRetriesEnabled = !!worldParameters._ddIsFlakyTestRetriesEnabled
|
|
308
|
+
numTestRetries = worldParameters._ddNumTestRetries ?? 0
|
|
309
|
+
isDynamicAtrEnabled = !!worldParameters._ddIsDynamicAtrEnabled
|
|
310
|
+
dynamicAtrBuckets = worldParameters._ddDynamicAtrBuckets
|
|
311
|
+
if (isDynamicAtrEnabled) {
|
|
312
|
+
earlyFlakeDetectionRetryPolicy = worldParameters._ddEarlyFlakeDetectionRetryPolicy ?? EMPTY_EFD_RETRY_POLICY
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
294
316
|
function handleDdWorkerMessage (message) {
|
|
295
317
|
if (Array.isArray(message)) {
|
|
296
318
|
const [messageCode, payload] = message
|
|
@@ -430,7 +452,8 @@ function getWrappedHandleWorkerThreadEvent (handleEventFromWorker) {
|
|
|
430
452
|
|
|
431
453
|
const result = handleEventFromWorker.apply(this, arguments)
|
|
432
454
|
|
|
433
|
-
if (envelope.testCaseFinished &&
|
|
455
|
+
if (envelope.testCaseFinished && !envelope.testCaseFinished.willBeRetried &&
|
|
456
|
+
assembledTestCase?.pickle && eventDataCollector) {
|
|
434
457
|
const worstTestStepResult =
|
|
435
458
|
eventDataCollector.getTestCaseAttempt(envelope.testCaseFinished.testCaseStartedId).worstTestStepResult
|
|
436
459
|
handleParallelTestCaseFinished(assembledTestCase.pickle, worstTestStepResult)
|
|
@@ -713,6 +736,17 @@ function publishRetriedAttempt (runner, state) {
|
|
|
713
736
|
const isFirstAttempt = currentAttempt === 0
|
|
714
737
|
const isAtrRetry = !isFirstAttempt && isFlakyTestRetriesEnabled
|
|
715
738
|
|
|
739
|
+
if (isFirstAttempt && isDynamicAtrEnabled && isFlakyTestRetriesEnabled) {
|
|
740
|
+
state.dynamicAtrRetryCount = getDynamicAtrRetryCount(
|
|
741
|
+
performance.now() - state.executionStart,
|
|
742
|
+
earlyFlakeDetectionRetryPolicy,
|
|
743
|
+
dynamicAtrBuckets
|
|
744
|
+
)
|
|
745
|
+
// Native retries revisit maxAttempts before the next attempt in both runner
|
|
746
|
+
// generations. EFD and Attempt to Fix disable native retries, so never reach here.
|
|
747
|
+
runner.maxAttempts = state.dynamicAtrRetryCount + 1
|
|
748
|
+
}
|
|
749
|
+
|
|
716
750
|
// ATR: record this attempt as failed so when run().finally runs (after retry) we have all statuses
|
|
717
751
|
if (isFlakyTestRetriesEnabled) {
|
|
718
752
|
const nameForKey = getCucumberTestName(runner.pickle.name, currentAttempt > 0)
|
|
@@ -768,6 +802,12 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
768
802
|
return run.apply(this, args)
|
|
769
803
|
}
|
|
770
804
|
|
|
805
|
+
// Cucumber 8–10 workers construct runners directly, without the newer
|
|
806
|
+
// runTestCase wrapper that reads the coordinator's configuration.
|
|
807
|
+
if (getEnvironmentVariable('CUCUMBER_WORKER_ID') && satisfies(version, '>=8.0.0 <11.0.0')) {
|
|
808
|
+
readParallelWorkerAtrParameters(this.worldParameters)
|
|
809
|
+
}
|
|
810
|
+
|
|
771
811
|
const testFileAbsolutePath = this.pickle.uri
|
|
772
812
|
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
773
813
|
|
|
@@ -808,6 +848,7 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
808
848
|
}
|
|
809
849
|
let promise
|
|
810
850
|
const executionStart = performance.now()
|
|
851
|
+
state.executionStart = executionStart
|
|
811
852
|
|
|
812
853
|
testFnCh.runStores(ctx, () => {
|
|
813
854
|
promise = run.apply(this, args)
|
|
@@ -922,7 +963,9 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
922
963
|
const atrStatuses = atrStatusesByScenarioKey.get(atrKey)
|
|
923
964
|
const pickleStatuses = lastStatusByPickleId.get(this.pickle.id)
|
|
924
965
|
const statusesToCheck = atrStatuses?.length >= (numTestRetries + 1) ? atrStatuses : pickleStatuses
|
|
925
|
-
if (
|
|
966
|
+
if (state.dynamicAtrRetryCount !== undefined) {
|
|
967
|
+
hasFailedAllRetries = status === 'fail' && state.numAttempt === state.dynamicAtrRetryCount
|
|
968
|
+
} else if (statusesToCheck && statusesToCheck.length === numTestRetries + 1 &&
|
|
926
969
|
statusesToCheck.every(s => s === 'fail')) {
|
|
927
970
|
hasFailedAllRetries = true
|
|
928
971
|
}
|
|
@@ -959,7 +1002,8 @@ function wrapRun (pl, isLatestVersion, version) {
|
|
|
959
1002
|
|
|
960
1003
|
// Notice that ATR is handled using cucumber native retries features.
|
|
961
1004
|
// Therefore, if we reach this point, we are certain that it's the last ATR execution
|
|
962
|
-
const isLastAtrRetry = isFlakyTestRetriesEnabled && !isAttemptToFix && !isEfdRetry &&
|
|
1005
|
+
const isLastAtrRetry = isFlakyTestRetriesEnabled && !isAttemptToFix && !isEfdRetry &&
|
|
1006
|
+
numTestRetries > 0 && this.maxAttempts > 1
|
|
963
1007
|
|
|
964
1008
|
const statuses = lastStatusByPickleId.get(this.pickle.id)
|
|
965
1009
|
const isLastEfdRetry = isEfdRetry && statuses?.length === efdRetryCount + 1
|
|
@@ -1100,8 +1144,17 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
1100
1144
|
isSuitesSkippingEnabled = isItrEnabled && configurationResponse.libraryConfig?.isSuitesSkippingEnabled
|
|
1101
1145
|
isCoverageReportUploadEnabled = configurationResponse.libraryConfig?.isCoverageReportUploadEnabled
|
|
1102
1146
|
isFlakyTestRetriesEnabled = configurationResponse.libraryConfig?.isFlakyTestRetriesEnabled
|
|
1147
|
+
isDynamicAtrEnabled = configurationResponse.libraryConfig?.isDynamicAtrEnabled === true &&
|
|
1148
|
+
satisfies(frameworkVersion, '>=8.0.0')
|
|
1149
|
+
dynamicAtrBuckets = configurationResponse.libraryConfig?.dynamicAtrBuckets
|
|
1103
1150
|
const configRetryCount = configurationResponse.libraryConfig?.flakyTestRetriesCount
|
|
1104
1151
|
numTestRetries = (typeof configRetryCount === 'number' && configRetryCount > 0) ? configRetryCount : 0
|
|
1152
|
+
if (isDynamicAtrEnabled) {
|
|
1153
|
+
// Reserve enough native attempts until the first failure determines its budget.
|
|
1154
|
+
numTestRetries = Math.max(1, dynamicAtrBuckets
|
|
1155
|
+
? Math.max(...dynamicAtrBuckets)
|
|
1156
|
+
: earlyFlakeDetectionRetryPolicy.schedulingRetryCount)
|
|
1157
|
+
}
|
|
1105
1158
|
isKnownTestsEnabled = configurationResponse.libraryConfig?.isKnownTestsEnabled
|
|
1106
1159
|
isTestManagementTestsEnabled = configurationResponse.libraryConfig?.isTestManagementEnabled
|
|
1107
1160
|
testManagementAttemptToFixRetries = configurationResponse.libraryConfig?.testManagementAttemptToFixRetries
|
|
@@ -1165,6 +1218,7 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
1165
1218
|
}
|
|
1166
1219
|
}
|
|
1167
1220
|
|
|
1221
|
+
hasTestsToRun = isCoordinator ? this.sourcedPickles.length > 0 : this.pickleIds.length > 0
|
|
1168
1222
|
pickleByFile = isCoordinator ? getPickleByFileNew(this) : getPickleByFile(this)
|
|
1169
1223
|
|
|
1170
1224
|
if (isKnownTestsEnabled) {
|
|
@@ -1204,6 +1258,10 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
1204
1258
|
options.retry = numTestRetries
|
|
1205
1259
|
}
|
|
1206
1260
|
|
|
1261
|
+
if (isParallel && !isCoordinator) {
|
|
1262
|
+
configureParallelWorkerWorldParameters(options)
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1207
1265
|
atrStatusesByScenarioKey.clear()
|
|
1208
1266
|
attemptToFixTestsByTestFullname.clear()
|
|
1209
1267
|
efdRetryCountByPickleId.clear()
|
|
@@ -1272,8 +1330,10 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
1272
1330
|
global.__coverage__ = fromCoverageMapToCoverage(originalCoverageMap)
|
|
1273
1331
|
}
|
|
1274
1332
|
|
|
1333
|
+
const isExpectedEmptySession = success && !hasTestsToRun
|
|
1275
1334
|
const flushPromise = getChannelPromise(sessionFinishCh, {
|
|
1276
|
-
status: success ? 'pass' : 'fail',
|
|
1335
|
+
status: isExpectedEmptySession ? 'skip' : (success ? 'pass' : 'fail'),
|
|
1336
|
+
isExpectedEmptySession,
|
|
1277
1337
|
isSuitesSkipped,
|
|
1278
1338
|
testCodeCoverageLinesTotal,
|
|
1279
1339
|
testSessionCoverageFiles,
|
|
@@ -1550,7 +1610,7 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion,
|
|
|
1550
1610
|
const parseWorkerResponse = parseWorkerMessageFunction.apply(this, arguments)
|
|
1551
1611
|
|
|
1552
1612
|
// after calling `parseWorkerMessageFunction`, the test status can already be read
|
|
1553
|
-
if (parsed.testCaseFinished) {
|
|
1613
|
+
if (parsed.testCaseFinished && !parsed.testCaseFinished.willBeRetried) {
|
|
1554
1614
|
let worstTestStepResult
|
|
1555
1615
|
if (isNewVersion && eventDataCollector) {
|
|
1556
1616
|
pickle = this.inProgress[worker.id].pickle
|
|
@@ -51,7 +51,6 @@ const noopTask = {
|
|
|
51
51
|
/**
|
|
52
52
|
* @param {FileSystemError} error filesystem error
|
|
53
53
|
* @param {string} fallbackPath path used when the error does not include one
|
|
54
|
-
* @returns {string} concise error description
|
|
55
54
|
*/
|
|
56
55
|
function formatFileSystemError (error, fallbackPath) {
|
|
57
56
|
const code = error?.code || error?.name || 'UNKNOWN'
|
|
@@ -64,7 +63,6 @@ function formatFileSystemError (error, fallbackPath) {
|
|
|
64
63
|
* @param {FileCreationFailure[]} failures failed directory attempts
|
|
65
64
|
* @param {string} consequence effect on Cypress instrumentation
|
|
66
65
|
* @param {boolean} [customerVisible] whether to report the failure without requiring debug logging
|
|
67
|
-
* @returns {void}
|
|
68
66
|
*/
|
|
69
67
|
function warnFileCreationFailures (artifact, failures, consequence, customerVisible = false) {
|
|
70
68
|
let details = ''
|
|
@@ -89,7 +87,6 @@ function warnFileCreationFailures (artifact, failures, consequence, customerVisi
|
|
|
89
87
|
*
|
|
90
88
|
* @param {string} message printf-style error message
|
|
91
89
|
* @param {...unknown} args message arguments
|
|
92
|
-
* @returns {void}
|
|
93
90
|
*/
|
|
94
91
|
function logBrowserInstrumentationError (message, ...args) {
|
|
95
92
|
// eslint-disable-next-line no-console
|
|
@@ -98,7 +95,6 @@ function logBrowserInstrumentationError (message, ...args) {
|
|
|
98
95
|
|
|
99
96
|
/**
|
|
100
97
|
* @param {string} filePath generated file to remove
|
|
101
|
-
* @returns {void}
|
|
102
98
|
*/
|
|
103
99
|
function removeGeneratedFile (filePath) {
|
|
104
100
|
try {
|
|
@@ -118,7 +114,6 @@ function removeGeneratedFile (filePath) {
|
|
|
118
114
|
* Removes project-local support files when Cypress exits without firing
|
|
119
115
|
* after:run, as happens in open mode without experimental run events.
|
|
120
116
|
*
|
|
121
|
-
* @returns {void}
|
|
122
117
|
*/
|
|
123
118
|
function removeGeneratedFilesAtExit () {
|
|
124
119
|
exitCleanupRegistered = false
|
|
@@ -128,7 +123,6 @@ function removeGeneratedFilesAtExit () {
|
|
|
128
123
|
|
|
129
124
|
/**
|
|
130
125
|
* @param {string[]} filePaths generated support files
|
|
131
|
-
* @returns {void}
|
|
132
126
|
*/
|
|
133
127
|
function registerGeneratedFilesForExitCleanup (filePaths) {
|
|
134
128
|
for (const filePath of filePaths) generatedFilesForExitCleanup.add(filePath)
|
|
@@ -140,7 +134,6 @@ function registerGeneratedFilesForExitCleanup (filePaths) {
|
|
|
140
134
|
|
|
141
135
|
/**
|
|
142
136
|
* @param {string[]} filePaths generated support files
|
|
143
|
-
* @returns {void}
|
|
144
137
|
*/
|
|
145
138
|
function cleanupGeneratedFiles (filePaths) {
|
|
146
139
|
for (const filePath of filePaths) {
|
|
@@ -160,7 +153,6 @@ function cleanupGeneratedFiles (filePaths) {
|
|
|
160
153
|
*
|
|
161
154
|
* @param {string} filePath generated file path
|
|
162
155
|
* @param {string} content generated file content
|
|
163
|
-
* @returns {void}
|
|
164
156
|
*/
|
|
165
157
|
function writeExclusiveFile (filePath, content) {
|
|
166
158
|
let descriptor
|
|
@@ -189,7 +181,6 @@ function writeExclusiveFile (filePath, content) {
|
|
|
189
181
|
|
|
190
182
|
/**
|
|
191
183
|
* @param {unknown} handler Cypress task registration
|
|
192
|
-
* @returns {boolean}
|
|
193
184
|
*/
|
|
194
185
|
function isDatadogTaskRegistration (handler) {
|
|
195
186
|
return !!handler && typeof handler === 'object' &&
|
|
@@ -201,7 +192,6 @@ function isDatadogTaskRegistration (handler) {
|
|
|
201
192
|
|
|
202
193
|
/**
|
|
203
194
|
* @param {unknown} handler Cypress after:run handler
|
|
204
|
-
* @returns {boolean} whether this is the handler registered by the manual Datadog plugin
|
|
205
195
|
*/
|
|
206
196
|
function isDatadogAfterRunHandler (handler) {
|
|
207
197
|
return typeof handler === 'function' && handler[DD_CYPRESS_AFTER_RUN_HANDLER] === true
|
|
@@ -209,7 +199,6 @@ function isDatadogAfterRunHandler (handler) {
|
|
|
209
199
|
|
|
210
200
|
/**
|
|
211
201
|
* @param {unknown} handler Cypress after:spec handler
|
|
212
|
-
* @returns {boolean} whether this is the handler registered by the manual Datadog plugin
|
|
213
202
|
*/
|
|
214
203
|
function isDatadogAfterSpecHandler (handler) {
|
|
215
204
|
return typeof handler === 'function' && handler[DD_CYPRESS_AFTER_SPEC_HANDLER] === true
|
|
@@ -217,7 +206,6 @@ function isDatadogAfterSpecHandler (handler) {
|
|
|
217
206
|
|
|
218
207
|
/**
|
|
219
208
|
* @param {object} manualPlugin manual plugin registration state
|
|
220
|
-
* @returns {boolean} whether the manual plugin supports error-aware finalization
|
|
221
209
|
*/
|
|
222
210
|
function supportsErrorAwareFinalization (manualPlugin) {
|
|
223
211
|
return isDatadogAfterSpecHandler(manualPlugin.afterSpecHandler) &&
|
|
@@ -226,7 +214,6 @@ function supportsErrorAwareFinalization (manualPlugin) {
|
|
|
226
214
|
|
|
227
215
|
/**
|
|
228
216
|
* @param {unknown} handler Cypress task handler map
|
|
229
|
-
* @returns {boolean} whether the current manual Datadog plugin owns the task map
|
|
230
217
|
*/
|
|
231
218
|
function isCurrentDatadogTaskRegistration (handler) {
|
|
232
219
|
return !!handler && handler[DD_CYPRESS_TASK_HANDLER] === manualPluginOwner
|
|
@@ -234,7 +221,6 @@ function isCurrentDatadogTaskRegistration (handler) {
|
|
|
234
221
|
|
|
235
222
|
/**
|
|
236
223
|
* @param {unknown} handler Cypress task handler map
|
|
237
|
-
* @returns {boolean} whether the manual plugin registered only fallback tasks
|
|
238
224
|
*/
|
|
239
225
|
function isDatadogNoopTaskRegistration (handler) {
|
|
240
226
|
return !!handler && handler[DD_CYPRESS_NOOP_TASK_HANDLER] === true
|
|
@@ -242,7 +228,6 @@ function isDatadogNoopTaskRegistration (handler) {
|
|
|
242
228
|
|
|
243
229
|
/**
|
|
244
230
|
* @param {unknown} value
|
|
245
|
-
* @returns {boolean}
|
|
246
231
|
*/
|
|
247
232
|
function isPlainObject (value) {
|
|
248
233
|
if (!value || typeof value !== 'object') return false
|
|
@@ -278,7 +263,6 @@ function mergeReturnedConfig (config, updatedConfig) {
|
|
|
278
263
|
/**
|
|
279
264
|
* @param {string} rootPath parent path
|
|
280
265
|
* @param {string} candidatePath path that should be inside rootPath
|
|
281
|
-
* @returns {boolean}
|
|
282
266
|
*/
|
|
283
267
|
function isPathInside (rootPath, candidatePath) {
|
|
284
268
|
const relativePath = path.relative(path.resolve(rootPath), path.resolve(candidatePath))
|
|
@@ -288,7 +272,6 @@ function isPathInside (rootPath, candidatePath) {
|
|
|
288
272
|
/**
|
|
289
273
|
* @param {string} fromDirectory directory containing the importing file
|
|
290
274
|
* @param {string} importedFile file to import
|
|
291
|
-
* @returns {string}
|
|
292
275
|
*/
|
|
293
276
|
function getRelativeImportPath (fromDirectory, importedFile) {
|
|
294
277
|
let relativePath = path.relative(fromDirectory, importedFile).split(path.sep).join('/')
|
|
@@ -420,7 +403,6 @@ function injectSupportFile (config) {
|
|
|
420
403
|
* @param {Function} on Cypress event registration function
|
|
421
404
|
* @param {Function[]} handlers collected after:screenshot handlers
|
|
422
405
|
* @param {Function|undefined} datadogHandler manual Datadog screenshot handler
|
|
423
|
-
* @returns {void}
|
|
424
406
|
*/
|
|
425
407
|
function registerManualAfterScreenshotHandlers (on, handlers, datadogHandler) {
|
|
426
408
|
const userHandlers = handlers.filter(handler => handler !== datadogHandler)
|
|
@@ -451,7 +433,6 @@ function registerManualAfterScreenshotHandlers (on, handlers, datadogHandler) {
|
|
|
451
433
|
* @param {Function[]} handlers collected after:spec handlers
|
|
452
434
|
* @param {Function} [datadogHandler] manual Datadog after:spec handler
|
|
453
435
|
* @param {Function} [cleanup] removes generated support files after an error
|
|
454
|
-
* @returns {void}
|
|
455
436
|
*/
|
|
456
437
|
function registerAfterSpecHandlers (on, handlers, datadogHandler, cleanup) {
|
|
457
438
|
const userHandlers = datadogHandler
|
|
@@ -495,7 +476,6 @@ function registerAfterSpecHandlers (on, handlers, datadogHandler, cleanup) {
|
|
|
495
476
|
* sessions in interactive mode.
|
|
496
477
|
*
|
|
497
478
|
* @param {object} config Cypress resolved config object
|
|
498
|
-
* @returns {void}
|
|
499
479
|
*/
|
|
500
480
|
function enableInteractiveRunEvents (config) {
|
|
501
481
|
if (config.isInteractive && config.experimentalInteractiveRunEvents !== true) {
|
|
@@ -740,7 +720,6 @@ function wrapConfig (config) {
|
|
|
740
720
|
* (`.js`, `.ts`) are loaded as ESM or CJS.
|
|
741
721
|
*
|
|
742
722
|
* @param {string} filePath absolute path to a file under the project
|
|
743
|
-
* @returns {boolean}
|
|
744
723
|
*/
|
|
745
724
|
function isUnderEsmPackage (filePath) {
|
|
746
725
|
let dir = path.dirname(filePath)
|
|
@@ -759,7 +738,6 @@ function isUnderEsmPackage (filePath) {
|
|
|
759
738
|
/**
|
|
760
739
|
* @param {string} originalConfigFile absolute path to the original config file
|
|
761
740
|
* @param {string} wrapperDirectory directory for the generated wrapper
|
|
762
|
-
* @returns {string} path to the generated wrapper file
|
|
763
741
|
*/
|
|
764
742
|
function createConfigWrapper (originalConfigFile, wrapperDirectory) {
|
|
765
743
|
// Match the module mode Cypress would use for the user's original config
|
|
@@ -815,7 +793,6 @@ module.exports = cypressConfig.wrapConfig(originalConfig)
|
|
|
815
793
|
|
|
816
794
|
/**
|
|
817
795
|
* @param {string} projectRoot
|
|
818
|
-
* @returns {boolean}
|
|
819
796
|
*/
|
|
820
797
|
function isTypeScript6OrNewer (projectRoot) {
|
|
821
798
|
try {
|
|
@@ -20,7 +20,6 @@ function getCompletion (onDone) {
|
|
|
20
20
|
* @param {import('node:diagnostics_channel').Channel} channel
|
|
21
21
|
* @param {Record<string, unknown>} payload
|
|
22
22
|
* @param {(...args: T) => void} onDone
|
|
23
|
-
* @returns {void}
|
|
24
23
|
*/
|
|
25
24
|
function publishWithCompletion (channel, payload, onDone) {
|
|
26
25
|
const complete = getCompletion(onDone)
|
|
@@ -33,7 +32,6 @@ function publishWithCompletion (channel, payload, onDone) {
|
|
|
33
32
|
* @param {import('node:diagnostics_channel').Channel} channel
|
|
34
33
|
* @param {Record<string, unknown> & { onDone?: (...args: T) => void }} payload
|
|
35
34
|
* @param {(...args: T) => void} onDone
|
|
36
|
-
* @returns {void}
|
|
37
35
|
*/
|
|
38
36
|
function runStoresWithCompletion (channel, payload, onDone) {
|
|
39
37
|
const complete = getCompletion(onDone)
|
|
@@ -214,7 +214,6 @@ function createGraphqlJitRuntime ({
|
|
|
214
214
|
* @param {string} resolverCall
|
|
215
215
|
* @param {string} resolverName
|
|
216
216
|
* @param {number | undefined} descriptorId
|
|
217
|
-
* @returns {string}
|
|
218
217
|
*/
|
|
219
218
|
function compileResolverCall (context, resolverCall, resolverName, descriptorId) {
|
|
220
219
|
const openParenthesis = resolverCall.indexOf('(')
|
|
@@ -254,7 +253,6 @@ function createGraphqlJitRuntime ({
|
|
|
254
253
|
* @param {CompiledArguments} args
|
|
255
254
|
* @param {string} argumentSource
|
|
256
255
|
* @param {string} compiledField
|
|
257
|
-
* @returns {string}
|
|
258
256
|
*/
|
|
259
257
|
function compileDefaultField (
|
|
260
258
|
context,
|
|
@@ -377,7 +375,6 @@ function createDescriptor (context, compilerPath, input, fieldNode, createFieldM
|
|
|
377
375
|
* @param {JitFieldDescriptor} descriptor
|
|
378
376
|
* @param {CompiledArguments['missing']} missing
|
|
379
377
|
* @param {string} argumentSource
|
|
380
|
-
* @returns {string}
|
|
381
378
|
*/
|
|
382
379
|
function compileArgumentFactory (context, descriptor, missing, argumentSource) {
|
|
383
380
|
if (missing.length === 0 && argumentSource === '{}') return 'undefined'
|
|
@@ -418,7 +415,6 @@ function compileArgumentFactory (context, descriptor, missing, argumentSource) {
|
|
|
418
415
|
|
|
419
416
|
/**
|
|
420
417
|
* @param {ArgumentPath} path
|
|
421
|
-
* @returns {string}
|
|
422
418
|
*/
|
|
423
419
|
function compileArgumentPath (path) {
|
|
424
420
|
let source = 'args'
|
|
@@ -430,7 +426,6 @@ function compileArgumentPath (path) {
|
|
|
430
426
|
|
|
431
427
|
/**
|
|
432
428
|
* @param {string} value
|
|
433
|
-
* @returns {string}
|
|
434
429
|
*/
|
|
435
430
|
function quoteString (value) {
|
|
436
431
|
const json = JSON.stringify(value)
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
// Only list unprefixed node modules. They will automatically be instrumented as prefixed and unprefixed.
|
|
5
|
+
'@supabase/auth-js': { esmFirst: true, fn: () => require('../supabase') },
|
|
6
|
+
'@supabase/functions-js': { esmFirst: true, fn: () => require('../supabase') },
|
|
7
|
+
'@supabase/postgrest-js': { esmFirst: true, fn: () => require('../supabase') },
|
|
8
|
+
'@supabase/realtime-js': { esmFirst: true, fn: () => require('../supabase') },
|
|
9
|
+
'@supabase/storage-js': { esmFirst: true, fn: () => require('../supabase') },
|
|
10
|
+
'@supabase/supabase-js': { esmFirst: true, fn: () => require('../supabase') },
|
|
5
11
|
child_process: () => require('../child_process'),
|
|
6
12
|
crypto: () => require('../crypto'),
|
|
7
13
|
dns: () => require('../dns'),
|
|
@@ -42,6 +48,7 @@ module.exports = {
|
|
|
42
48
|
'@grpc/grpc-js': () => require('../grpc'),
|
|
43
49
|
'@hapi/hapi': () => require('../hapi'),
|
|
44
50
|
'@happy-dom/jest-environment': () => require('../jest'),
|
|
51
|
+
'@jest/console': () => require('../jest'),
|
|
45
52
|
'@jest/core': () => require('../jest'),
|
|
46
53
|
'@jest/reporters': () => require('../jest'),
|
|
47
54
|
'@jest/test-sequencer': () => require('../jest'),
|
|
@@ -141,6 +148,7 @@ module.exports = {
|
|
|
141
148
|
'pino-pretty': () => require('../pino'),
|
|
142
149
|
playwright: () => require('../playwright'),
|
|
143
150
|
'playwright-core': () => require('../playwright'),
|
|
151
|
+
postgres: { esmFirst: true, fn: () => require('../postgres') },
|
|
144
152
|
'promise-js': () => require('../promise-js'),
|
|
145
153
|
promise: () => require('../promise'),
|
|
146
154
|
protobufjs: () => require('../protobufjs'),
|
|
@@ -9,7 +9,6 @@ const { isRelativeRequire } = require('./shared-utils')
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {string|undefined} version
|
|
11
11
|
* @param {string[]|undefined} ranges
|
|
12
|
-
* @returns {boolean}
|
|
13
12
|
*/
|
|
14
13
|
function matchVersion (version, ranges) {
|
|
15
14
|
return !version || !ranges || ranges.some(range => satisfies(version, range))
|
|
@@ -18,7 +17,6 @@ function matchVersion (version, ranges) {
|
|
|
18
17
|
/**
|
|
19
18
|
* @param {string} name
|
|
20
19
|
* @param {string} [file]
|
|
21
|
-
* @returns {string}
|
|
22
20
|
*/
|
|
23
21
|
function filename (name, file) {
|
|
24
22
|
return file ? `${name}/${file}` : name
|
|
@@ -29,7 +27,6 @@ function filename (name, file) {
|
|
|
29
27
|
* @param {string|undefined} version
|
|
30
28
|
* @param {string} moduleName
|
|
31
29
|
* @param {{ file?: string, filePattern?: string, versions?: string[] }} instrumentation
|
|
32
|
-
* @returns {boolean}
|
|
33
30
|
*/
|
|
34
31
|
function matchesInstrumentation (name, version, moduleName, instrumentation) {
|
|
35
32
|
const { file, filePattern, versions } = instrumentation
|
|
@@ -400,9 +400,6 @@ function getConnectionForAcquire (getConnection, pool, args, acquireCtx, start,
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
/**
|
|
404
|
-
* @returns {boolean}
|
|
405
|
-
*/
|
|
406
403
|
function isPoolQueryAcquire () {
|
|
407
404
|
return currentPoolQueryAcquire !== undefined
|
|
408
405
|
}
|
|
@@ -436,7 +433,6 @@ function runWithPoolQueryAcquire (acquire, method, receiver, args) {
|
|
|
436
433
|
|
|
437
434
|
/**
|
|
438
435
|
* @param {object} pool
|
|
439
|
-
* @returns {boolean}
|
|
440
436
|
*/
|
|
441
437
|
function takeDeferredPoolQueryAcquire (pool) {
|
|
442
438
|
const acquire = deferredPoolQueryAcquireStorage?.getStore()
|
|
@@ -579,7 +575,6 @@ function setPoolAcquireCaptureWaitTime (capture, waitTime) {
|
|
|
579
575
|
* @param {Record<string, unknown>} receiver
|
|
580
576
|
* @param {string} acquireMethod
|
|
581
577
|
* @param {unknown[]} args
|
|
582
|
-
* @returns {boolean}
|
|
583
578
|
*/
|
|
584
579
|
function dispatchesAcquireSynchronously (method, receiver, acquireMethod, args) {
|
|
585
580
|
let dispatched = false
|
|
@@ -618,7 +613,6 @@ function acquireStart (pool, acquire) {
|
|
|
618
613
|
|
|
619
614
|
/**
|
|
620
615
|
* @param {number|undefined} start
|
|
621
|
-
* @returns {number}
|
|
622
616
|
*/
|
|
623
617
|
function acquireWait (start) {
|
|
624
618
|
return start === undefined ? 0 : performance.now() - start
|
|
@@ -35,6 +35,10 @@ if (!disabledInstrumentations.has('process')) {
|
|
|
35
35
|
require('../process')
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
if (!disabledInstrumentations.has('console')) {
|
|
39
|
+
require('../console')
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
const debugEnabled = DD_TRACE_DEBUG
|
|
39
43
|
checkRequireCache.checkForRequiredModules()
|
|
40
44
|
if (debugEnabled) {
|