dd-trace 6.24.0 → 6.26.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/README.md +3 -0
- package/ci/cypress/support.js +2 -1
- package/ci/init.js +2 -22
- package/ci/vitest-no-worker-init-node-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-runner-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-setup.mjs +729 -724
- package/ci/vitest-no-worker-init-v5-setup.mjs +2 -1
- package/ext/exporters.js +0 -1
- package/index.d.ts +105 -5
- package/initialize.mjs +5 -2
- package/package.json +41 -36
- package/packages/datadog-esbuild/index.js +16 -70
- package/packages/datadog-esbuild/src/log.js +2 -29
- package/packages/datadog-instrumentations/src/ai.js +6 -1
- package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
- package/packages/datadog-instrumentations/src/cucumber.js +5 -2
- package/packages/datadog-instrumentations/src/cypress-config.js +20 -9
- package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
- package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
- package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
- package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
- package/packages/datadog-instrumentations/src/graphql.js +20 -17
- package/packages/datadog-instrumentations/src/helpers/bundler-esm-exports.js +582 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-log.js +38 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +576 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
- package/packages/datadog-instrumentations/src/helpers/fetch.js +51 -6
- package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -7
- package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +26 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-client.js +30 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-server.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +61 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +33 -4
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +80 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +23 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +122 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
- package/packages/datadog-instrumentations/src/ioredis.js +101 -3
- package/packages/datadog-instrumentations/src/microgateway-core.js +1 -2
- package/packages/datadog-instrumentations/src/modelcontextprotocol-client.js +21 -0
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +7 -1
- package/packages/datadog-instrumentations/src/modelcontextprotocol-server.js +41 -0
- package/packages/datadog-instrumentations/src/next.js +203 -26
- package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
- package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
- package/packages/datadog-instrumentations/src/router.js +35 -12
- package/packages/datadog-instrumentations/src/vitest-main.js +10 -2
- package/packages/datadog-instrumentations/src/webdriverio.js +12 -12
- package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
- package/packages/datadog-plugin-aws-lambda/src/arn.js +41 -0
- package/packages/datadog-plugin-aws-lambda/src/event-type-guards.js +170 -0
- package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
- package/packages/datadog-plugin-aws-lambda/src/trigger.js +339 -0
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +32 -10
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +10 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +4 -0
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +3 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +50 -13
- package/packages/datadog-plugin-cypress/src/support.mjs +1353 -0
- package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
- package/packages/datadog-plugin-express/src/code_origin.js +2 -2
- package/packages/datadog-plugin-fastify/src/code_origin.js +2 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +20 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +21 -52
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +11 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
- package/packages/datadog-plugin-google-cloud-pubsub/src/resource-names.js +24 -0
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +1 -0
- package/packages/datadog-plugin-http/src/client.js +34 -10
- package/packages/datadog-plugin-http2/src/client.js +40 -14
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +28 -2
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +1 -0
- package/packages/datadog-plugin-mongodb-core/src/query.js +17 -1
- package/packages/datadog-plugin-next/src/index.js +112 -14
- package/packages/datadog-plugin-postgres/src/index.js +118 -41
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +18 -8
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +49 -13
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +34 -9
- package/packages/datadog-plugin-trpc/src/index.js +15 -0
- package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
- package/packages/datadog-plugin-trpc/src/request.js +81 -0
- package/packages/datadog-plugin-undici/src/index.js +22 -7
- package/packages/datadog-plugin-vitest/src/index.js +3 -2
- package/packages/datadog-plugin-ws/src/close.js +3 -5
- package/packages/datadog-plugin-ws/src/producer.js +1 -4
- package/packages/datadog-plugin-ws/src/receiver.js +3 -5
- package/packages/datadog-plugin-ws/src/server.js +44 -13
- package/packages/datadog-turbopack/index.js +4 -28
- package/packages/datadog-turbopack/src/loader.js +14 -452
- package/packages/datadog-vite/index.js +537 -0
- package/packages/datadog-vite/src/log.js +5 -0
- package/packages/datadog-webpack/index.js +3 -55
- package/packages/datadog-webpack/src/log.js +2 -29
- package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
- package/packages/dd-trace/src/aiguard/index.js +1 -1
- package/packages/dd-trace/src/aiguard/integrations/index.js +6 -5
- package/packages/dd-trace/src/aiguard/sdk.js +8 -2
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/blocking/index.js +21 -1
- package/packages/dd-trace/src/appsec/channels.js +7 -0
- package/packages/dd-trace/src/appsec/downstream_requests.js +105 -0
- package/packages/dd-trace/src/appsec/graphql.js +89 -7
- package/packages/dd-trace/src/appsec/handlers/auth.js +1 -3
- package/packages/dd-trace/src/appsec/handlers/http-request.js +60 -65
- package/packages/dd-trace/src/appsec/handlers/http-response.js +61 -7
- package/packages/dd-trace/src/appsec/handlers/payments.js +23 -27
- package/packages/dd-trace/src/appsec/index.js +6 -0
- package/packages/dd-trace/src/appsec/lambda.js +17 -17
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -4
- package/packages/dd-trace/src/appsec/rasp/index.js +8 -1
- package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -2
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +7 -17
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +80 -16
- package/packages/dd-trace/src/appsec/rasp/utils.js +33 -3
- package/packages/dd-trace/src/appsec/recommended.json +1358 -94
- package/packages/dd-trace/src/appsec/reporter.js +9 -0
- package/packages/dd-trace/src/appsec/sdk/set_user.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +4 -4
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -1
- package/packages/dd-trace/src/appsec/user_tracking.js +6 -8
- package/packages/dd-trace/src/appsec/waf/index.js +65 -6
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +33 -38
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +18 -2
- package/packages/dd-trace/src/before-exit.js +32 -0
- package/packages/dd-trace/src/bootstrap.js +5 -3
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +15 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +12 -34
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +1 -2
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +1 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
- package/packages/dd-trace/src/config/config-types.d.ts +3 -0
- package/packages/dd-trace/src/config/defaults.js +5 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +46 -4
- package/packages/dd-trace/src/config/index.js +63 -31
- package/packages/dd-trace/src/config/parsers.js +44 -0
- package/packages/dd-trace/src/config/remote-config-layers.js +38 -0
- package/packages/dd-trace/src/config/remote_config.js +2 -1
- package/packages/dd-trace/src/config/supported-configurations.json +172 -10
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/datastreams/fnv.js +27 -0
- package/packages/dd-trace/src/datastreams/pathway.js +113 -28
- package/packages/dd-trace/src/datastreams/processor.js +5 -4
- package/packages/dd-trace/src/debugger/config.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/request-options.js +7 -9
- package/packages/dd-trace/src/debugger/devtools_client/send.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/tags.js +1 -1
- package/packages/dd-trace/src/debugger/index.js +2 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +3 -2
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +6 -2
- package/packages/dd-trace/src/debugger/probe_sampler.js +39 -17
- package/packages/dd-trace/src/debugger/unsupported-runtime.js +2 -0
- package/packages/dd-trace/src/exporter.js +0 -11
- package/packages/dd-trace/src/exporters/common/request.js +81 -48
- package/packages/dd-trace/src/exporters/common/retry.js +12 -7
- package/packages/dd-trace/src/exporters/common/url.js +1 -1
- package/packages/dd-trace/src/git_metadata.js +2 -1
- package/packages/dd-trace/src/id.js +1 -1
- package/packages/dd-trace/src/index.js +6 -3
- package/packages/dd-trace/src/lambda/facade.js +75 -0
- package/packages/dd-trace/src/lambda/handler.js +3 -41
- package/packages/dd-trace/src/lambda/index.js +38 -15
- package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
- package/packages/dd-trace/src/lambda/wrap.js +44 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +2 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
- package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +19 -6
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +54 -3
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +81 -1
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
- package/packages/dd-trace/src/llmobs/sdk.js +19 -0
- package/packages/dd-trace/src/llmobs/span_processor.js +9 -0
- package/packages/dd-trace/src/llmobs/tagger.js +22 -0
- package/packages/dd-trace/src/log/channels.js +4 -0
- package/packages/dd-trace/src/log/writer.js +6 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +7 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +55 -27
- package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +19 -1
- package/packages/dd-trace/src/openfeature/writers/base.js +1 -3
- package/packages/dd-trace/src/opentelemetry/logs/index.js +11 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
- package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
- package/packages/dd-trace/src/opentelemetry/span.js +2 -2
- package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
- package/packages/dd-trace/src/opentracing/tracer.js +24 -0
- package/packages/dd-trace/src/otel-thread-ctx.js +28 -31
- package/packages/dd-trace/src/plugin_manager.js +34 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +143 -17
- package/packages/dd-trace/src/plugins/index.js +8 -0
- package/packages/dd-trace/src/plugins/plugin.js +4 -2
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +52 -1
- package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
- package/packages/dd-trace/src/plugins/util/git.js +263 -82
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +80 -56
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
- package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
- package/packages/dd-trace/src/plugins/util/tags.js +6 -0
- package/packages/dd-trace/src/plugins/util/test.js +92 -40
- package/packages/dd-trace/src/plugins/util/url.js +18 -7
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +6 -6
- package/packages/dd-trace/src/plugins/util/web.js +65 -10
- package/packages/dd-trace/src/process-tags/index.js +1 -1
- package/packages/dd-trace/src/profiler.js +74 -12
- package/packages/dd-trace/src/profiling/profiler.js +30 -2
- package/packages/dd-trace/src/profiling/profilers/space.js +3 -1
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/profiling/remote-config.js +354 -0
- package/packages/dd-trace/src/profiling/runtime-capabilities.js +11 -0
- package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
- package/packages/dd-trace/src/propagation-hash/index.js +7 -0
- package/packages/dd-trace/src/proxy.js +46 -54
- package/packages/dd-trace/src/span_processor.js +20 -0
- package/packages/dd-trace/src/startup-log.js +8 -6
- package/packages/dd-trace/src/telemetry/metrics.js +2 -1
- package/packages/dd-trace/src/tracer.js +0 -2
- package/packages/dd-trace/src/web-tags-cache.js +8 -9
- package/register.js +2 -1
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
- package/vendor/dist/@datadog/flagging-core/LICENSE +221 -0
- package/vendor/dist/@datadog/flagging-core/index.js +1 -0
- package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
- package/vendor/dist/@datadog/sketches-js/LICENSE +263 -0
- package/vendor/dist/@datadog/source-map/LICENSE +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +220 -1
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
- package/vendor/dist/escape-string-regexp/LICENSE +13 -0
- package/vendor/dist/esquery/LICENSE +2 -0
- package/vendor/dist/https-proxy-agent/LICENSE +80 -1
- package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
- package/vendor/dist/jest-docblock/LICENSE +16 -0
- package/vendor/dist/jsonpath-plus/LICENSE +13 -0
- package/vendor/dist/limiter/LICENSE +2 -0
- package/vendor/dist/lodash.sortby/LICENSE +2 -0
- package/vendor/dist/lru-cache/LICENSE +13 -0
- package/vendor/dist/meriyah/LICENSE +13 -0
- package/vendor/dist/module-details-from-path/LICENSE +2 -0
- package/vendor/dist/mutexify/promise/LICENSE +28 -0
- package/vendor/dist/pprof-format/LICENSE +13 -0
- package/vendor/dist/pprof-format/index.js +1 -1
- package/vendor/dist/protobufjs/LICENSE +219 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
- package/vendor/dist/proxy-from-env/LICENSE +13 -0
- package/vendor/dist/retry/LICENSE +2 -0
- package/vendor/dist/rfdc/LICENSE +2 -0
- package/vendor/dist/semifies/LICENSE +3 -1
- package/vendor/dist/shell-quote/LICENSE +3 -1
- package/vendor/dist/source-map/LICENSE +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +1 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
- package/vendor/dist/ttl-set/LICENSE +28 -0
- package/vite.d.ts +7 -0
- package/vite.js +3 -0
- package/ci/diagnose.js +0 -2215
- package/ci/runbook.md +0 -299
- package/ci/test-optimization-validation/approval-artifacts.js +0 -175
- package/ci/test-optimization-validation/approval.js +0 -386
- package/ci/test-optimization-validation/artifact-id.js +0 -18
- package/ci/test-optimization-validation/blocker-category.js +0 -24
- package/ci/test-optimization-validation/bounded-json.js +0 -120
- package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
- package/ci/test-optimization-validation/ci-discovery.js +0 -192
- package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
- package/ci/test-optimization-validation/ci-remediation.js +0 -283
- package/ci/test-optimization-validation/cli.js +0 -954
- package/ci/test-optimization-validation/command-blocker.js +0 -377
- package/ci/test-optimization-validation/command-output-policy.js +0 -188
- package/ci/test-optimization-validation/command-runner.js +0 -649
- package/ci/test-optimization-validation/environment.js +0 -88
- package/ci/test-optimization-validation/executable-approval.js +0 -47
- package/ci/test-optimization-validation/executable.js +0 -244
- package/ci/test-optimization-validation/execution-lock.js +0 -70
- package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
- package/ci/test-optimization-validation/generated-file-policy.js +0 -63
- package/ci/test-optimization-validation/generated-files.js +0 -425
- package/ci/test-optimization-validation/generated-test-contract.js +0 -284
- package/ci/test-optimization-validation/generated-verifier.js +0 -235
- package/ci/test-optimization-validation/literal-environment.js +0 -56
- package/ci/test-optimization-validation/literal-glob.js +0 -52
- package/ci/test-optimization-validation/manifest-loader.js +0 -116
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
- package/ci/test-optimization-validation/manifest-schema.js +0 -695
- package/ci/test-optimization-validation/offline-fixtures.js +0 -335
- package/ci/test-optimization-validation/offline-output.js +0 -406
- package/ci/test-optimization-validation/package-check.js +0 -97
- package/ci/test-optimization-validation/payload-normalizer.js +0 -72
- package/ci/test-optimization-validation/plan-writer.js +0 -541
- package/ci/test-optimization-validation/preflight-runner.js +0 -186
- package/ci/test-optimization-validation/project-build-artifact.js +0 -31
- package/ci/test-optimization-validation/redaction.js +0 -319
- package/ci/test-optimization-validation/report-writer.js +0 -666
- package/ci/test-optimization-validation/result-semantics.js +0 -103
- package/ci/test-optimization-validation/runner-command.js +0 -264
- package/ci/test-optimization-validation/runner-contract.js +0 -695
- package/ci/test-optimization-validation/safe-files.js +0 -202
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
- package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
- package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
- package/ci/test-optimization-validation/source-text.js +0 -84
- package/ci/test-optimization-validation/static-diagnosis.js +0 -166
- package/ci/test-optimization-validation/test-output.js +0 -120
- package/ci/test-optimization-validation/validation-blocker.js +0 -21
- package/ci/validate-test-optimization.js +0 -3
- package/packages/datadog-esbuild/src/resolver.js +0 -284
- package/packages/datadog-esbuild/src/utils.js +0 -318
- package/packages/datadog-plugin-cypress/src/support.js +0 -1348
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -156
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -287
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +0 -84
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -368
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +0 -59
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { BLOCKER_CATEGORIES, getBlockerDomain } = require('./blocker-category')
|
|
4
|
-
|
|
5
|
-
function annotateResults (results) {
|
|
6
|
-
return results.map(result => ({
|
|
7
|
-
...result,
|
|
8
|
-
blockerCategory: result.evidence?.blockerCategory,
|
|
9
|
-
conclusion: result.evidence?.conclusion || getConclusion(result),
|
|
10
|
-
domain: result.evidence?.domain || getDomain(result),
|
|
11
|
-
evidenceStrength: result.evidence?.evidenceStrength || getEvidenceStrength(result),
|
|
12
|
-
}))
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getExecutionStatus (results) {
|
|
16
|
-
if (results.some(isValidatorError)) return 'validator_error'
|
|
17
|
-
|
|
18
|
-
const conclusionResults = results.filter(result => {
|
|
19
|
-
const runLevelDomains = [
|
|
20
|
-
'execution_environment',
|
|
21
|
-
'local_runtime',
|
|
22
|
-
'project_setup',
|
|
23
|
-
'unsupported_version',
|
|
24
|
-
'validator_adapter',
|
|
25
|
-
]
|
|
26
|
-
return result.scenario !== 'all' || runLevelDomains.includes(result.domain)
|
|
27
|
-
})
|
|
28
|
-
const allIncomplete = conclusionResults.length > 0 && conclusionResults.every(result => {
|
|
29
|
-
return result.domain === 'execution_environment' || ['not_checked', 'incomplete'].includes(result.conclusion)
|
|
30
|
-
})
|
|
31
|
-
if (!allIncomplete) return 'completed'
|
|
32
|
-
const categories = new Set(conclusionResults.map(result => result.blockerCategory).filter(Boolean))
|
|
33
|
-
if (categories.has(BLOCKER_CATEGORIES.EXECUTION_ENVIRONMENT_BLOCKED)) return 'execution_environment_blocked'
|
|
34
|
-
if (categories.has(BLOCKER_CATEGORIES.PROJECT_SETUP_REQUIRED)) return 'project_setup_required'
|
|
35
|
-
if (categories.has(BLOCKER_CATEGORIES.UNSUPPORTED_VERSION)) return 'unsupported_version'
|
|
36
|
-
if (categories.has(BLOCKER_CATEGORIES.VALIDATOR_LIMITATION)) return 'validator_limitation'
|
|
37
|
-
if (categories.has(BLOCKER_CATEGORIES.CLEAN_TEST_FAILED)) return 'clean_test_failed'
|
|
38
|
-
if (conclusionResults.some(result => ['execution_environment', 'local_runtime'].includes(result.domain))) {
|
|
39
|
-
return 'execution_environment_blocked'
|
|
40
|
-
}
|
|
41
|
-
if (conclusionResults.some(result => result.domain === 'project_setup')) return 'project_setup_required'
|
|
42
|
-
return 'incomplete'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getValidatorExitCode (results, executionStatus) {
|
|
46
|
-
if (executionStatus === 'validator_error') return 3
|
|
47
|
-
if (results.some(result => result.status === 'fail' && result.evidenceStrength.startsWith('confirmed_'))) return 1
|
|
48
|
-
const incomplete = results.some(result => {
|
|
49
|
-
return ['configured_propagation_unverified', 'incomplete', 'not_checked'].includes(result.conclusion)
|
|
50
|
-
})
|
|
51
|
-
if (executionStatus !== 'completed' || incomplete || !results.some(result => result.scenario !== 'all')) return 2
|
|
52
|
-
return 0
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function getValidationCoverage (results) {
|
|
56
|
-
return results.some(result => result.conclusion === 'not_checked' ||
|
|
57
|
-
result.evidence?.validationIncomplete ||
|
|
58
|
-
result.evidence?.manifestIncomplete)
|
|
59
|
-
? 'partial'
|
|
60
|
-
: 'complete'
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function getConclusion (result) {
|
|
64
|
-
if (result.evidence?.validationIncomplete || result.evidence?.manifestIncomplete) return 'incomplete'
|
|
65
|
-
if (result.status === 'pass') return 'confirmed_working'
|
|
66
|
-
if (result.status === 'fail') {
|
|
67
|
-
return result.scenario === 'ci-wiring' ? 'confirmed_misconfigured' : 'confirmed_not_working'
|
|
68
|
-
}
|
|
69
|
-
if (result.status === 'skip') {
|
|
70
|
-
return result.evidence?.featureEligibility?.eligible === false ? 'not_checked' : 'not_eligible'
|
|
71
|
-
}
|
|
72
|
-
return 'incomplete'
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function getDomain (result) {
|
|
76
|
-
const blockerDomain = getBlockerDomain(result.evidence?.blockerCategory)
|
|
77
|
-
if (blockerDomain) return blockerDomain
|
|
78
|
-
if (result.evidence?.blockedByProjectSetup) return 'project_setup'
|
|
79
|
-
if (result.evidence?.localRuntimeBlocked) return 'local_runtime'
|
|
80
|
-
if (result.evidence?.blockedByExecutionEnvironment) return 'execution_environment'
|
|
81
|
-
if (result.scenario === 'ci-wiring') return 'ci_configuration'
|
|
82
|
-
if (result.evidence?.staticDiagnosis) return 'project_setup'
|
|
83
|
-
if (result.status === 'blocked') return 'execution_environment'
|
|
84
|
-
if (result.evidence?.validatorAdapterUnavailable || result.evidence?.manifestIncomplete ||
|
|
85
|
-
result.frameworkId === 'validator' || result.frameworkId === 'validation-cleanup') return 'validator_adapter'
|
|
86
|
-
return 'test_optimization'
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function getEvidenceStrength (result) {
|
|
90
|
-
if (result.status === 'pass' || result.status === 'fail') {
|
|
91
|
-
return result.evidence?.staticDiagnosis ? 'confirmed_static' : 'confirmed_runtime'
|
|
92
|
-
}
|
|
93
|
-
if (result.status === 'blocked') return 'confirmed_runtime'
|
|
94
|
-
return result.evidence?.staticDiagnosis ? 'inferred_static' : 'unknown'
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function isValidatorError (result) {
|
|
98
|
-
return result.evidence?.validationOrchestrationFailed === true ||
|
|
99
|
-
result.frameworkId === 'validator' ||
|
|
100
|
-
result.frameworkId === 'validation-cleanup'
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
module.exports = { annotateResults, getExecutionStatus, getValidationCoverage, getValidatorExitCode }
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs')
|
|
4
|
-
const path = require('node:path')
|
|
5
|
-
|
|
6
|
-
const cucumber = require('./framework-adapters/cucumber')
|
|
7
|
-
const cypress = require('./framework-adapters/cypress')
|
|
8
|
-
const playwright = require('./framework-adapters/playwright')
|
|
9
|
-
const { inheritApprovedExecutable } = require('./executable-approval')
|
|
10
|
-
|
|
11
|
-
const DEFAULT_TIMEOUT_MS = 180_000
|
|
12
|
-
const BROWSER_TIMEOUT_MS = 300_000
|
|
13
|
-
const GENERATED_SCENARIO_BY_FEATURE = {
|
|
14
|
-
atr: 'atr-fail-once',
|
|
15
|
-
efd: 'basic-pass',
|
|
16
|
-
'test-management': 'test-management-target',
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Builds the validator-owned direct command for an existing representative test.
|
|
21
|
-
*
|
|
22
|
-
* @param {object} framework normalized framework manifest entry
|
|
23
|
-
* @param {string} [testFile] selected representative test
|
|
24
|
-
* @returns {object} structured direct-runner command
|
|
25
|
-
*/
|
|
26
|
-
function getBasicCommand (framework, testFile = framework.validation.testFile) {
|
|
27
|
-
return buildCommand(framework, testFile, false)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Builds the validator-owned direct command for a generated scenario.
|
|
32
|
-
*
|
|
33
|
-
* @param {object} framework normalized framework manifest entry
|
|
34
|
-
* @param {object} scenario generated scenario
|
|
35
|
-
* @returns {object} structured direct-runner command
|
|
36
|
-
*/
|
|
37
|
-
function getGeneratedCommand (framework, scenario) {
|
|
38
|
-
return buildCommand(framework, scenario.testIdentities[0].file, true)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Returns every command the approval permits for one framework.
|
|
43
|
-
*
|
|
44
|
-
* @param {object} framework normalized framework manifest entry
|
|
45
|
-
* @param {string|null} [requestedScenario] selected validator scenario
|
|
46
|
-
* @returns {Array<[string, object]>} labeled direct-runner commands
|
|
47
|
-
*/
|
|
48
|
-
function getFrameworkCommands (framework, requestedScenario = null) {
|
|
49
|
-
if (framework.status !== 'runnable' || requestedScenario === 'ci-wiring') return []
|
|
50
|
-
|
|
51
|
-
const commands = [['basic-reporting', getBasicCommand(framework)]]
|
|
52
|
-
const fallbackTests = framework.validation.fallbackTests
|
|
53
|
-
if (fallbackTests) {
|
|
54
|
-
for (const [index, fallback] of fallbackTests.entries()) {
|
|
55
|
-
commands.push([`basic-reporting:fallback-${index + 1}`, getBasicCommand(framework, fallback.testFile)])
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const scenarios = framework.generatedTestStrategy?.scenarios
|
|
59
|
-
if (scenarios) {
|
|
60
|
-
for (const scenario of scenarios) {
|
|
61
|
-
if (!shouldIncludeGeneratedScenario(scenario.id, requestedScenario)) continue
|
|
62
|
-
commands.push([`generated:${scenario.id}`, getGeneratedCommand(framework, scenario)])
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return commands
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Returns every command covered by a validation manifest.
|
|
70
|
-
*
|
|
71
|
-
* @param {object} manifest normalized validation manifest
|
|
72
|
-
* @param {string|null} [requestedScenario] selected validator scenario
|
|
73
|
-
* @returns {Array<[string, object]>} labeled direct-runner commands
|
|
74
|
-
*/
|
|
75
|
-
function getManifestCommands (manifest, requestedScenario = null) {
|
|
76
|
-
const commands = []
|
|
77
|
-
if (manifest.frameworks) {
|
|
78
|
-
for (const framework of manifest.frameworks) {
|
|
79
|
-
for (const [label, command] of getFrameworkCommands(framework, requestedScenario)) {
|
|
80
|
-
commands.push([`${framework.id}:${label}`, command])
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return commands
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Returns existing project files that affect direct validation.
|
|
89
|
-
*
|
|
90
|
-
* @param {object} manifest normalized validation manifest
|
|
91
|
-
* @param {object} [options] file selection options
|
|
92
|
-
* @param {boolean} [options.includeLocal] include local runner inputs
|
|
93
|
-
* @returns {string[]} sorted unique absolute paths
|
|
94
|
-
*/
|
|
95
|
-
function getManifestInputFiles (manifest, { includeLocal = true } = {}) {
|
|
96
|
-
const files = new Set()
|
|
97
|
-
if (manifest.frameworks) {
|
|
98
|
-
for (const framework of manifest.frameworks) {
|
|
99
|
-
addExistingFile(files, framework.ciWiring?.configFile)
|
|
100
|
-
addExistingFile(files, framework.project?.packageJson)
|
|
101
|
-
if (!includeLocal || framework.status !== 'runnable') continue
|
|
102
|
-
addExistingFile(files, framework.validation?.runner)
|
|
103
|
-
addExistingFile(files, framework.validation?.testFile)
|
|
104
|
-
const fallbackTests = framework.validation?.fallbackTests
|
|
105
|
-
if (fallbackTests) {
|
|
106
|
-
for (const fallback of fallbackTests) addExistingFile(files, fallback.testFile)
|
|
107
|
-
}
|
|
108
|
-
const configFiles = framework.project?.configFiles
|
|
109
|
-
if (configFiles) {
|
|
110
|
-
for (const filename of configFiles) addExistingFile(files, filename)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return [...files].sort()
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Returns whether a generated scenario can execute for the selected feature.
|
|
119
|
-
*
|
|
120
|
-
* @param {string} scenarioId generated scenario id
|
|
121
|
-
* @param {string|null} requestedScenario selected validator scenario
|
|
122
|
-
*/
|
|
123
|
-
function shouldIncludeGeneratedScenario (scenarioId, requestedScenario) {
|
|
124
|
-
if (!requestedScenario) return true
|
|
125
|
-
return GENERATED_SCENARIO_BY_FEATURE[requestedScenario] === scenarioId
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Builds one direct Node.js runner invocation.
|
|
130
|
-
*
|
|
131
|
-
* @param {object} framework normalized framework manifest entry
|
|
132
|
-
* @param {string} testFile selected existing or generated test file
|
|
133
|
-
* @param {boolean} generated whether this is a validator-owned generated test
|
|
134
|
-
* @returns {object} structured command
|
|
135
|
-
*/
|
|
136
|
-
function buildCommand (framework, testFile, generated) {
|
|
137
|
-
const { runner, requiredEnvVars = [], timeoutMs } = framework.validation
|
|
138
|
-
const outputPaths = framework.framework === 'playwright'
|
|
139
|
-
? [playwright.getOutputPath(testFile)]
|
|
140
|
-
: []
|
|
141
|
-
const cwd = framework.project.root
|
|
142
|
-
|
|
143
|
-
return inheritApprovedExecutable(framework.validation, {
|
|
144
|
-
argv: [process.execPath, runner, ...getRunnerArgs(framework, testFile, generated)],
|
|
145
|
-
cwd,
|
|
146
|
-
description: `${formatFrameworkName(framework.framework)} ${generated ? 'generated' : 'representative'} test`,
|
|
147
|
-
env: getRunnerEnv(framework),
|
|
148
|
-
outputPaths,
|
|
149
|
-
requiredEnvVars,
|
|
150
|
-
timeoutMs: timeoutMs || (framework.browserRequired ? BROWSER_TIMEOUT_MS : DEFAULT_TIMEOUT_MS),
|
|
151
|
-
usesShell: false,
|
|
152
|
-
})
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Returns adapter-owned arguments for one exact test file.
|
|
157
|
-
*
|
|
158
|
-
* @param {object} framework normalized framework manifest entry
|
|
159
|
-
* @param {string} testFile selected existing or generated test file
|
|
160
|
-
* @param {boolean} generated whether this is a validator-owned generated test
|
|
161
|
-
* @returns {string[]} runner arguments
|
|
162
|
-
*/
|
|
163
|
-
function getRunnerArgs (framework, testFile, generated) {
|
|
164
|
-
const name = framework.framework
|
|
165
|
-
const configuration = framework.validation.runnerArgs || []
|
|
166
|
-
if (name === 'cucumber') {
|
|
167
|
-
if (!generated) return [...configuration, ...cucumber.getFocusedTestArgs(testFile, framework.project.root)]
|
|
168
|
-
return [
|
|
169
|
-
...configuration,
|
|
170
|
-
...cucumber.getGeneratedTestArgs(
|
|
171
|
-
testFile,
|
|
172
|
-
cucumber.getGeneratedStepsPath(framework.generatedTestStrategy.testDirectory),
|
|
173
|
-
framework.project.root
|
|
174
|
-
),
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
if (name === 'cypress') {
|
|
178
|
-
if (generated) return cypress.getGeneratedTestArgs(testFile, configuration)
|
|
179
|
-
return [
|
|
180
|
-
'run',
|
|
181
|
-
...configuration,
|
|
182
|
-
...cypress.getFocusedTestArgs(testFile),
|
|
183
|
-
'--config',
|
|
184
|
-
'video=false,screenshotOnRunFailure=false',
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
if (name === 'playwright') {
|
|
188
|
-
if (generated) {
|
|
189
|
-
return playwright.getGeneratedTestArgs(
|
|
190
|
-
testFile,
|
|
191
|
-
playwright.getGeneratedConfigPath(framework.generatedTestStrategy.testDirectory)
|
|
192
|
-
)
|
|
193
|
-
}
|
|
194
|
-
return ['test', ...configuration, ...playwright.getFocusedTestArgs(testFile)]
|
|
195
|
-
}
|
|
196
|
-
if (name === 'jest') {
|
|
197
|
-
const generatedOverrides = []
|
|
198
|
-
if (generated && configuration.some(argument => {
|
|
199
|
-
return argument === '--detectLeaks' || argument === '--detectLeaks=true'
|
|
200
|
-
})) {
|
|
201
|
-
generatedOverrides.push('--detectLeaks=false')
|
|
202
|
-
}
|
|
203
|
-
return [
|
|
204
|
-
...configuration,
|
|
205
|
-
'--runTestsByPath',
|
|
206
|
-
testFile,
|
|
207
|
-
'--runInBand',
|
|
208
|
-
'--silent',
|
|
209
|
-
'--no-watchman',
|
|
210
|
-
...generatedOverrides,
|
|
211
|
-
]
|
|
212
|
-
}
|
|
213
|
-
if (name === 'mocha') {
|
|
214
|
-
return [...configuration, '--no-config', '--no-package', '--no-opts', '--reporter', 'spec', testFile]
|
|
215
|
-
}
|
|
216
|
-
if (name === 'vitest') {
|
|
217
|
-
const needsGlobals = generated && framework.generatedTestStrategy.moduleSystem === 'commonjs'
|
|
218
|
-
return ['run', ...configuration, testFile, ...(needsGlobals ? ['--globals'] : [])]
|
|
219
|
-
}
|
|
220
|
-
throw new Error(`No direct-runner adapter is available for ${name}.`)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Returns small deterministic environment adjustments owned by an adapter.
|
|
225
|
-
*
|
|
226
|
-
* @param {object} framework framework entry
|
|
227
|
-
* @returns {Record<string, string>} command environment
|
|
228
|
-
*/
|
|
229
|
-
function getRunnerEnv (framework) {
|
|
230
|
-
return {
|
|
231
|
-
...framework.validation.environment,
|
|
232
|
-
...(framework.framework === 'cucumber' ? { CUCUMBER_PUBLISH_QUIET: 'true' } : {}),
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Adds an existing regular file to an approval input set.
|
|
238
|
-
*
|
|
239
|
-
* @param {Set<string>} files collected files
|
|
240
|
-
* @param {string|undefined} filename candidate file
|
|
241
|
-
*/
|
|
242
|
-
function addExistingFile (files, filename) {
|
|
243
|
-
if (typeof filename !== 'string') return
|
|
244
|
-
try {
|
|
245
|
-
if (fs.statSync(filename).isFile()) files.add(path.resolve(filename))
|
|
246
|
-
} catch {}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Formats a framework name for command descriptions.
|
|
251
|
-
*
|
|
252
|
-
* @param {string} framework framework name
|
|
253
|
-
*/
|
|
254
|
-
function formatFrameworkName (framework) {
|
|
255
|
-
return framework.charAt(0).toUpperCase() + framework.slice(1)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
module.exports = {
|
|
259
|
-
getBasicCommand,
|
|
260
|
-
getFrameworkCommands,
|
|
261
|
-
getGeneratedCommand,
|
|
262
|
-
getManifestCommands,
|
|
263
|
-
getManifestInputFiles,
|
|
264
|
-
}
|