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
|
@@ -24,18 +24,35 @@ const { OS_VERSION, OS_PLATFORM, OS_ARCHITECTURE, RUNTIME_NAME, RUNTIME_VERSION
|
|
|
24
24
|
const {
|
|
25
25
|
CI_PROVIDER_NAME,
|
|
26
26
|
GIT_REPOSITORY_URL,
|
|
27
|
+
GIT_CHECKOUT_ROOT,
|
|
28
|
+
GIT_CHECKOUT_IS_CUSTOM,
|
|
27
29
|
GIT_COMMIT_SHA,
|
|
28
30
|
GIT_BRANCH,
|
|
29
31
|
CI_WORKSPACE_PATH,
|
|
32
|
+
CI_GIT_MERGE_COMMIT_SHA,
|
|
30
33
|
GIT_COMMIT_MESSAGE,
|
|
34
|
+
GIT_COMMIT_AUTHOR_DATE,
|
|
35
|
+
GIT_COMMIT_AUTHOR_NAME,
|
|
36
|
+
GIT_COMMIT_AUTHOR_EMAIL,
|
|
37
|
+
GIT_COMMIT_COMMITTER_DATE,
|
|
38
|
+
GIT_COMMIT_COMMITTER_NAME,
|
|
39
|
+
GIT_COMMIT_COMMITTER_EMAIL,
|
|
31
40
|
GIT_TAG,
|
|
32
41
|
GIT_PULL_REQUEST_BASE_BRANCH_SHA,
|
|
33
42
|
GIT_COMMIT_HEAD_SHA,
|
|
34
43
|
GIT_PULL_REQUEST_BASE_BRANCH,
|
|
35
44
|
GIT_COMMIT_HEAD_MESSAGE,
|
|
36
45
|
} = require('./util/tags')
|
|
46
|
+
const REPOSITORY_METADATA_KEYS = [
|
|
47
|
+
GIT_REPOSITORY_URL, GIT_COMMIT_SHA, GIT_BRANCH, GIT_TAG, GIT_COMMIT_MESSAGE,
|
|
48
|
+
GIT_COMMIT_AUTHOR_DATE, GIT_COMMIT_AUTHOR_NAME, GIT_COMMIT_AUTHOR_EMAIL,
|
|
49
|
+
GIT_COMMIT_COMMITTER_DATE, GIT_COMMIT_COMMITTER_NAME, GIT_COMMIT_COMMITTER_EMAIL,
|
|
50
|
+
GIT_CHECKOUT_ROOT, GIT_CHECKOUT_IS_CUSTOM, CI_WORKSPACE_PATH, CI_GIT_MERGE_COMMIT_SHA,
|
|
51
|
+
]
|
|
52
|
+
|
|
37
53
|
const Plugin = require('./plugin')
|
|
38
54
|
const { getRepositoryRoot } = require('./util/git')
|
|
55
|
+
const { getUserProviderGitMetadata, validateGitCommitSha } = require('./util/user-provided-git')
|
|
39
56
|
const {
|
|
40
57
|
getTestEnvironmentMetadata,
|
|
41
58
|
getTestLevelsMetadataTags,
|
|
@@ -69,6 +86,7 @@ const {
|
|
|
69
86
|
TEST_SUITE_EXECUTION_ID,
|
|
70
87
|
getTestSuiteExecutionKey,
|
|
71
88
|
getFileAndLineNumberFromError,
|
|
89
|
+
getNonDependencyStackFramesFromError,
|
|
72
90
|
DI_ERROR_DEBUG_INFO_CAPTURED,
|
|
73
91
|
DI_DEBUG_ERROR_PREFIX,
|
|
74
92
|
DI_DEBUG_ERROR_SNAPSHOT_ID_SUFFIX,
|
|
@@ -98,9 +116,19 @@ const {
|
|
|
98
116
|
|
|
99
117
|
const legacyStorage = storage('legacy')
|
|
100
118
|
const DI_OPERATION_TIMEOUT_MS = 2000
|
|
119
|
+
const DI_STACK_FRAMES_TO_COMPARE = 2
|
|
120
|
+
const DI_CALLER_FRAME_LINE_TOLERANCE = 2
|
|
101
121
|
const DI_LOGGER_THREAD_ID = threadId === 0 ? `pid:${process.pid}` : `pid:${process.pid};tid:${threadId}`
|
|
102
122
|
const DI_LOGGER_THREAD_NAME = threadId === 0 ? 'MainThread' : `WorkerThread:${threadId}`
|
|
103
123
|
|
|
124
|
+
const DI_SNAPSHOT_DEPENDENCY_FOLDERS = [
|
|
125
|
+
'node_modules',
|
|
126
|
+
'node:',
|
|
127
|
+
'.pnpm',
|
|
128
|
+
'.yarn',
|
|
129
|
+
'.pnp',
|
|
130
|
+
]
|
|
131
|
+
|
|
104
132
|
const FRAMEWORK_TO_TRIMMED_COMMAND = {
|
|
105
133
|
vitest: 'vitest run',
|
|
106
134
|
mocha: 'mocha',
|
|
@@ -183,6 +211,32 @@ function disableTestImpactAnalysis (libraryConfig) {
|
|
|
183
211
|
})
|
|
184
212
|
}
|
|
185
213
|
|
|
214
|
+
function normalizeSnapshotFileName (fileName) {
|
|
215
|
+
return fileName.startsWith('file://') ? fileName.slice('file://'.length) : fileName
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function getNonDependencySnapshotStackFrames (snapshot, repositoryRoot) {
|
|
219
|
+
if (!snapshot.stack) {
|
|
220
|
+
return []
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const frames = []
|
|
224
|
+
for (const frame of snapshot.stack) {
|
|
225
|
+
if (!frame || typeof frame.fileName !== 'string' || !Number.isInteger(frame.lineNumber)) {
|
|
226
|
+
continue
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const file = normalizeSnapshotFileName(frame.fileName)
|
|
230
|
+
if (!file.includes(repositoryRoot) || DI_SNAPSHOT_DEPENDENCY_FOLDERS.some(pattern => file.includes(pattern))) {
|
|
231
|
+
continue
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
frames.push({ file, line: frame.lineNumber })
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return frames
|
|
238
|
+
}
|
|
239
|
+
|
|
186
240
|
module.exports = class CiPlugin extends Plugin {
|
|
187
241
|
constructor (...args) {
|
|
188
242
|
super(...args)
|
|
@@ -190,6 +244,8 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
190
244
|
this.fileLineToProbeId = new Map()
|
|
191
245
|
this.diBreakpointHitPromise = undefined
|
|
192
246
|
this.diBreakpointHitResolvers = []
|
|
247
|
+
this.diBreakpointHitSpans = []
|
|
248
|
+
this.testErrorStackFrames = []
|
|
193
249
|
this.rootDir = process.cwd() // fallback in case :session:start events are not emitted
|
|
194
250
|
this._testSuiteSpansByTestSuite = new Map()
|
|
195
251
|
this._pendingWorkerTracesByTestSuite = new Map()
|
|
@@ -420,16 +476,22 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
420
476
|
})
|
|
421
477
|
|
|
422
478
|
this.addSub(`ci:${this.constructor.id}:modified-files`, ({ onDone }) => {
|
|
479
|
+
const isCustomCheckout = this.testEnvironmentMetadata[GIT_CHECKOUT_IS_CUSTOM] === 'true'
|
|
480
|
+
const diffMetadata = isCustomCheckout ? getUserProviderGitMetadata() : this.testEnvironmentMetadata
|
|
423
481
|
const {
|
|
424
482
|
[GIT_PULL_REQUEST_BASE_BRANCH]: pullRequestBaseBranch,
|
|
425
483
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseBranchSha,
|
|
426
484
|
[GIT_COMMIT_HEAD_SHA]: commitHeadSha,
|
|
427
|
-
} =
|
|
485
|
+
} = diffMetadata
|
|
486
|
+
const commitSha = this.testEnvironmentMetadata[GIT_COMMIT_SHA]
|
|
487
|
+
const targetCommit = commitHeadSha ||
|
|
488
|
+
(isCustomCheckout && validateGitCommitSha(commitSha) ? commitSha : undefined)
|
|
428
489
|
|
|
429
|
-
const baseBranchSha = pullRequestBaseBranchSha ||
|
|
490
|
+
const baseBranchSha = pullRequestBaseBranchSha ||
|
|
491
|
+
getPullRequestBaseBranch(pullRequestBaseBranch, this.repositoryRoot)
|
|
430
492
|
|
|
431
493
|
if (baseBranchSha) {
|
|
432
|
-
const diff = getPullRequestDiff(baseBranchSha,
|
|
494
|
+
const diff = getPullRequestDiff(baseBranchSha, targetCommit, this.repositoryRoot)
|
|
433
495
|
const modifiedFiles = getModifiedFilesFromDiff(diff)
|
|
434
496
|
|
|
435
497
|
if (modifiedFiles) {
|
|
@@ -602,6 +664,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
602
664
|
if (!repositoryRoot || repositoryRoot === this.repositoryRoot) return
|
|
603
665
|
|
|
604
666
|
this.repositoryRoot = repositoryRoot
|
|
667
|
+
if (this.testConfiguration) this.testConfiguration.gitRoot = repositoryRoot
|
|
605
668
|
if (codeOwnersEntries === undefined) {
|
|
606
669
|
this.codeOwnersEntries = getCodeOwnersFileEntries(this.repositoryRoot)
|
|
607
670
|
}
|
|
@@ -640,11 +703,14 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
640
703
|
if (span.name === `${this.constructor.id}.test` || span.name === `${this.constructor.id}.test_suite`) {
|
|
641
704
|
Object.assign(span.meta, getSessionItrSkippingEnabledTags(this.testSessionSpan))
|
|
642
705
|
}
|
|
643
|
-
//
|
|
644
|
-
for (const key
|
|
706
|
+
// Replace worker repository metadata, including fields omitted by the coordinator.
|
|
707
|
+
for (const key of REPOSITORY_METADATA_KEYS) {
|
|
708
|
+
delete span.meta[key]
|
|
709
|
+
}
|
|
710
|
+
for (const key of Object.keys(this.testEnvironmentMetadata)) {
|
|
645
711
|
// CAREFUL: this bypasses the metadata/metrics distinction
|
|
646
712
|
// Be careful not to pass numbers in `meta`
|
|
647
|
-
if (key.startsWith('git.')) {
|
|
713
|
+
if (key.startsWith('git.') || key === CI_WORKSPACE_PATH || key === CI_GIT_MERGE_COMMIT_SHA) {
|
|
648
714
|
span.meta[key] = this.testEnvironmentMetadata[key]
|
|
649
715
|
}
|
|
650
716
|
}
|
|
@@ -811,7 +877,8 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
811
877
|
[RUNTIME_VERSION]: runtimeVersion,
|
|
812
878
|
[GIT_BRANCH]: branch,
|
|
813
879
|
[CI_PROVIDER_NAME]: ciProviderName,
|
|
814
|
-
[
|
|
880
|
+
[GIT_CHECKOUT_ROOT]: gitRoot,
|
|
881
|
+
[GIT_CHECKOUT_IS_CUSTOM]: isCustomCheckout,
|
|
815
882
|
[GIT_COMMIT_MESSAGE]: commitMessage,
|
|
816
883
|
[GIT_TAG]: tag,
|
|
817
884
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseSha,
|
|
@@ -819,7 +886,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
819
886
|
[GIT_COMMIT_HEAD_MESSAGE]: commitHeadMessage,
|
|
820
887
|
} = this.testEnvironmentMetadata
|
|
821
888
|
|
|
822
|
-
this.repositoryRoot =
|
|
889
|
+
this.repositoryRoot = gitRoot ||
|
|
823
890
|
(shouldDeferRepositoryRoot ? process.cwd() : getRepositoryRoot() || process.cwd())
|
|
824
891
|
|
|
825
892
|
this.codeOwnersEntries = shouldDeferCodeOwnersEntries ? null : getCodeOwnersFileEntries(this.repositoryRoot)
|
|
@@ -828,7 +895,9 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
828
895
|
|
|
829
896
|
this.testConfiguration = {
|
|
830
897
|
repositoryUrl,
|
|
831
|
-
sha,
|
|
898
|
+
// The `git.commit.sha` tag reports malformed values as provided, but they must not select backend data.
|
|
899
|
+
sha: validateGitCommitSha(sha) ? sha : undefined,
|
|
900
|
+
gitRoot: this.repositoryRoot,
|
|
832
901
|
osVersion,
|
|
833
902
|
osPlatform,
|
|
834
903
|
osArchitecture,
|
|
@@ -839,8 +908,11 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
839
908
|
commitMessage,
|
|
840
909
|
tag,
|
|
841
910
|
pullRequestBaseSha,
|
|
842
|
-
|
|
843
|
-
|
|
911
|
+
// Only an explicit PR head can override the selected commit in a custom checkout.
|
|
912
|
+
commitHeadSha: isCustomCheckout === 'true'
|
|
913
|
+
? getUserProviderGitMetadata()[GIT_COMMIT_HEAD_SHA]
|
|
914
|
+
: commitHeadSha,
|
|
915
|
+
commitHeadMessage: isCustomCheckout === 'true' ? undefined : commitHeadMessage,
|
|
844
916
|
}
|
|
845
917
|
}
|
|
846
918
|
|
|
@@ -923,34 +995,44 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
923
995
|
}
|
|
924
996
|
|
|
925
997
|
onDiBreakpointHit ({ snapshot }) {
|
|
998
|
+
if (this.filterDiBreakpointHitByStack && !this.#isExpectedDiBreakpointHit(snapshot)) {
|
|
999
|
+
log.debug('Ignoring Dynamic Instrumentation snapshot because it does not match the failed test stack')
|
|
1000
|
+
return
|
|
1001
|
+
}
|
|
1002
|
+
|
|
926
1003
|
for (const resolve of this.diBreakpointHitResolvers) {
|
|
927
1004
|
resolve()
|
|
928
1005
|
}
|
|
929
1006
|
this.diBreakpointHitResolvers.length = 0
|
|
930
1007
|
|
|
931
|
-
|
|
1008
|
+
while (this.diBreakpointHitSpans[0]?.context()._isFinished) {
|
|
1009
|
+
this.diBreakpointHitSpans.shift()
|
|
1010
|
+
}
|
|
1011
|
+
const testSpan = this.diBreakpointHitSpans.shift() || this.activeTestSpan
|
|
1012
|
+
|
|
1013
|
+
if (!testSpan || testSpan.context()._isFinished) {
|
|
932
1014
|
// This is unexpected and is caused by a race condition.
|
|
933
1015
|
log.warn('Breakpoint snapshot could not be attached to the active test span')
|
|
934
1016
|
return
|
|
935
1017
|
}
|
|
936
1018
|
|
|
937
1019
|
const stackIndex = this.testErrorStackIndex
|
|
1020
|
+
const activeTestSpanContext = testSpan.context()
|
|
938
1021
|
|
|
939
|
-
|
|
940
|
-
|
|
1022
|
+
testSpan.setTag(DI_ERROR_DEBUG_INFO_CAPTURED, 'true')
|
|
1023
|
+
testSpan.setTag(
|
|
941
1024
|
`${DI_DEBUG_ERROR_PREFIX}.${stackIndex}.${DI_DEBUG_ERROR_SNAPSHOT_ID_SUFFIX}`,
|
|
942
1025
|
snapshot.id
|
|
943
1026
|
)
|
|
944
|
-
|
|
1027
|
+
testSpan.setTag(
|
|
945
1028
|
`${DI_DEBUG_ERROR_PREFIX}.${stackIndex}.${DI_DEBUG_ERROR_FILE_SUFFIX}`,
|
|
946
1029
|
snapshot.probe.location.file
|
|
947
1030
|
)
|
|
948
|
-
|
|
1031
|
+
testSpan.setTag(
|
|
949
1032
|
`${DI_DEBUG_ERROR_PREFIX}.${stackIndex}.${DI_DEBUG_ERROR_LINE_SUFFIX}`,
|
|
950
1033
|
Number(snapshot.probe.location.lines[0])
|
|
951
1034
|
)
|
|
952
1035
|
|
|
953
|
-
const activeTestSpanContext = this.activeTestSpan.context()
|
|
954
1036
|
const topStackFrame = snapshot.stack?.[0]
|
|
955
1037
|
|
|
956
1038
|
this.tracer._exporter.exportDiLogs(this.testEnvironmentMetadata, {
|
|
@@ -970,6 +1052,39 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
970
1052
|
})
|
|
971
1053
|
}
|
|
972
1054
|
|
|
1055
|
+
#isExpectedDiBreakpointHit (snapshot) {
|
|
1056
|
+
const failureFrames = this.testErrorStackFrames
|
|
1057
|
+
if (failureFrames.length < DI_STACK_FRAMES_TO_COMPARE) {
|
|
1058
|
+
return true
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
const snapshotFrames = getNonDependencySnapshotStackFrames(snapshot, this.repositoryRoot)
|
|
1062
|
+
if (snapshotFrames.length < DI_STACK_FRAMES_TO_COMPARE) {
|
|
1063
|
+
return true
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
for (let i = 0; i < DI_STACK_FRAMES_TO_COMPARE; i++) {
|
|
1067
|
+
const expectedFrame = failureFrames[i]
|
|
1068
|
+
const snapshotFrame = snapshotFrames[i]
|
|
1069
|
+
|
|
1070
|
+
if (expectedFrame.file !== snapshotFrame.file) {
|
|
1071
|
+
return false
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
if (i === 0 && expectedFrame.line !== snapshotFrame.line) {
|
|
1075
|
+
return false
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// Vite can report a slightly shifted caller line in debugger snapshots compared to error stacks.
|
|
1079
|
+
// Keep the probe frame exact and only tolerate a small caller-frame offset.
|
|
1080
|
+
if (i > 0 && Math.abs(expectedFrame.line - snapshotFrame.line) > DI_CALLER_FRAME_LINE_TOLERANCE) {
|
|
1081
|
+
return false
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
return true
|
|
1086
|
+
}
|
|
1087
|
+
|
|
973
1088
|
/**
|
|
974
1089
|
* Wait for a Dynamic Instrumentation operation without blocking test framework progress forever.
|
|
975
1090
|
*
|
|
@@ -988,6 +1103,16 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
988
1103
|
resolve()
|
|
989
1104
|
}
|
|
990
1105
|
this.diBreakpointHitResolvers.length = 0
|
|
1106
|
+
this.diBreakpointHitSpans.length = 0
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Queue the test span expected to receive the next Dynamic Instrumentation breakpoint hit.
|
|
1111
|
+
*
|
|
1112
|
+
* @param {import('../../../datadog-core/src/opentracing/span')} span
|
|
1113
|
+
*/
|
|
1114
|
+
queueDiBreakpointHitSpan (span) {
|
|
1115
|
+
this.diBreakpointHitSpans.push(span)
|
|
991
1116
|
}
|
|
992
1117
|
|
|
993
1118
|
/**
|
|
@@ -1103,6 +1228,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
1103
1228
|
log.debug('Adding breakpoint for Dynamic Instrumentation')
|
|
1104
1229
|
|
|
1105
1230
|
this.testErrorStackIndex = stackIndex
|
|
1231
|
+
this.testErrorStackFrames = getNonDependencyStackFramesFromError(err, this.repositoryRoot)
|
|
1106
1232
|
const activeProbeKey = `${file}:${line}`
|
|
1107
1233
|
|
|
1108
1234
|
if (this.fileLineToProbeId.has(activeProbeKey)) {
|
|
@@ -8,17 +8,21 @@ const plugins = {
|
|
|
8
8
|
get '@azure/cosmos' () { return require('../../../datadog-plugin-azure-cosmos/src') },
|
|
9
9
|
get '@azure/event-hubs' () { return require('../../../datadog-plugin-azure-event-hubs/src') },
|
|
10
10
|
get '@azure/functions' () { return require('../../../datadog-plugin-azure-functions/src') },
|
|
11
|
+
get '@modelcontextprotocol/client' () { return require('../../../datadog-plugin-modelcontextprotocol-sdk/src') },
|
|
11
12
|
get '@modelcontextprotocol/sdk' () { return require('../../../datadog-plugin-modelcontextprotocol-sdk/src') },
|
|
13
|
+
get '@modelcontextprotocol/server' () { return require('../../../datadog-plugin-modelcontextprotocol-sdk/src') },
|
|
12
14
|
get '@aws/durable-execution-sdk-js' () { return require('../../../datadog-plugin-aws-durable-execution-sdk-js/src') },
|
|
13
15
|
get '@supabase/auth-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
14
16
|
get '@supabase/functions-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
15
17
|
get '@supabase/postgrest-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
16
18
|
get '@supabase/realtime-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
17
19
|
get '@supabase/storage-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
20
|
+
get '@trpc/server' () { return require('../../../datadog-plugin-trpc/src') },
|
|
18
21
|
get 'durable-functions' () { return require('../../../datadog-plugin-azure-durable-functions/src') },
|
|
19
22
|
get '@azure/service-bus' () { return require('../../../datadog-plugin-azure-service-bus/src') },
|
|
20
23
|
get '@cucumber/cucumber' () { return require('../../../datadog-plugin-cucumber/src') },
|
|
21
24
|
get '@playwright/test' () { return require('../../../datadog-plugin-playwright/src') },
|
|
25
|
+
get '@elevenlabs/elevenlabs-js' () { return require('../../../datadog-plugin-elevenlabs/src') },
|
|
22
26
|
get '@elastic/elasticsearch' () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
23
27
|
get '@elastic/transport' () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
24
28
|
get '@google-cloud/pubsub' () { return require('../../../datadog-plugin-google-cloud-pubsub/src') },
|
|
@@ -47,11 +51,14 @@ const plugins = {
|
|
|
47
51
|
get '@wdio/local-runner' () { return require('../../../datadog-plugin-mocha/src') },
|
|
48
52
|
get '@langchain/langgraph' () { return require('../../../datadog-plugin-langgraph/src') },
|
|
49
53
|
get '@openai/agents' () { return require('../../../datadog-plugin-openai-agents/src') },
|
|
54
|
+
get '@openai/agents-realtime' () { return require('../../../datadog-plugin-openai/src') },
|
|
50
55
|
get aerospike () { return require('../../../datadog-plugin-aerospike/src') },
|
|
51
56
|
get ai () { return require('../../../datadog-plugin-ai/src') },
|
|
52
57
|
get amqp10 () { return require('../../../datadog-plugin-amqp10/src') },
|
|
53
58
|
get amqplib () { return require('../../../datadog-plugin-amqplib/src') },
|
|
59
|
+
get 'async-mutex' () { return require('../../../datadog-plugin-async-mutex/src') },
|
|
54
60
|
get avsc () { return require('../../../datadog-plugin-avsc/src') },
|
|
61
|
+
get 'aws-lambda' () { return require('../../../datadog-plugin-aws-lambda/src') },
|
|
55
62
|
get 'aws-sdk' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
56
63
|
get 'browser-bunyan' () { return require('../../../datadog-plugin-browser-bunyan/src') },
|
|
57
64
|
get bullmq () { return require('../../../datadog-plugin-bullmq/src') },
|
|
@@ -66,6 +73,7 @@ const plugins = {
|
|
|
66
73
|
get 'dd-trace-api' () { return require('../../../datadog-plugin-dd-trace-api/src') },
|
|
67
74
|
get elasticsearch () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
68
75
|
get electron () { return require('../../../datadog-plugin-electron/src') },
|
|
76
|
+
get elevenlabs () { return require('../../../datadog-plugin-elevenlabs/src') },
|
|
69
77
|
get express () { return require('../../../datadog-plugin-express/src') },
|
|
70
78
|
get fastify () { return require('../../../datadog-plugin-fastify/src') },
|
|
71
79
|
get 'find-my-way' () { return require('../../../datadog-plugin-find-my-way/src') },
|
|
@@ -109,8 +109,9 @@ module.exports = class Plugin {
|
|
|
109
109
|
/**
|
|
110
110
|
* Subscribe to a diagnostic channel with automatic error handling and enable/disable lifecycle.
|
|
111
111
|
*
|
|
112
|
+
* @template T
|
|
112
113
|
* @param {string} channelName Diagnostic channel name.
|
|
113
|
-
* @param {(message:
|
|
114
|
+
* @param {(message: T, name: string) => unknown} handler Handler invoked on messages.
|
|
114
115
|
*/
|
|
115
116
|
addSub (channelName, handler) {
|
|
116
117
|
const wrappedHandler = (message, name) => {
|
|
@@ -128,8 +129,9 @@ module.exports = class Plugin {
|
|
|
128
129
|
/**
|
|
129
130
|
* Bind the tracer store to a diagnostic channel with a transform function.
|
|
130
131
|
*
|
|
132
|
+
* @template T
|
|
131
133
|
* @param {string} channelName Diagnostic channel name.
|
|
132
|
-
* @param {(data:
|
|
134
|
+
* @param {(data: T) => object} transform Transform to compute the bound store.
|
|
133
135
|
*/
|
|
134
136
|
addBind (channelName, transform) {
|
|
135
137
|
this._bindings.push(new StoreBinding(channelName, transform))
|
|
@@ -203,7 +203,7 @@ class TracingPlugin extends Plugin {
|
|
|
203
203
|
* @param {import('../tracer')} [options.tracer] - The tracer.
|
|
204
204
|
* @param {object} [options.config] - The config for the span.
|
|
205
205
|
*
|
|
206
|
-
* @param {boolean | object} enterOrCtx -
|
|
206
|
+
* @param {boolean | { parentStore?: object, currentStore?: object }} enterOrCtx - Enter the span or bind a context.
|
|
207
207
|
*/
|
|
208
208
|
startSpan (name, options = {}, enterOrCtx = true) {
|
|
209
209
|
// TODO: modularize this code to a helper function
|
|
@@ -23,6 +23,7 @@ const {
|
|
|
23
23
|
CI_PIPELINE_URL,
|
|
24
24
|
CI_PROVIDER_NAME,
|
|
25
25
|
CI_WORKSPACE_PATH,
|
|
26
|
+
CI_GIT_MERGE_COMMIT_SHA,
|
|
26
27
|
CI_JOB_URL,
|
|
27
28
|
CI_JOB_NAME,
|
|
28
29
|
CI_STAGE_NAME,
|
|
@@ -37,6 +38,16 @@ const {
|
|
|
37
38
|
} = require('./tags')
|
|
38
39
|
const { filterSensitiveInfoFromRepository } = require('./url')
|
|
39
40
|
|
|
41
|
+
// `user-provided-git` requires this module, so its SHA validator cannot be reused here.
|
|
42
|
+
const COMMIT_SHA_REGEX = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/
|
|
43
|
+
const COMMIT_SHA_TAGS = [
|
|
44
|
+
GIT_COMMIT_SHA,
|
|
45
|
+
GIT_COMMIT_HEAD_SHA,
|
|
46
|
+
GIT_PULL_REQUEST_BASE_BRANCH_SHA,
|
|
47
|
+
GIT_PULL_REQUEST_BASE_BRANCH_HEAD_SHA,
|
|
48
|
+
CI_GIT_MERGE_COMMIT_SHA,
|
|
49
|
+
]
|
|
50
|
+
|
|
40
51
|
// Receives a string with the form 'John Doe <john.doe@gmail.com>'
|
|
41
52
|
// and returns { name: 'John Doe', email: 'john.doe@gmail.com' }
|
|
42
53
|
function parseEmailAndName (emailAndName) {
|
|
@@ -78,7 +89,17 @@ function normalizeRef (ref) {
|
|
|
78
89
|
if (!ref) {
|
|
79
90
|
return ref
|
|
80
91
|
}
|
|
81
|
-
return ref.replaceAll(/origin\/|refs\/heads\/|tags\//g, '')
|
|
92
|
+
return ref.replaceAll(/origin\/|refs\/heads\/|refs\/tags\/|tags\//g, '')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Lowercases a commit SHA. Values that are not a SHA in any case stay unchanged so validation still rejects them.
|
|
97
|
+
*
|
|
98
|
+
* @param {string | undefined} sha
|
|
99
|
+
*/
|
|
100
|
+
function normalizeCommitSha (sha) {
|
|
101
|
+
const lowerCaseSha = sha?.toLowerCase()
|
|
102
|
+
return COMMIT_SHA_REGEX.test(lowerCaseSha || '') ? lowerCaseSha : sha
|
|
82
103
|
}
|
|
83
104
|
|
|
84
105
|
function resolveTilde (filePath) {
|
|
@@ -285,6 +306,7 @@ function getJobIDFromDiagFile () {
|
|
|
285
306
|
|
|
286
307
|
module.exports = {
|
|
287
308
|
normalizeRef,
|
|
309
|
+
normalizeCommitSha,
|
|
288
310
|
expandGlobPattern,
|
|
289
311
|
getJobIDFromDiagFile,
|
|
290
312
|
getCIMetadata () {
|
|
@@ -373,6 +395,8 @@ module.exports = {
|
|
|
373
395
|
CI_MERGE_REQUEST_IID,
|
|
374
396
|
CI_MERGE_REQUEST_TARGET_BRANCH_SHA,
|
|
375
397
|
CI_MERGE_REQUEST_DIFF_BASE_SHA,
|
|
398
|
+
CI_MERGE_REQUEST_SOURCE_BRANCH_SHA,
|
|
399
|
+
CI_MERGE_REQUEST_EVENT_TYPE,
|
|
376
400
|
} = env
|
|
377
401
|
|
|
378
402
|
const { name, email } = parseEmailAndName(CI_COMMIT_AUTHOR)
|
|
@@ -407,6 +431,11 @@ module.exports = {
|
|
|
407
431
|
[CI_JOB_ID]: GITLAB_CI_JOB_ID,
|
|
408
432
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: CI_MERGE_REQUEST_DIFF_BASE_SHA,
|
|
409
433
|
[GIT_PULL_REQUEST_BASE_BRANCH_HEAD_SHA]: CI_MERGE_REQUEST_TARGET_BRANCH_SHA,
|
|
434
|
+
[GIT_COMMIT_HEAD_SHA]: CI_MERGE_REQUEST_SOURCE_BRANCH_SHA,
|
|
435
|
+
}
|
|
436
|
+
if (CI_MERGE_REQUEST_IID &&
|
|
437
|
+
(CI_MERGE_REQUEST_EVENT_TYPE === 'merged_result' || CI_MERGE_REQUEST_EVENT_TYPE === 'merge_train')) {
|
|
438
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = CI_COMMIT_SHA
|
|
410
439
|
}
|
|
411
440
|
}
|
|
412
441
|
|
|
@@ -504,6 +533,9 @@ module.exports = {
|
|
|
504
533
|
}),
|
|
505
534
|
[CI_JOB_ID]: GITHUB_JOB_ID ?? GITHUB_JOB,
|
|
506
535
|
}
|
|
536
|
+
if (/^refs\/pull\/\d+\/merge$/.test(GITHUB_REF || '')) {
|
|
537
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = GITHUB_SHA
|
|
538
|
+
}
|
|
507
539
|
if (GITHUB_BASE_REF) { // `pull_request` or `pull_request_target` event
|
|
508
540
|
tags[GIT_PULL_REQUEST_BASE_BRANCH] = GITHUB_BASE_REF
|
|
509
541
|
try {
|
|
@@ -564,6 +596,13 @@ module.exports = {
|
|
|
564
596
|
[GIT_TAG]: APPVEYOR_REPO_TAG_NAME,
|
|
565
597
|
[GIT_BRANCH]: APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH || APPVEYOR_REPO_BRANCH,
|
|
566
598
|
}
|
|
599
|
+
|
|
600
|
+
// A PR build of a commit other than the PR head commit is testing the merge result.
|
|
601
|
+
const headSha = APPVEYOR_PULL_REQUEST_HEAD_COMMIT?.toLowerCase()
|
|
602
|
+
if (/^\d+$/.test(APPVEYOR_PULL_REQUEST_NUMBER || '') && COMMIT_SHA_REGEX.test(headSha || '') &&
|
|
603
|
+
APPVEYOR_REPO_COMMIT && headSha !== APPVEYOR_REPO_COMMIT.toLowerCase()) {
|
|
604
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = APPVEYOR_REPO_COMMIT
|
|
605
|
+
}
|
|
567
606
|
}
|
|
568
607
|
}
|
|
569
608
|
|
|
@@ -583,6 +622,7 @@ module.exports = {
|
|
|
583
622
|
SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI,
|
|
584
623
|
BUILD_REPOSITORY_URI,
|
|
585
624
|
BUILD_SOURCEVERSION,
|
|
625
|
+
BUILD_REASON,
|
|
586
626
|
BUILD_REQUESTEDFORID,
|
|
587
627
|
BUILD_REQUESTEDFOREMAIL,
|
|
588
628
|
BUILD_SOURCEVERSIONMESSAGE,
|
|
@@ -601,6 +641,7 @@ module.exports = {
|
|
|
601
641
|
[CI_PIPELINE_NAME]: BUILD_DEFINITIONNAME,
|
|
602
642
|
[CI_PIPELINE_NUMBER]: BUILD_BUILDID,
|
|
603
643
|
[GIT_COMMIT_SHA]: SYSTEM_PULLREQUEST_SOURCECOMMITID || BUILD_SOURCEVERSION,
|
|
644
|
+
[GIT_COMMIT_HEAD_SHA]: SYSTEM_PULLREQUEST_SOURCECOMMITID,
|
|
604
645
|
[CI_WORKSPACE_PATH]: BUILD_SOURCESDIRECTORY,
|
|
605
646
|
[GIT_REPOSITORY_URL]: SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI || BUILD_REPOSITORY_URI,
|
|
606
647
|
[refKey]: ref,
|
|
@@ -614,6 +655,9 @@ module.exports = {
|
|
|
614
655
|
[GIT_PULL_REQUEST_BASE_BRANCH]: SYSTEM_PULLREQUEST_TARGETBRANCH,
|
|
615
656
|
[CI_JOB_ID]: SYSTEM_JOBID,
|
|
616
657
|
}
|
|
658
|
+
if (BUILD_REASON === 'PullRequest' && /^refs\/pull\/\d+\/merge$/.test(BUILD_SOURCEBRANCH || '')) {
|
|
659
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = BUILD_SOURCEVERSION
|
|
660
|
+
}
|
|
617
661
|
|
|
618
662
|
if (SYSTEM_TEAMFOUNDATIONSERVERURI && SYSTEM_TEAMPROJECTID && BUILD_BUILDID) {
|
|
619
663
|
const baseUrl =
|
|
@@ -772,6 +816,7 @@ module.exports = {
|
|
|
772
816
|
TRAVIS_COMMIT_MESSAGE,
|
|
773
817
|
TRAVIS_PULL_REQUEST,
|
|
774
818
|
TRAVIS_PULL_REQUEST_SHA,
|
|
819
|
+
TRAVIS_EVENT_TYPE,
|
|
775
820
|
} = env
|
|
776
821
|
|
|
777
822
|
tags = {
|
|
@@ -791,6 +836,9 @@ module.exports = {
|
|
|
791
836
|
[GIT_PULL_REQUEST_BASE_BRANCH]: TRAVIS_BRANCH,
|
|
792
837
|
[PR_NUMBER]: TRAVIS_PULL_REQUEST,
|
|
793
838
|
}
|
|
839
|
+
if (TRAVIS_EVENT_TYPE === 'pull_request' && /^\d+$/.test(TRAVIS_PULL_REQUEST || '')) {
|
|
840
|
+
tags[CI_GIT_MERGE_COMMIT_SHA] = TRAVIS_COMMIT
|
|
841
|
+
}
|
|
794
842
|
}
|
|
795
843
|
|
|
796
844
|
if (env.BUDDY) {
|
|
@@ -933,6 +981,9 @@ module.exports = {
|
|
|
933
981
|
normalizeTag(tags, GIT_TAG, normalizeRef)
|
|
934
982
|
normalizeTag(tags, GIT_PULL_REQUEST_BASE_BRANCH, normalizeRef)
|
|
935
983
|
normalizeTag(tags, PR_NUMBER, normalizeNumber)
|
|
984
|
+
for (const tag of COMMIT_SHA_TAGS) {
|
|
985
|
+
normalizeTag(tags, tag, normalizeCommitSha)
|
|
986
|
+
}
|
|
936
987
|
|
|
937
988
|
return removeEmptyValues(tags)
|
|
938
989
|
},
|
|
@@ -41,9 +41,9 @@ function ensureCacheDir () {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function getCacheKey (cmd, flags) {
|
|
45
|
-
//
|
|
46
|
-
const commandString =
|
|
44
|
+
function getCacheKey (cmd, flags, cwd = process.cwd()) {
|
|
45
|
+
// Commands in independent checkouts must not share cached output.
|
|
46
|
+
const commandString = JSON.stringify([path.resolve(cwd), cmd, flags])
|
|
47
47
|
return crypto.createHash('sha256').update(commandString).digest('hex')
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -85,7 +85,7 @@ function cachedExec (cmd, flags, options) {
|
|
|
85
85
|
if (!ensureCacheDir()) {
|
|
86
86
|
return cp.execFileSync(cmd, flags, options)
|
|
87
87
|
}
|
|
88
|
-
const cacheKey = getCacheKey(cmd, flags)
|
|
88
|
+
const cacheKey = getCacheKey(cmd, flags, options.cwd)
|
|
89
89
|
const cachedResult = getCache(cacheKey)
|
|
90
90
|
if (cachedResult !== undefined) {
|
|
91
91
|
if (cachedResult.startsWith('__GIT_COMMAND_FAILED__')) {
|