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
package/ci/diagnose.js
CHANGED
|
@@ -434,7 +434,6 @@ function checkDdTraceDependency (results, manifests, options = {}) {
|
|
|
434
434
|
* Checks whether static diagnosis parsed the repository root package manifest.
|
|
435
435
|
*
|
|
436
436
|
* @param {Array<object>} manifests parsed package manifests
|
|
437
|
-
* @returns {boolean} true when the root package.json was parsed
|
|
438
437
|
*/
|
|
439
438
|
function hasParsedRootManifest (manifests) {
|
|
440
439
|
return manifests.some(manifest => manifest.relativePath === 'package.json')
|
|
@@ -1233,7 +1232,6 @@ function getEligibleCommandMatch (framework) {
|
|
|
1233
1232
|
*
|
|
1234
1233
|
* @param {string} frameworkId framework id
|
|
1235
1234
|
* @param {object} script package script
|
|
1236
|
-
* @returns {number} lower is preferred
|
|
1237
1235
|
*/
|
|
1238
1236
|
function getFrameworkCommandPreference (frameworkId, script) {
|
|
1239
1237
|
let score = 0
|
|
@@ -1294,7 +1292,6 @@ function getIdentityTokens (value) {
|
|
|
1294
1292
|
* @param {object} left first command or dependency entry
|
|
1295
1293
|
* @param {object} right second command or dependency entry
|
|
1296
1294
|
* @param {Map<string, number>|undefined} scores package preference scores
|
|
1297
|
-
* @returns {number} sort order
|
|
1298
1295
|
*/
|
|
1299
1296
|
function compareProjectPreference (left, right, scores) {
|
|
1300
1297
|
return compareProjectScope(left, right, scores) ||
|
|
@@ -1307,7 +1304,6 @@ function compareProjectPreference (left, right, scores) {
|
|
|
1307
1304
|
* @param {object} left first command or dependency entry
|
|
1308
1305
|
* @param {object} right second command or dependency entry
|
|
1309
1306
|
* @param {Map<string, number>|undefined} scores package preference scores
|
|
1310
|
-
* @returns {number} sort order before stable path tie-breaking
|
|
1311
1307
|
*/
|
|
1312
1308
|
function compareProjectScope (left, right, scores) {
|
|
1313
1309
|
const scoreDifference = (scores?.get(right.relativePath) || 0) - (scores?.get(left.relativePath) || 0)
|
|
@@ -1321,7 +1317,6 @@ function compareProjectScope (left, right, scores) {
|
|
|
1321
1317
|
*
|
|
1322
1318
|
* @param {string} frameworkId framework id
|
|
1323
1319
|
* @param {string} command package script command
|
|
1324
|
-
* @returns {boolean} whether the command is ineligible
|
|
1325
1320
|
*/
|
|
1326
1321
|
function isIneligibleFrameworkCommand (frameworkId, command) {
|
|
1327
1322
|
if (frameworkId === 'cucumber' && !isCucumberRunnerCommand(command)) return true
|
|
@@ -1335,7 +1330,6 @@ function isIneligibleFrameworkCommand (frameworkId, command) {
|
|
|
1335
1330
|
* Checks whether a package command invokes the Cucumber runner instead of merely naming a Cucumber config file.
|
|
1336
1331
|
*
|
|
1337
1332
|
* @param {string} command package script command
|
|
1338
|
-
* @returns {boolean} whether the command invokes Cucumber
|
|
1339
1333
|
*/
|
|
1340
1334
|
function isCucumberRunnerCommand (command) {
|
|
1341
1335
|
return CUCUMBER_RUNNER_COMMAND_RE.test(String(command || ''))
|
|
@@ -1724,7 +1718,6 @@ function getScanExclusions (root, excludePaths) {
|
|
|
1724
1718
|
*
|
|
1725
1719
|
* @param {string} relativePath repository-relative path
|
|
1726
1720
|
* @param {Set<string>} exclusions normalized exclusions
|
|
1727
|
-
* @returns {boolean} whether the path must be skipped
|
|
1728
1721
|
*/
|
|
1729
1722
|
function isScanPathExcluded (relativePath, exclusions) {
|
|
1730
1723
|
const normalizedPath = normalizeRelativePath(relativePath)
|
|
@@ -1824,7 +1817,6 @@ function getSafeScannedFile (root, physicalRoot, relativePath) {
|
|
|
1824
1817
|
*
|
|
1825
1818
|
* @param {string} root allowed root
|
|
1826
1819
|
* @param {string} filename candidate path
|
|
1827
|
-
* @returns {boolean} whether the candidate is inside the root
|
|
1828
1820
|
*/
|
|
1829
1821
|
function isPathInside (root, filename) {
|
|
1830
1822
|
const relative = path.relative(root, filename)
|
|
@@ -1835,7 +1827,6 @@ function isPathInside (root, filename) {
|
|
|
1835
1827
|
* Checks whether a filename should be scanned as text.
|
|
1836
1828
|
*
|
|
1837
1829
|
* @param {string} name filename
|
|
1838
|
-
* @returns {boolean} true if the file is text-like
|
|
1839
1830
|
*/
|
|
1840
1831
|
function isTextFileName (name) {
|
|
1841
1832
|
return TEXT_FILE_NAMES.has(name) || TEXT_EXTENSIONS.has(path.extname(name))
|
|
@@ -1845,7 +1836,6 @@ function isTextFileName (name) {
|
|
|
1845
1836
|
* Checks whether a file is a common CI workflow file.
|
|
1846
1837
|
*
|
|
1847
1838
|
* @param {string} relativePath relative path
|
|
1848
|
-
* @returns {boolean} true if the path is a workflow file
|
|
1849
1839
|
*/
|
|
1850
1840
|
function isWorkflowFile (relativePath) {
|
|
1851
1841
|
return relativePath.startsWith('.github/workflows/') ||
|
|
@@ -1867,7 +1857,6 @@ function isWorkflowFile (relativePath) {
|
|
|
1867
1857
|
* Checks whether a scanned file is likely to configure test process initialization.
|
|
1868
1858
|
*
|
|
1869
1859
|
* @param {object} file scanned text file
|
|
1870
|
-
* @returns {boolean} true when plain dd-trace init should be treated as test setup evidence
|
|
1871
1860
|
*/
|
|
1872
1861
|
function isTestSetupOrCiFile (file) {
|
|
1873
1862
|
const relativePath = file.relativePath
|
|
@@ -1891,7 +1880,6 @@ function isTestSetupOrCiFile (file) {
|
|
|
1891
1880
|
* @param {string} root repository root
|
|
1892
1881
|
* @param {string|undefined} gitExecutable trusted git executable
|
|
1893
1882
|
* @param {typeof process.env} env credential-free git environment
|
|
1894
|
-
* @returns {boolean} true if git runs
|
|
1895
1883
|
*/
|
|
1896
1884
|
function canRunGit (execFile, root, gitExecutable, env) {
|
|
1897
1885
|
if (!gitExecutable) return false
|
|
@@ -1912,7 +1900,6 @@ function canRunGit (execFile, root, gitExecutable, env) {
|
|
|
1912
1900
|
* @param {string} gitExecutable trusted git executable
|
|
1913
1901
|
* @param {typeof process.env} env credential-free git environment
|
|
1914
1902
|
* @param {string[]} args git arguments
|
|
1915
|
-
* @returns {string} command output
|
|
1916
1903
|
*/
|
|
1917
1904
|
function runGit (execFile, root, gitExecutable, env, args) {
|
|
1918
1905
|
try {
|
|
@@ -2024,7 +2011,6 @@ function coerceVersion (rawVersion) {
|
|
|
2024
2011
|
* Checks whether a manifest dependency range cannot be represented by one comparable version.
|
|
2025
2012
|
*
|
|
2026
2013
|
* @param {string} rawVersion package manifest version/range
|
|
2027
|
-
* @returns {boolean} true when static diagnosis should ask the user to verify the range
|
|
2028
2014
|
*/
|
|
2029
2015
|
function isAmbiguousRange (rawVersion) {
|
|
2030
2016
|
const version = String(rawVersion || '').trim()
|
|
@@ -2038,7 +2024,6 @@ function isAmbiguousRange (rawVersion) {
|
|
|
2038
2024
|
*
|
|
2039
2025
|
* @param {Array<object>} frameworks detected frameworks
|
|
2040
2026
|
* @param {string} id framework id
|
|
2041
|
-
* @returns {boolean} true if present
|
|
2042
2027
|
*/
|
|
2043
2028
|
function hasFramework (frameworks, id) {
|
|
2044
2029
|
return frameworks.some(framework => framework.id === id)
|
|
@@ -2048,7 +2033,6 @@ function hasFramework (frameworks, id) {
|
|
|
2048
2033
|
* Checks whether NODE_OPTIONS preloads dd-trace/ci/init.
|
|
2049
2034
|
*
|
|
2050
2035
|
* @param {string|undefined} nodeOptions NODE_OPTIONS value
|
|
2051
|
-
* @returns {boolean} true if dd-trace/ci/init is present
|
|
2052
2036
|
*/
|
|
2053
2037
|
function hasCiInitInNodeOptions (nodeOptions) {
|
|
2054
2038
|
return !!nodeOptions && INIT_PRELOAD_RE.test(nodeOptions)
|
|
@@ -2058,7 +2042,6 @@ function hasCiInitInNodeOptions (nodeOptions) {
|
|
|
2058
2042
|
* Checks whether NODE_OPTIONS preloads dd-trace/register.js.
|
|
2059
2043
|
*
|
|
2060
2044
|
* @param {string|undefined} nodeOptions NODE_OPTIONS value
|
|
2061
|
-
* @returns {boolean} true if dd-trace/register.js is present
|
|
2062
2045
|
*/
|
|
2063
2046
|
function hasRegisterInNodeOptions (nodeOptions) {
|
|
2064
2047
|
return !!nodeOptions && REGISTER_PRELOAD_RE.test(nodeOptions)
|
|
@@ -2068,7 +2051,6 @@ function hasRegisterInNodeOptions (nodeOptions) {
|
|
|
2068
2051
|
* Checks whether environment contains branch or tag metadata.
|
|
2069
2052
|
*
|
|
2070
2053
|
* @param {typeof process.env} env environment
|
|
2071
|
-
* @returns {boolean} true if branch metadata exists
|
|
2072
2054
|
*/
|
|
2073
2055
|
function hasBranchMetadata (env) {
|
|
2074
2056
|
return !!(
|
|
@@ -2092,7 +2074,6 @@ function hasBranchMetadata (env) {
|
|
|
2092
2074
|
* Checks whether environment contains commit SHA metadata.
|
|
2093
2075
|
*
|
|
2094
2076
|
* @param {typeof process.env} env environment
|
|
2095
|
-
* @returns {boolean} true if SHA metadata exists
|
|
2096
2077
|
*/
|
|
2097
2078
|
function hasShaMetadata (env) {
|
|
2098
2079
|
return !!(
|
|
@@ -2113,7 +2094,6 @@ function hasShaMetadata (env) {
|
|
|
2113
2094
|
* Checks truthy string env values.
|
|
2114
2095
|
*
|
|
2115
2096
|
* @param {string|undefined} value value to inspect
|
|
2116
|
-
* @returns {boolean} true if value is true-like
|
|
2117
2097
|
*/
|
|
2118
2098
|
function isTrueLike (value) {
|
|
2119
2099
|
return /^(?:1|true)$/i.test(String(value || ''))
|
|
@@ -2123,7 +2103,6 @@ function isTrueLike (value) {
|
|
|
2123
2103
|
* Checks false-like string env values.
|
|
2124
2104
|
*
|
|
2125
2105
|
* @param {string|undefined} value value to inspect
|
|
2126
|
-
* @returns {boolean} true if value is false-like
|
|
2127
2106
|
*/
|
|
2128
2107
|
function isFalseLike (value) {
|
|
2129
2108
|
return /^(?:0|false)$/i.test(String(value || ''))
|
|
@@ -2133,7 +2112,6 @@ function isFalseLike (value) {
|
|
|
2133
2112
|
* Formats a list of locations for text output.
|
|
2134
2113
|
*
|
|
2135
2114
|
* @param {string[]} locations relative paths
|
|
2136
|
-
* @returns {string} formatted locations
|
|
2137
2115
|
*/
|
|
2138
2116
|
function formatLocations (locations) {
|
|
2139
2117
|
const uniqueLocations = unique(locations).slice(0, 5)
|
|
@@ -2231,7 +2209,6 @@ function uniqueVersionDetections (detections) {
|
|
|
2231
2209
|
* Normalizes relative paths to POSIX separators for stable output.
|
|
2232
2210
|
*
|
|
2233
2211
|
* @param {string} relativePath relative path
|
|
2234
|
-
* @returns {string} normalized path
|
|
2235
2212
|
*/
|
|
2236
2213
|
function normalizeRelativePath (relativePath) {
|
|
2237
2214
|
return relativePath.split(path.sep).join('/')
|
|
@@ -56,7 +56,6 @@ function writeApprovalArtifacts (input) {
|
|
|
56
56
|
*
|
|
57
57
|
* @param {Array<{path: string, sha256: string}>|undefined} expected preflight project files
|
|
58
58
|
* @param {Array<{path: string, sha256: string}>} actual approval project files
|
|
59
|
-
* @returns {void}
|
|
60
59
|
*/
|
|
61
60
|
function assertExpectedProjectFiles (expected, actual) {
|
|
62
61
|
if (!expected) return
|
|
@@ -109,7 +108,6 @@ function loadApprovedPlan (approvalPath, expectedDigest) {
|
|
|
109
108
|
*
|
|
110
109
|
* @param {object} material parsed approval material
|
|
111
110
|
* @param {string} approvalPath approved JSON path
|
|
112
|
-
* @returns {void}
|
|
113
111
|
*/
|
|
114
112
|
function validateApprovedPlanShape (material, approvalPath) {
|
|
115
113
|
const manifestPath = material?.manifest?.path
|
|
@@ -145,7 +143,6 @@ function validateApprovedPlanShape (material, approvalPath) {
|
|
|
145
143
|
* Creates a standard SHA-256 checksum list for independently checking covered files.
|
|
146
144
|
*
|
|
147
145
|
* @param {object} material approval material
|
|
148
|
-
* @returns {string} checksum manifest
|
|
149
146
|
*/
|
|
150
147
|
function getCoveredFilesManifest (material) {
|
|
151
148
|
const files = new Map([[material.manifest.path, material.manifest.sha256]])
|
|
@@ -27,7 +27,6 @@ const PACKAGE_SNAPSHOT_EXCLUDED_NAMES = new Set(['.git', '.nyc_output', 'node_mo
|
|
|
27
27
|
* @param {string} input.offlineFixtureNonce random fixture-root nonce shown in the execution plan
|
|
28
28
|
* @param {boolean} [input.keepTempFiles] whether generated files are retained
|
|
29
29
|
* @param {boolean} [input.verbose] whether command progress is printed
|
|
30
|
-
* @returns {string} SHA-256 approval digest
|
|
31
30
|
*/
|
|
32
31
|
function getApprovalDigest ({
|
|
33
32
|
manifest,
|
|
@@ -185,7 +184,6 @@ function getApprovalProjectSnapshot (manifest, { includeLocal = true } = {}) {
|
|
|
185
184
|
* Serializes approval material using stable formatting suitable for independent SHA-256 tools.
|
|
186
185
|
*
|
|
187
186
|
* @param {object} input approval inputs
|
|
188
|
-
* @returns {string} UTF-8 JSON text ending in one newline
|
|
189
187
|
*/
|
|
190
188
|
function serializeApprovalMaterial (input) {
|
|
191
189
|
return `${JSON.stringify(getApprovalMaterial(input), null, 2)}\n`
|
|
@@ -299,7 +297,6 @@ function getSelectedGeneratedPaths (strategy, requestedScenario) {
|
|
|
299
297
|
* Hashes one covered regular file.
|
|
300
298
|
*
|
|
301
299
|
* @param {string} filename absolute filename
|
|
302
|
-
* @returns {string} lowercase SHA-256 digest
|
|
303
300
|
*/
|
|
304
301
|
function getFileDigest (filename) {
|
|
305
302
|
return crypto.createHash('sha256').update(fs.readFileSync(filename)).digest('hex')
|
|
@@ -329,7 +326,6 @@ function collectPackageFiles (directory, excludedPaths, files) {
|
|
|
329
326
|
*
|
|
330
327
|
* @param {string} filename package path
|
|
331
328
|
* @param {string[]} excludedPaths generated paths omitted from the package snapshot
|
|
332
|
-
* @returns {boolean} whether the path is excluded
|
|
333
329
|
*/
|
|
334
330
|
function isExcludedPackagePath (filename, excludedPaths) {
|
|
335
331
|
return excludedPaths.some(excluded => filename === excluded || filename.startsWith(`${excluded}${path.sep}`))
|
|
@@ -339,7 +335,6 @@ function isExcludedPackagePath (filename, excludedPaths) {
|
|
|
339
335
|
* Resolves an existing path or its nearest existing ancestor through filesystem aliases.
|
|
340
336
|
*
|
|
341
337
|
* @param {string} filename path that may not exist yet
|
|
342
|
-
* @returns {string} physical path
|
|
343
338
|
*/
|
|
344
339
|
function resolvePhysicalPath (filename) {
|
|
345
340
|
const missingSegments = []
|
|
@@ -358,7 +353,6 @@ function resolvePhysicalPath (filename) {
|
|
|
358
353
|
*
|
|
359
354
|
* @param {string} digest supplied approval digest
|
|
360
355
|
* @param {object} input approval inputs
|
|
361
|
-
* @returns {void}
|
|
362
356
|
*/
|
|
363
357
|
function assertApprovalDigest (digest, input) {
|
|
364
358
|
if (!APPROVAL_DIGEST_PATTERN.test(String(digest || ''))) {
|
|
@@ -8,7 +8,6 @@ const MAX_PREFIX_LENGTH = 72
|
|
|
8
8
|
* Maps an arbitrary manifest identifier to a bounded, portable, collision-resistant path segment.
|
|
9
9
|
*
|
|
10
10
|
* @param {string} value original identifier
|
|
11
|
-
* @returns {string} artifact path segment
|
|
12
11
|
*/
|
|
13
12
|
function getArtifactId (value) {
|
|
14
13
|
const source = String(value)
|
|
@@ -35,7 +35,6 @@ function parseBoundedJson (source, options = {}) {
|
|
|
35
35
|
*
|
|
36
36
|
* @param {Buffer} buffer JSON bytes
|
|
37
37
|
* @param {object} limits parser limits
|
|
38
|
-
* @returns {number} aggregate collection entries
|
|
39
38
|
*/
|
|
40
39
|
function scanJson (buffer, limits) {
|
|
41
40
|
const containerTypes = new Uint8Array(limits.maxNestingDepth)
|
|
@@ -388,7 +388,6 @@ async function validateFramework ({ framework, manifest, options, out, packageCh
|
|
|
388
388
|
* Creates a manifest scaffold and prints the bounded next step.
|
|
389
389
|
*
|
|
390
390
|
* @param {object} options CLI options
|
|
391
|
-
* @returns {void}
|
|
392
391
|
*/
|
|
393
392
|
function initializeManifest (options) {
|
|
394
393
|
const manifestPath = path.resolve(options.manifest)
|
|
@@ -423,7 +422,6 @@ function initializeManifest (options) {
|
|
|
423
422
|
*
|
|
424
423
|
* @param {object} manifest loaded manifest
|
|
425
424
|
* @param {object} options CLI options
|
|
426
|
-
* @returns {void}
|
|
427
425
|
*/
|
|
428
426
|
function printPlan (manifest, options) {
|
|
429
427
|
const out = validateOutputPath(manifest, options.out)
|
|
@@ -560,7 +558,6 @@ function getInstalledPackageCheckError (packageCheck) {
|
|
|
560
558
|
* Restores approved execution options from approval.json.
|
|
561
559
|
*
|
|
562
560
|
* @param {object} options parsed options
|
|
563
|
-
* @returns {void}
|
|
564
561
|
*/
|
|
565
562
|
function applyApprovedPlanOptions (options) {
|
|
566
563
|
if (!options.approvedArtifactSha256) throw new Error('--run-approved-plan requires --sha256.')
|
|
@@ -619,7 +616,6 @@ function getApprovalManifest (manifest, targets) {
|
|
|
619
616
|
* @param {object} framework framework entry
|
|
620
617
|
* @param {Set<string>} scenarios selected scenarios
|
|
621
618
|
* @param {object} blocker blocking result
|
|
622
|
-
* @returns {void}
|
|
623
619
|
*/
|
|
624
620
|
function addAdvancedNotReached (results, framework, scenarios, blocker) {
|
|
625
621
|
for (const scenario of getAdvancedScenarios(scenarios)) {
|
|
@@ -648,7 +644,6 @@ function addAdvancedNotReached (results, framework, scenarios, blocker) {
|
|
|
648
644
|
* @param {Set<string>} scenarios selected scenarios
|
|
649
645
|
* @param {string} reasonCode blocker id
|
|
650
646
|
* @param {string} [blockerCategoryOverride] blocker category supplied by a runtime result
|
|
651
|
-
* @returns {void}
|
|
652
647
|
*/
|
|
653
648
|
function addNotReachedLocalResults (results, framework, scenarios, reasonCode, blockerCategoryOverride) {
|
|
654
649
|
const blockerCategory = blockerCategoryOverride || framework.blockerCategory || (
|
|
@@ -675,7 +670,6 @@ function addNotReachedLocalResults (results, framework, scenarios, reasonCode, b
|
|
|
675
670
|
* @param {object[]} results result list
|
|
676
671
|
* @param {object[]} frameworks selected frameworks
|
|
677
672
|
* @param {Set<string>} scenarios selected scenarios
|
|
678
|
-
* @returns {void}
|
|
679
673
|
*/
|
|
680
674
|
function addMissingResults (results, frameworks, scenarios) {
|
|
681
675
|
for (const framework of frameworks) {
|
|
@@ -728,7 +722,6 @@ function normalizeScenarioSelection (scenario) {
|
|
|
728
722
|
* Normalizes a framework target.
|
|
729
723
|
*
|
|
730
724
|
* @param {string} target target value
|
|
731
|
-
* @returns {string} normalized target
|
|
732
725
|
*/
|
|
733
726
|
function normalizeFrameworkTarget (target) {
|
|
734
727
|
const normalized = String(target).trim().replace(/(?<!:):+$/, '')
|
|
@@ -741,7 +734,6 @@ function normalizeFrameworkTarget (target) {
|
|
|
741
734
|
*
|
|
742
735
|
* @param {object} manifest loaded manifest
|
|
743
736
|
* @param {string} outputPath output path
|
|
744
|
-
* @returns {string} absolute output path
|
|
745
737
|
*/
|
|
746
738
|
function validateOutputPath (manifest, outputPath) {
|
|
747
739
|
const root = path.resolve(manifest.repository.root)
|
|
@@ -757,7 +749,6 @@ function validateOutputPath (manifest, outputPath) {
|
|
|
757
749
|
* Prevents incompatible CLI modes.
|
|
758
750
|
*
|
|
759
751
|
* @param {object} options parsed options
|
|
760
|
-
* @returns {void}
|
|
761
752
|
*/
|
|
762
753
|
function assertCompatibleModes (options) {
|
|
763
754
|
if (!options.runApprovedPlan) return
|
|
@@ -772,7 +763,6 @@ function assertCompatibleModes (options) {
|
|
|
772
763
|
* @param {string[]} argv arguments
|
|
773
764
|
* @param {number} index value index
|
|
774
765
|
* @param {string} flag flag name
|
|
775
|
-
* @returns {string} flag value
|
|
776
766
|
*/
|
|
777
767
|
function requireValue (argv, index, flag) {
|
|
778
768
|
if (!argv[index]) throw new Error(`${flag} requires a value.`)
|
|
@@ -782,7 +772,6 @@ function requireValue (argv, index, flag) {
|
|
|
782
772
|
/**
|
|
783
773
|
* Prints CLI help.
|
|
784
774
|
*
|
|
785
|
-
* @returns {void}
|
|
786
775
|
*/
|
|
787
776
|
function printHelp () {
|
|
788
777
|
console.log(`Usage: node ci/validate-test-optimization.js [options]
|
|
@@ -805,7 +794,6 @@ function printHelp () {
|
|
|
805
794
|
* @param {object} framework framework entry
|
|
806
795
|
* @param {string} phase phase name
|
|
807
796
|
* @param {string} status status
|
|
808
|
-
* @returns {void}
|
|
809
797
|
*/
|
|
810
798
|
function logPhase (framework, phase, status) {
|
|
811
799
|
console.log(sanitizeConsoleText(`[test-optimization-validator] ${framework.id}: ${phase}: ${status}`))
|
|
@@ -162,7 +162,6 @@ function assertSafeOutputPath ({ outputPath, repositoryRoot, artifactRoot, comma
|
|
|
162
162
|
*
|
|
163
163
|
* @param {string} outputPath absolute output path
|
|
164
164
|
* @param {string} repositoryRoot absolute repository root
|
|
165
|
-
* @returns {void}
|
|
166
165
|
*/
|
|
167
166
|
function assertPhysicalOutputPathInsideRepository (outputPath, repositoryRoot) {
|
|
168
167
|
const physicalRoot = fs.realpathSync(repositoryRoot)
|
|
@@ -346,7 +346,6 @@ function runCommand (command, options = {}) {
|
|
|
346
346
|
*
|
|
347
347
|
* @param {object} result command result
|
|
348
348
|
* @param {object[]} outputStates prepared command output state
|
|
349
|
-
* @returns {void}
|
|
350
349
|
*/
|
|
351
350
|
function finishCommandOutputCleanup (result, outputStates) {
|
|
352
351
|
result.commandOutputPaths = cleanupCommandOutputs(outputStates)
|
|
@@ -608,7 +607,6 @@ function serializeCommand (command) {
|
|
|
608
607
|
* Renders the command that will actually execute without trusting display-only manifest fields.
|
|
609
608
|
*
|
|
610
609
|
* @param {object} command command to render
|
|
611
|
-
* @returns {string} unambiguous customer-facing command
|
|
612
610
|
*/
|
|
613
611
|
function serializeApprovalCommand (command) {
|
|
614
612
|
return command.argv.map(formatApprovalArgument).join(' ')
|
|
@@ -618,7 +616,6 @@ function serializeApprovalCommand (command) {
|
|
|
618
616
|
* Quotes arguments whose boundaries would otherwise be ambiguous in an approval plan.
|
|
619
617
|
*
|
|
620
618
|
* @param {string} value argument value
|
|
621
|
-
* @returns {string} visible argument
|
|
622
619
|
*/
|
|
623
620
|
function formatApprovalArgument (value) {
|
|
624
621
|
const argument = String(value)
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @param {string} left first variable name
|
|
7
7
|
* @param {string} right second variable name
|
|
8
8
|
* @param {string} [platform] target platform
|
|
9
|
-
* @returns {boolean} whether the names are equivalent
|
|
10
9
|
*/
|
|
11
10
|
function environmentNamesEqual (left, right, platform = process.platform) {
|
|
12
11
|
return platform === 'win32' ? left.toUpperCase() === right.toUpperCase() : left === right
|
|
@@ -45,7 +44,6 @@ function getEnvironmentValue (environment, name, platform = process.platform) {
|
|
|
45
44
|
* @param {string} name canonical variable name
|
|
46
45
|
* @param {string|undefined} value environment value
|
|
47
46
|
* @param {string} [platform] target platform
|
|
48
|
-
* @returns {void}
|
|
49
47
|
*/
|
|
50
48
|
function setEnvironmentValue (environment, name, value, platform = process.platform) {
|
|
51
49
|
for (const candidate of Object.keys(environment)) {
|
|
@@ -60,7 +58,6 @@ function setEnvironmentValue (environment, name, value, platform = process.platf
|
|
|
60
58
|
* @param {Record<string, string|undefined>} target destination environment
|
|
61
59
|
* @param {Record<string, string|undefined>} source overriding entries
|
|
62
60
|
* @param {string} [platform] target platform
|
|
63
|
-
* @returns {void}
|
|
64
61
|
*/
|
|
65
62
|
function mergeEnvironment (target, source, platform = process.platform) {
|
|
66
63
|
if (source) {
|
|
@@ -75,7 +72,6 @@ function mergeEnvironment (target, source, platform = process.platform) {
|
|
|
75
72
|
*
|
|
76
73
|
* @param {string} name variable name
|
|
77
74
|
* @param {string} [platform] target platform
|
|
78
|
-
* @returns {boolean} whether this is a Datadog variable
|
|
79
75
|
*/
|
|
80
76
|
function isDatadogEnvironmentName (name, platform = process.platform) {
|
|
81
77
|
const normalized = platform === 'win32' ? name.toUpperCase() : name
|
|
@@ -7,7 +7,6 @@ const APPROVED_EXECUTABLE = Symbol('approvedValidationExecutable')
|
|
|
7
7
|
*
|
|
8
8
|
* @param {object} command command to bind
|
|
9
9
|
* @param {object} identity approved executable identity
|
|
10
|
-
* @returns {void}
|
|
11
10
|
*/
|
|
12
11
|
function bindApprovedExecutable (command, identity) {
|
|
13
12
|
Object.defineProperty(command, APPROVED_EXECUTABLE, {
|
|
@@ -113,7 +113,6 @@ function getCommandExecutableIdentity (command, repositoryRoot) {
|
|
|
113
113
|
*
|
|
114
114
|
* @param {object} current current identity
|
|
115
115
|
* @param {object} approved approved identity
|
|
116
|
-
* @returns {boolean} exact identity match
|
|
117
116
|
*/
|
|
118
117
|
function areExecutableIdentitiesEqual (current, approved) {
|
|
119
118
|
return current.argv0 === approved.argv0 &&
|
|
@@ -176,7 +175,6 @@ function splitNodeOptions (source) {
|
|
|
176
175
|
*
|
|
177
176
|
* @param {string} value candidate value
|
|
178
177
|
* @param {string} [platform] target platform
|
|
179
|
-
* @returns {boolean} whether the value includes explicit path syntax
|
|
180
178
|
*/
|
|
181
179
|
function isExplicitExecutablePath (value, platform = process.platform) {
|
|
182
180
|
if (typeof value !== 'string') return false
|
|
@@ -188,7 +186,6 @@ function isExplicitExecutablePath (value, platform = process.platform) {
|
|
|
188
186
|
* Returns whether a command has the only executable shape the validator supports.
|
|
189
187
|
*
|
|
190
188
|
* @param {object} command command candidate
|
|
191
|
-
* @returns {boolean} whether it is a direct runner
|
|
192
189
|
*/
|
|
193
190
|
function isDirectRunnerCommand (command) {
|
|
194
191
|
return command?.usesShell === false &&
|
|
@@ -218,7 +215,6 @@ function getFileIdentity (filename) {
|
|
|
218
215
|
* Returns whether a path resolves to a regular file.
|
|
219
216
|
*
|
|
220
217
|
* @param {string} filename candidate path
|
|
221
|
-
* @returns {boolean} whether the file is available
|
|
222
218
|
*/
|
|
223
219
|
function isRegularFile (filename) {
|
|
224
220
|
try {
|
|
@@ -233,7 +229,6 @@ function isRegularFile (filename) {
|
|
|
233
229
|
*
|
|
234
230
|
* @param {string} root root path
|
|
235
231
|
* @param {string} filename candidate path
|
|
236
|
-
* @returns {boolean} whether the path is contained
|
|
237
232
|
*/
|
|
238
233
|
function isPathInside (root, filename) {
|
|
239
234
|
const relative = path.relative(path.resolve(root), path.resolve(filename))
|
|
@@ -86,7 +86,6 @@ const JAVASCRIPT_STRING_ESCAPES = Object.freeze({
|
|
|
86
86
|
* directory would alter project test semantics, so those versions remain a validator limitation.
|
|
87
87
|
*
|
|
88
88
|
* @param {string|null|undefined} version installed Cucumber version
|
|
89
|
-
* @returns {boolean} whether validator-owned config isolation is supported
|
|
90
89
|
*/
|
|
91
90
|
function supportsConfigIsolation (version) {
|
|
92
91
|
const match = /^[v=]?(\d+)(?:\.|$)/.exec(String(version || ''))
|
|
@@ -97,7 +96,6 @@ function supportsConfigIsolation (version) {
|
|
|
97
96
|
* Reports whether a file follows the Cucumber feature convention.
|
|
98
97
|
*
|
|
99
98
|
* @param {string} filename candidate filename
|
|
100
|
-
* @returns {boolean} whether the candidate can be selected by Cucumber
|
|
101
99
|
*/
|
|
102
100
|
function isTestFile (filename) {
|
|
103
101
|
return filename.endsWith('.feature')
|
|
@@ -107,7 +105,6 @@ function isTestFile (filename) {
|
|
|
107
105
|
* Counts statically declared Cucumber scenarios in a feature.
|
|
108
106
|
*
|
|
109
107
|
* @param {string} source feature source
|
|
110
|
-
* @returns {number} declared scenario count
|
|
111
108
|
*/
|
|
112
109
|
function getScenarioCount (source) {
|
|
113
110
|
return [...source.matchAll(/^[ \t]*(?:Example|Scenario(?: Outline| Template)?):[ \t]*\S/gm)].length
|
|
@@ -118,7 +115,6 @@ function getScenarioCount (source) {
|
|
|
118
115
|
*
|
|
119
116
|
* @param {object} input generated source input
|
|
120
117
|
* @param {string} input.testName generated scenario name
|
|
121
|
-
* @returns {string} canonical generated feature source
|
|
122
118
|
*/
|
|
123
119
|
function getGeneratedTestContent ({ testName }) {
|
|
124
120
|
return [
|
|
@@ -132,7 +128,6 @@ function getGeneratedTestContent ({ testName }) {
|
|
|
132
128
|
/**
|
|
133
129
|
* Returns the validator-owned Cucumber step definitions shared by generated scenarios.
|
|
134
130
|
*
|
|
135
|
-
* @returns {string} canonical generated step-definition source
|
|
136
131
|
*/
|
|
137
132
|
function getGeneratedStepsContent () {
|
|
138
133
|
return [
|
|
@@ -154,7 +149,6 @@ function getGeneratedStepsContent () {
|
|
|
154
149
|
* Returns the generated Cucumber step-definition path for a feature directory.
|
|
155
150
|
*
|
|
156
151
|
* @param {string} testDirectory generated feature directory
|
|
157
|
-
* @returns {string} generated step-definition path
|
|
158
152
|
*/
|
|
159
153
|
function getGeneratedStepsPath (testDirectory) {
|
|
160
154
|
return path.join(testDirectory, GENERATED_STEPS_FILENAME)
|
|
@@ -11,7 +11,6 @@ const TEST_FILE_PATTERN = /(?:\.cy\.[cm]?[jt]sx?|\.(?:spec|test)\.[cm]?[jt]sx?)$
|
|
|
11
11
|
* @param {string} filename candidate filename
|
|
12
12
|
* @param {string} directory candidate parent directory
|
|
13
13
|
* @param {string} projectRoot detected project root
|
|
14
|
-
* @returns {boolean} whether the candidate can be selected by Cypress
|
|
15
14
|
*/
|
|
16
15
|
function isTestFile (filename, directory, projectRoot) {
|
|
17
16
|
if (/\.cy\.[cm]?[jt]sx?$/.test(filename)) return true
|
|
@@ -25,7 +24,6 @@ function isTestFile (filename, directory, projectRoot) {
|
|
|
25
24
|
* Returns the complete suffix that a generated Cypress spec must preserve.
|
|
26
25
|
*
|
|
27
26
|
* @param {string} filename representative Cypress spec
|
|
28
|
-
* @returns {string} generated spec suffix
|
|
29
27
|
*/
|
|
30
28
|
function getTestExtension (filename) {
|
|
31
29
|
return TEST_FILE_PATTERN.exec(path.basename(filename))?.[0] || '.cy.js'
|
|
@@ -37,7 +35,6 @@ function getTestExtension (filename) {
|
|
|
37
35
|
* @param {object} input generated source input
|
|
38
36
|
* @param {string} input.scenarioId generated scenario id
|
|
39
37
|
* @param {string} input.testName generated test name
|
|
40
|
-
* @returns {string} canonical generated Cypress source
|
|
41
38
|
*/
|
|
42
39
|
function getGeneratedTestContent ({ scenarioId, testName }) {
|
|
43
40
|
let content = ''
|
|
@@ -14,7 +14,6 @@ const PLAYWRIGHT_PACKAGE = '@playwright/test'
|
|
|
14
14
|
* @param {string} filename candidate filename
|
|
15
15
|
* @param {string} directory candidate parent directory
|
|
16
16
|
* @param {string} projectRoot detected project root
|
|
17
|
-
* @returns {boolean} whether the candidate can be selected by Playwright Test
|
|
18
17
|
*/
|
|
19
18
|
function isTestFile (filename, directory, projectRoot) {
|
|
20
19
|
if (!TEST_FILE_PATTERN.test(filename)) return false
|
|
@@ -26,7 +25,6 @@ function isTestFile (filename, directory, projectRoot) {
|
|
|
26
25
|
* Returns the complete suffix that a generated Playwright spec must preserve.
|
|
27
26
|
*
|
|
28
27
|
* @param {string} filename representative Playwright spec
|
|
29
|
-
* @returns {string} generated spec suffix
|
|
30
28
|
*/
|
|
31
29
|
function getTestExtension (filename) {
|
|
32
30
|
return TEST_FILE_PATTERN.exec(path.basename(filename))?.[0] || '.spec.js'
|
|
@@ -39,7 +37,6 @@ function getTestExtension (filename) {
|
|
|
39
37
|
* @param {string} input.moduleSystem generated module system
|
|
40
38
|
* @param {string} input.scenarioId generated scenario id
|
|
41
39
|
* @param {string} input.testName generated test name
|
|
42
|
-
* @returns {string} canonical generated Playwright source
|
|
43
40
|
*/
|
|
44
41
|
function getGeneratedTestContent ({ moduleSystem, scenarioId, testName }) {
|
|
45
42
|
const assertion = scenarioId === 'atr-fail-once'
|
|
@@ -60,7 +57,6 @@ function getGeneratedTestContent ({ moduleSystem, scenarioId, testName }) {
|
|
|
60
57
|
/**
|
|
61
58
|
* Returns the isolated Playwright config shared by generated validation tests.
|
|
62
59
|
*
|
|
63
|
-
* @returns {string} canonical generated Playwright config
|
|
64
60
|
*/
|
|
65
61
|
function getGeneratedConfigContent () {
|
|
66
62
|
return [
|
|
@@ -81,7 +77,6 @@ function getGeneratedConfigContent () {
|
|
|
81
77
|
* Returns the generated Playwright config path for a test directory.
|
|
82
78
|
*
|
|
83
79
|
* @param {string} testDirectory generated test directory
|
|
84
|
-
* @returns {string} generated config path
|
|
85
80
|
*/
|
|
86
81
|
function getGeneratedConfigPath (testDirectory) {
|
|
87
82
|
return path.join(testDirectory, GENERATED_CONFIG_FILENAME)
|
|
@@ -125,7 +120,6 @@ function getGeneratedTestArgs (filename, configFile) {
|
|
|
125
120
|
* Returns the validator-owned Playwright output directory for a selected spec.
|
|
126
121
|
*
|
|
127
122
|
* @param {string} filename selected or generated Playwright spec
|
|
128
|
-
* @returns {string} absolute output directory
|
|
129
123
|
*/
|
|
130
124
|
function getOutputPath (filename) {
|
|
131
125
|
return path.join(path.dirname(filename), VALIDATION_OUTPUT_DIRECTORY)
|
|
@@ -208,7 +208,6 @@ function getProjectObject (source, nameIndex, workspaceConfig) {
|
|
|
208
208
|
*
|
|
209
209
|
* @param {string} source Vitest configuration source
|
|
210
210
|
* @param {{end: number, start: number}} range candidate object range
|
|
211
|
-
* @returns {boolean} whether the object is a standalone project
|
|
212
211
|
*/
|
|
213
212
|
function isStandaloneProjectObject (source, range) {
|
|
214
213
|
const before = maskJavaScriptNonCode(source.slice(0, range.start))
|
|
@@ -222,7 +221,6 @@ function isStandaloneProjectObject (source, range) {
|
|
|
222
221
|
* @param {string} source Vitest configuration source
|
|
223
222
|
* @param {{end: number, start: number}} range candidate object range
|
|
224
223
|
* @param {{end: number, start: number}[]} objectRanges source object ranges
|
|
225
|
-
* @returns {boolean} whether the object is a bounded project entry
|
|
226
224
|
*/
|
|
227
225
|
function isTestProjectsEntry (source, range, objectRanges) {
|
|
228
226
|
const projectsArray = getDirectContainingArray(source, range)
|
|
@@ -253,7 +251,6 @@ function isTestProjectsEntry (source, range, objectRanges) {
|
|
|
253
251
|
*
|
|
254
252
|
* @param {string} source Vitest configuration source
|
|
255
253
|
* @param {{end: number, start: number}} range candidate config object range
|
|
256
|
-
* @returns {boolean} whether the object belongs to the exported configuration
|
|
257
254
|
*/
|
|
258
255
|
function isExportedConfigObject (source, range) {
|
|
259
256
|
const before = maskJavaScriptNonCode(source.slice(0, range.start))
|
|
@@ -267,7 +264,6 @@ function isExportedConfigObject (source, range) {
|
|
|
267
264
|
*
|
|
268
265
|
* @param {string} source Vitest workspace configuration source
|
|
269
266
|
* @param {{end: number, start: number}} range candidate object range
|
|
270
|
-
* @returns {boolean} whether the object is a bounded workspace project entry
|
|
271
267
|
*/
|
|
272
268
|
function isWorkspaceProjectEntry (source, range) {
|
|
273
269
|
const workspaceArray = getDirectContainingArray(source, range)
|
|
@@ -32,7 +32,6 @@ const GENERATED_SCENARIOS = {
|
|
|
32
32
|
*
|
|
33
33
|
* @param {string} framework test framework
|
|
34
34
|
* @param {string} filename generated ATR test file
|
|
35
|
-
* @returns {string} retry-state path
|
|
36
35
|
*/
|
|
37
36
|
function getGeneratedRetryStatePath (framework, filename) {
|
|
38
37
|
const namespace = `dd-test-optimization-validation-${framework}-`
|
|
@@ -52,7 +51,6 @@ function getGeneratedRetryStatePath (framework, filename) {
|
|
|
52
51
|
* @param {string} input.moduleSystem generated module system
|
|
53
52
|
* @param {string} input.scenarioId generated scenario id
|
|
54
53
|
* @param {string} [input.stateFile] persistent ATR state file
|
|
55
|
-
* @returns {string} canonical generated source
|
|
56
54
|
*/
|
|
57
55
|
function getGeneratedTestContent ({ framework, moduleSystem, scenarioId, stateFile }) {
|
|
58
56
|
const scenario = GENERATED_SCENARIOS[scenarioId]
|
|
@@ -232,7 +230,6 @@ function getGeneratedTestContractError (framework) {
|
|
|
232
230
|
* Describes adapter-specific files in generated-contract errors.
|
|
233
231
|
*
|
|
234
232
|
* @param {string} framework framework name
|
|
235
|
-
* @returns {string} additional file description
|
|
236
233
|
*/
|
|
237
234
|
function getAdditionalGeneratedFileDescription (framework) {
|
|
238
235
|
if (framework === 'cucumber') return ' plus isolated Cucumber step definitions'
|
|
@@ -245,7 +242,6 @@ function getAdditionalGeneratedFileDescription (framework) {
|
|
|
245
242
|
*
|
|
246
243
|
* @param {string} root project root
|
|
247
244
|
* @param {string} filename generated path
|
|
248
|
-
* @returns {boolean} whether the path is contained
|
|
249
245
|
*/
|
|
250
246
|
function isPathInside (root, filename) {
|
|
251
247
|
const relative = path.relative(path.resolve(root), path.resolve(filename))
|
|
@@ -259,7 +255,6 @@ function isPathInside (root, filename) {
|
|
|
259
255
|
* @param {string} input.moduleSystem generated module system
|
|
260
256
|
* @param {string} input.assertion passing assertion
|
|
261
257
|
* @param {string} input.stateFile persistent ATR state file
|
|
262
|
-
* @returns {string} retry test body
|
|
263
258
|
*/
|
|
264
259
|
function getAtrBody ({ moduleSystem, assertion, stateFile }) {
|
|
265
260
|
if (typeof stateFile !== 'string' || !path.isAbsolute(stateFile)) {
|
|
@@ -227,7 +227,6 @@ function getGeneratedRuntimeFileStatus (strategy) {
|
|
|
227
227
|
* Formats a parsed test count for a customer-facing diagnosis.
|
|
228
228
|
*
|
|
229
229
|
* @param {number|null} count observed test count
|
|
230
|
-
* @returns {string} formatted count
|
|
231
230
|
*/
|
|
232
231
|
function formatObservedCount (count) {
|
|
233
232
|
return count === null ? 'an unknown test count' : `${count} observed tests`
|