dd-trace 6.23.0 → 6.25.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/LICENSE-3rdparty.csv +0 -1
- package/ci/cypress/support.js +15 -1
- package/ci/init.js +2 -22
- package/ci/test-annotations.d.ts +5 -0
- package/ci/test-annotations.js +5 -0
- package/ci/vitest-no-worker-init-annotations.mjs +4 -0
- package/ci/vitest-no-worker-init-node-setup.mjs +22 -0
- package/ci/vitest-no-worker-init-runner-setup.mjs +7 -32
- package/ci/vitest-no-worker-init-setup.mjs +34 -12
- package/ci/vitest-no-worker-init-v5-setup.mjs +6 -0
- package/ext/exporters.js +1 -1
- package/index.d.ts +124 -5
- package/initialize.mjs +5 -2
- package/lambda.d.ts +39 -0
- package/lambda.js +3 -0
- package/loader-hook.mjs +53 -0
- package/openfeature/exposure-hook.d.ts +66 -0
- package/openfeature/exposure-hook.js +5 -0
- package/package.json +19 -15
- package/packages/datadog-core/src/storage.js +1 -1
- package/packages/datadog-esbuild/index.js +78 -62
- package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
- package/packages/datadog-instrumentations/src/cucumber.js +56 -19
- package/packages/datadog-instrumentations/src/cypress-config.js +163 -15
- 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 +29 -20
- package/packages/datadog-instrumentations/src/grpc/server.js +23 -6
- package/packages/{datadog-esbuild/src/utils.js → datadog-instrumentations/src/helpers/bundler-esm-exports.js} +282 -40
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +573 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
- package/packages/datadog-instrumentations/src/helpers/fetch.js +5 -1
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +30 -8
- package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +4 -8
- package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +18 -6
- 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-jit.js +3 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +40 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/react-router.js +49 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/typesafe.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +58 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +19 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +25 -3
- 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/jest.js +265 -82
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +69 -11
- package/packages/datadog-instrumentations/src/mariadb.js +13 -6
- package/packages/datadog-instrumentations/src/mocha/common.js +89 -8
- package/packages/datadog-instrumentations/src/mocha/main.js +11 -2
- package/packages/datadog-instrumentations/src/mocha/utils.js +58 -12
- package/packages/datadog-instrumentations/src/mocha/worker.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +19 -6
- 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/oracledb.js +33 -0
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
- package/packages/datadog-instrumentations/src/pg.js +2 -1
- package/packages/datadog-instrumentations/src/playwright.js +81 -28
- package/packages/datadog-instrumentations/src/react-router.js +106 -0
- package/packages/datadog-instrumentations/src/typesafe.js +89 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +84 -48
- package/packages/datadog-instrumentations/src/vitest-main.js +26 -0
- package/packages/datadog-instrumentations/src/vitest-test-annotations.js +20 -0
- package/packages/datadog-instrumentations/src/vitest-worker.js +39 -17
- package/packages/datadog-instrumentations/src/vitest.js +10 -8
- 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/index.js +106 -0
- package/packages/datadog-plugin-cucumber/src/index.js +5 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +296 -55
- package/packages/datadog-plugin-cypress/src/index.js +1 -1
- package/packages/datadog-plugin-cypress/src/lifecycle-owner.js +20 -0
- package/packages/datadog-plugin-cypress/src/plugin.js +10 -0
- package/packages/datadog-plugin-cypress/src/retry-config-observer.js +281 -0
- package/packages/datadog-plugin-cypress/src/setup-handoff.js +125 -0
- package/packages/datadog-plugin-cypress/src/support.js +1217 -439
- package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +10 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +19 -52
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +4 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
- package/packages/datadog-plugin-graphql/src/execute.js +2 -2
- package/packages/datadog-plugin-graphql/src/utils.js +5 -5
- package/packages/datadog-plugin-http/src/client.js +32 -9
- package/packages/datadog-plugin-http2/src/client.js +38 -13
- package/packages/datadog-plugin-jest/src/index.js +25 -3
- package/packages/datadog-plugin-mocha/src/index.js +47 -6
- package/packages/datadog-plugin-next/src/index.js +112 -14
- package/packages/datadog-plugin-oracledb/src/connection-parser.js +21 -11
- package/packages/datadog-plugin-playwright/src/index.js +4 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
- package/packages/datadog-plugin-react-router/src/index.js +118 -0
- 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-typesafe/src/index.js +17 -0
- package/packages/datadog-plugin-typesafe/src/tracing.js +31 -0
- package/packages/datadog-plugin-undici/src/index.js +22 -7
- package/packages/datadog-plugin-vitest/src/index.js +8 -0
- package/packages/datadog-turbopack/index.js +4 -28
- package/packages/datadog-turbopack/src/loader.js +14 -452
- package/packages/datadog-webpack/index.js +3 -55
- package/packages/dd-trace/src/agent/info.js +2 -1
- package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
- package/packages/dd-trace/src/aiguard/sdk.js +8 -13
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/blocking/index.js +4 -0
- package/packages/dd-trace/src/appsec/graphql.js +91 -6
- package/packages/dd-trace/src/appsec/recommended.json +1287 -90
- 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 +24 -18
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +16 -36
- 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 +10 -18
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +10 -15
- package/packages/dd-trace/src/ci-visibility/requests/route.js +44 -0
- package/packages/dd-trace/src/ci-visibility/telemetry-logs.js +5 -0
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
- package/packages/dd-trace/src/ci-visibility/test-annotations.js +72 -0
- package/packages/dd-trace/src/ci-visibility/test-declaration-annotations.js +170 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +10 -17
- 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 +9 -3
- package/packages/dd-trace/src/config/generated-config-types.d.ts +46 -2
- package/packages/dd-trace/src/config/index.js +111 -43
- package/packages/dd-trace/src/config/parsers.js +18 -1
- package/packages/dd-trace/src/config/supported-configurations.json +174 -4
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +2 -1
- package/packages/dd-trace/src/debugger/probe_sampler.js +6 -6
- package/packages/dd-trace/src/encode/0.4.js +2 -2
- package/packages/dd-trace/src/esm-module-load.js +58 -0
- package/packages/dd-trace/src/exporter.js +23 -15
- package/packages/dd-trace/src/exporters/agent/index.js +3 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +3 -1
- package/packages/dd-trace/src/exporters/common/request.js +83 -50
- 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/exporters/llmobs/index.js +135 -0
- package/packages/dd-trace/src/exporters/log/index.js +4 -3
- package/packages/dd-trace/src/id.js +1 -1
- package/packages/dd-trace/src/lambda/facade.js +74 -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 +3 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
- package/packages/dd-trace/src/llmobs/experiments/index.js +2 -3
- package/packages/dd-trace/src/llmobs/experiments/noop.js +5 -2
- package/packages/dd-trace/src/llmobs/index.js +13 -2
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +27 -10
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
- package/packages/dd-trace/src/llmobs/plugins/typesafe/index.js +102 -0
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
- package/packages/dd-trace/src/llmobs/prompts/cache.js +3 -1
- package/packages/dd-trace/src/llmobs/sdk.js +21 -1
- package/packages/dd-trace/src/llmobs/span_processor.js +219 -12
- package/packages/dd-trace/src/llmobs/tagger.js +25 -0
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -3
- package/packages/dd-trace/src/log/channels.js +4 -0
- package/packages/dd-trace/src/log/writer.js +13 -2
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +68 -6
- package/packages/dd-trace/src/openfeature/configuration_source.js +41 -17
- package/packages/dd-trace/src/openfeature/debug-logging-hook.js +66 -3
- package/packages/dd-trace/src/openfeature/exposure-hook.js +185 -0
- package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +58 -14
- package/packages/dd-trace/src/openfeature/remote_config.js +16 -3
- package/packages/dd-trace/src/openfeature/writers/base.js +63 -30
- package/packages/dd-trace/src/openfeature/writers/exposures.js +161 -1
- package/packages/dd-trace/src/openfeature/writers/flag-eval-evp-hook.js +5 -0
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-aggregation.js +9 -4
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-payload.js +2 -0
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-pii.js +2 -0
- package/packages/dd-trace/src/openfeature/writers/split-features.js +25 -0
- 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/metrics/periodic_metric_reader.js +2 -2
- 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/opentelemetry/tracer_provider.js +5 -1
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
- package/packages/dd-trace/src/opentracing/tracer.js +33 -13
- package/packages/dd-trace/src/otel-thread-ctx.js +72 -49
- package/packages/dd-trace/src/plugin_manager.js +34 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +45 -14
- package/packages/dd-trace/src/plugins/index.js +9 -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 +18 -1
- package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
- package/packages/dd-trace/src/plugins/util/git.js +273 -86
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +77 -50
- 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 +90 -45
- package/packages/dd-trace/src/plugins/util/url.js +10 -2
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +2 -2
- package/packages/dd-trace/src/plugins/util/web.js +81 -10
- package/packages/dd-trace/src/process-tags/index.js +1 -1
- package/packages/dd-trace/src/profiling/config.js +6 -3
- package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
- package/packages/dd-trace/src/proxy.js +48 -57
- package/packages/dd-trace/src/serverless.js +3 -2
- package/packages/dd-trace/src/span_processor.js +41 -9
- package/packages/dd-trace/src/span_stats.js +28 -2
- package/packages/dd-trace/src/startup-log.js +8 -5
- package/packages/dd-trace/src/tagger.js +7 -5
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -0
- package/packages/dd-trace/src/telemetry/index.js +3 -0
- package/packages/dd-trace/src/telemetry/logs/index.js +21 -2
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +1 -0
- package/packages/dd-trace/src/telemetry/metrics.js +2 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +10 -3
- package/packages/dd-trace/src/tracer.js +0 -2
- package/packages/dd-trace/src/util.js +1 -1
- package/packages/dd-trace/src/web-tags-cache.js +8 -9
- package/register.js +4 -2
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
- package/vendor/dist/{@opentelemetry/resources → @datadog/flagging-core}/LICENSE +22 -2
- 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/index.js +1 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.d.ts +78 -0
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.js +1 -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 +209 -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/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 -19
- 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 -650
- 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/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
- package/vendor/dist/@opentelemetry/resources/index.js +0 -1
|
@@ -4,6 +4,7 @@ const os = require('os')
|
|
|
4
4
|
const SpanProcessor = require('../span_processor')
|
|
5
5
|
const PrioritySampler = require('../priority_sampler')
|
|
6
6
|
const formats = require('../../../../ext/formats')
|
|
7
|
+
const exporters = require('../../../../ext/exporters')
|
|
7
8
|
const log = require('../log')
|
|
8
9
|
const runtimeMetrics = require('../runtime_metrics')
|
|
9
10
|
const getExporter = require('../exporter')
|
|
@@ -20,6 +21,12 @@ const REFERENCE_CHILD_OF = 'child_of'
|
|
|
20
21
|
const REFERENCE_FOLLOWS_FROM = 'follows_from'
|
|
21
22
|
|
|
22
23
|
class DatadogTracer {
|
|
24
|
+
/**
|
|
25
|
+
* @readonly
|
|
26
|
+
* @type {import('../opentelemetry/startup-config').Pipelines}
|
|
27
|
+
*/
|
|
28
|
+
#startupConfig
|
|
29
|
+
|
|
23
30
|
constructor (config, prioritySampler) {
|
|
24
31
|
this._config = config
|
|
25
32
|
this._service = config.service
|
|
@@ -31,21 +38,22 @@ class DatadogTracer {
|
|
|
31
38
|
this._debug = config.debug
|
|
32
39
|
this._prioritySampler = prioritySampler ?? new PrioritySampler(config.env, config.sampler)
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// (test_session/test_module/ test_suite/test) belong on the citestcycle
|
|
37
|
-
// endpoint, not on an OTLP traces endpoint — otherwise users with OTEL_*
|
|
38
|
-
// vars set in their environment (e.g. for a separate telemetry integration)
|
|
39
|
-
// silently lose all test spans. The same applies to the Electron exporter:
|
|
40
|
-
// spans must reach the Electron SDK's IPC bridge, not an OTLP endpoint,
|
|
41
|
-
// even when OTEL_* vars are set for unrelated telemetry.
|
|
42
|
-
const exportOtlpTraces = config.OTEL_TRACES_EXPORTER === 'otlp' && !config.isCiVisibility &&
|
|
43
|
-
config.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER !== 'electron'
|
|
41
|
+
const exportOtlpTraces = getExporter.usesOtlpTraceExporter(config)
|
|
42
|
+
let traces
|
|
44
43
|
if (exportOtlpTraces) {
|
|
45
44
|
const { createOtlpTraceExporter } = require('../opentelemetry/trace')
|
|
46
45
|
this._exporter = createOtlpTraceExporter(config)
|
|
46
|
+
traces = {
|
|
47
|
+
protocol: this._exporter.protocol,
|
|
48
|
+
resourceAttributes: this._exporter.getStartupResourceAttributes(),
|
|
49
|
+
}
|
|
47
50
|
} else {
|
|
48
|
-
|
|
51
|
+
let exporterName = config.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER
|
|
52
|
+
if (config.llmobs?.DD_LLMOBS_ENABLED && !config.isCiVisibility &&
|
|
53
|
+
(!exporterName || exporterName === exporters.AGENT || exporterName === exporters.AGENTLESS)) {
|
|
54
|
+
exporterName = exporters.LLMOBS
|
|
55
|
+
}
|
|
56
|
+
const Exporter = getExporter(exporterName)
|
|
49
57
|
this._exporter = new Exporter(config, this._prioritySampler)
|
|
50
58
|
}
|
|
51
59
|
|
|
@@ -58,8 +66,7 @@ class DatadogTracer {
|
|
|
58
66
|
this._exporter,
|
|
59
67
|
this._prioritySampler,
|
|
60
68
|
config,
|
|
61
|
-
otlpStatsExporter
|
|
62
|
-
exportOtlpTraces
|
|
69
|
+
otlpStatsExporter
|
|
63
70
|
)
|
|
64
71
|
this._url = this._exporter._url
|
|
65
72
|
this._enableGetRumData = config.rum.DD_TRACE_EXPERIMENTAL_GET_RUM_DATA_ENABLED
|
|
@@ -71,11 +78,24 @@ class DatadogTracer {
|
|
|
71
78
|
[formats.LOG]: new LogPropagator(config),
|
|
72
79
|
[formats.TEXT_MAP_DSM]: new DSMTextMapPropagator(config),
|
|
73
80
|
}
|
|
81
|
+
this.#startupConfig = {
|
|
82
|
+
tracing: true,
|
|
83
|
+
traces,
|
|
84
|
+
spanMetrics: this._processor.getSpanMetricsStartupConfig(),
|
|
85
|
+
}
|
|
74
86
|
if (config.reportHostname) {
|
|
75
87
|
this._hostname = os.hostname()
|
|
76
88
|
}
|
|
77
89
|
}
|
|
78
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Returns the configuration captured when tracing initialized.
|
|
93
|
+
* @returns {import('../opentelemetry/startup-config').Pipelines}
|
|
94
|
+
*/
|
|
95
|
+
getStartupConfig () {
|
|
96
|
+
return this.#startupConfig
|
|
97
|
+
}
|
|
98
|
+
|
|
79
99
|
startSpan (name, options = {}) {
|
|
80
100
|
const parent = options.childOf
|
|
81
101
|
? getContext(options.childOf)
|
|
@@ -44,20 +44,22 @@ const webTagsCache = require('./web-tags-cache')
|
|
|
44
44
|
/** @typedef {import('./opentracing/span')} DatadogSpan */
|
|
45
45
|
/** @typedef {import('./opentracing/span_context')} DatadogSpanContext */
|
|
46
46
|
/** @typedef {InstanceType<typeof import('@datadog/pprof').otelThreadCtx.ThreadContext>} ThreadContext */
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {object} CachedContext
|
|
49
|
+
* @property {ThreadContext | undefined} context
|
|
50
|
+
* @property {ReturnType<DatadogSpanContext['getTags']> | undefined} webTags
|
|
51
|
+
* @property {number} endpointIndex
|
|
52
|
+
*/
|
|
47
53
|
|
|
48
|
-
// OTEP-4947 duplicates are last-wins, so
|
|
49
|
-
//
|
|
50
|
-
// record mid-request would still see the interim value (e.g. a bare `GET`) as
|
|
51
|
-
// the endpoint for whatever it was sampling. So a record is built without an
|
|
52
|
-
// endpoint until finalEndpoint (profiling/webspan-utils.js) reports the value
|
|
53
|
-
// settled, and gets one appended when webTagsCache announces that moment.
|
|
54
|
+
// OTEP-4947 duplicates are last-wins, so later endpoint values refine existing
|
|
55
|
+
// records. finalEndpoint excludes bare methods until routing supplies an endpoint.
|
|
54
56
|
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
+
// Active records are grouped by their web-server tag bag.
|
|
58
|
+
// Every span under one request resolves to that same bag
|
|
57
59
|
// (webTagsCache maps a span to its nearest web-server ancestor's tags) and the
|
|
58
|
-
// endpoint belongs to the request rather than to any one span, so
|
|
59
|
-
//
|
|
60
|
-
//
|
|
60
|
+
// endpoint belongs to the request rather than to any one span, so each change
|
|
61
|
+
// updates the request span's record and each descendant's.
|
|
62
|
+
// Descendants are the reason this cannot just live on the
|
|
61
63
|
// per-span cache entry: the tags:update that carries the route is published for
|
|
62
64
|
// the ancestor, which has no way to enumerate them.
|
|
63
65
|
//
|
|
@@ -67,9 +69,13 @@ const webTagsCache = require('./web-tags-cache')
|
|
|
67
69
|
// a bag, on already-expired spans under manual-GC debug mode — and webTagsCache
|
|
68
70
|
// already depends on it, holding bags the wall profiler dereferences much later.
|
|
69
71
|
//
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
+
// Records rebuilt after finish have no second finish event, so cleanup follows the span's GC lifetime.
|
|
73
|
+
/** @type {WeakMap<ReturnType<DatadogSpanContext['getTags']>, Array<CachedContext>>} */
|
|
72
74
|
const pendingEndpoints = new WeakMap()
|
|
75
|
+
/** @type {FinalizationRegistry<WeakRef<CachedContext>> | undefined} */
|
|
76
|
+
let endpointCleanup
|
|
77
|
+
const NOT_WAITING = -1
|
|
78
|
+
const AWAITING_OWN_ENDPOINT = -2
|
|
73
79
|
|
|
74
80
|
// Positional attribute layout. The local root span ID stays at index 0 by
|
|
75
81
|
// convention (mirrors libdatadog's libdd-otel-thread-ctx, where
|
|
@@ -122,14 +128,10 @@ function traceFlagsOf (spanContext) {
|
|
|
122
128
|
//
|
|
123
129
|
// Fields:
|
|
124
130
|
// context: ThreadContext from @datadog/pprof.otelThreadCtx — built the first
|
|
125
|
-
// time onEnter activates the span
|
|
126
|
-
// is how a pendingEndpoints waiter recognizes a record it must no
|
|
127
|
-
// longer append to.
|
|
131
|
+
// time onEnter activates the span.
|
|
128
132
|
// webTags: the web-server tag bag the record's endpoint comes from, or is
|
|
129
133
|
// waiting on; undefined while the span has no web-server ancestry.
|
|
130
|
-
//
|
|
131
|
-
// web-server span takes over.
|
|
132
|
-
// awaitsOwnEndpoint: this is the request span, waiting on its own endpoint.
|
|
134
|
+
// endpointIndex: slot in pendingEndpoints, or NOT_WAITING / AWAITING_OWN_ENDPOINT.
|
|
133
135
|
const CachedSym = Symbol('OtelThreadCtx.cached')
|
|
134
136
|
|
|
135
137
|
let started = false
|
|
@@ -205,7 +207,7 @@ function getOrBuildContext (span) {
|
|
|
205
207
|
attrs[THREAD_NAME_IDX] = THREAD_NAME
|
|
206
208
|
attrs[THREAD_ID_IDX] = THREAD_ID
|
|
207
209
|
if (cached === undefined) {
|
|
208
|
-
cached = { context: undefined, webTags: undefined,
|
|
210
|
+
cached = { context: undefined, webTags: undefined, endpointIndex: NOT_WAITING }
|
|
209
211
|
span[CachedSym] = cached
|
|
210
212
|
}
|
|
211
213
|
// The flags are the one part of the record that can still change after
|
|
@@ -216,12 +218,20 @@ function getOrBuildContext (span) {
|
|
|
216
218
|
// built before the decision keeps reading as not sampled.
|
|
217
219
|
cached.context = new ThreadContext(traceId, spanId, traceFlagsOf(spanContext), attrs)
|
|
218
220
|
cached.webTags = webTags
|
|
219
|
-
|
|
221
|
+
awaitEndpoint(span, webTags, cached)
|
|
222
|
+
if (spanContext._isFinished) {
|
|
223
|
+
endpointCleanup ??= new FinalizationRegistry(onSpanCollected)
|
|
224
|
+
endpointCleanup.register(span, new WeakRef(cached))
|
|
225
|
+
}
|
|
220
226
|
return cached.context
|
|
221
227
|
}
|
|
222
228
|
|
|
223
|
-
//
|
|
224
|
-
|
|
229
|
+
// Track the request's endpoint until this record finishes or changes ancestry.
|
|
230
|
+
/**
|
|
231
|
+
* @param {DatadogSpan} span
|
|
232
|
+
* @param {CachedContext['webTags']} webTags
|
|
233
|
+
* @param {CachedContext} cached
|
|
234
|
+
*/
|
|
225
235
|
function awaitEndpoint (span, webTags, cached) {
|
|
226
236
|
// No web-server span in this span's ancestry, so no endpoint is coming. Should
|
|
227
237
|
// one appear later, webTagsCache announces that separately — see
|
|
@@ -229,17 +239,42 @@ function awaitEndpoint (span, webTags, cached) {
|
|
|
229
239
|
if (webTags === undefined) return
|
|
230
240
|
// The request span waits on its own announcement; only descendants need the shared list.
|
|
231
241
|
if (webTags === span.context().getTags()) {
|
|
232
|
-
cached.
|
|
242
|
+
cached.endpointIndex = AWAITING_OWN_ENDPOINT
|
|
233
243
|
return
|
|
234
244
|
}
|
|
235
245
|
const waiting = pendingEndpoints.get(webTags)
|
|
236
246
|
if (waiting === undefined) {
|
|
247
|
+
cached.endpointIndex = 0
|
|
237
248
|
pendingEndpoints.set(webTags, [cached])
|
|
238
249
|
} else {
|
|
250
|
+
cached.endpointIndex = waiting.length
|
|
239
251
|
waiting.push(cached)
|
|
240
252
|
}
|
|
241
253
|
}
|
|
242
254
|
|
|
255
|
+
/** @param {WeakRef<CachedContext>} reference */
|
|
256
|
+
function onSpanCollected (reference) {
|
|
257
|
+
const cached = reference.deref()
|
|
258
|
+
if (cached !== undefined) removePendingEndpoint(cached)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** @param {CachedContext} cached */
|
|
262
|
+
function removePendingEndpoint (cached) {
|
|
263
|
+
const index = cached.endpointIndex
|
|
264
|
+
if (index < 0) return
|
|
265
|
+
const waiting = pendingEndpoints.get(cached.webTags)
|
|
266
|
+
const last = waiting.pop()
|
|
267
|
+
if (last !== cached) {
|
|
268
|
+
waiting[index] = last
|
|
269
|
+
last.endpointIndex = index
|
|
270
|
+
}
|
|
271
|
+
cached.endpointIndex = NOT_WAITING
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @param {ThreadContext} context
|
|
276
|
+
* @param {string} endpoint
|
|
277
|
+
*/
|
|
243
278
|
function appendEndpoint (context, endpoint) {
|
|
244
279
|
// Append in place. The record buffer is shared across every async-context
|
|
245
280
|
// frame holding this context, so the endpoint becomes visible everywhere at
|
|
@@ -264,6 +299,7 @@ function onEnter () {
|
|
|
264
299
|
context.enter()
|
|
265
300
|
}
|
|
266
301
|
|
|
302
|
+
/** @param {DatadogSpan} span */
|
|
267
303
|
function onSpanFinished (span) {
|
|
268
304
|
if (!started) return
|
|
269
305
|
const cached = span[CachedSym]
|
|
@@ -271,6 +307,7 @@ function onSpanFinished (span) {
|
|
|
271
307
|
span[CachedSym] = undefined
|
|
272
308
|
const context = cached.context
|
|
273
309
|
if (context === undefined) return
|
|
310
|
+
removePendingEndpoint(cached)
|
|
274
311
|
// The span is over, so its record must stop presenting itself as an active
|
|
275
312
|
// thread context to an out-of-process reader. Invalidating the record covers
|
|
276
313
|
// every async-context frame still holding this same context reference —
|
|
@@ -280,9 +317,6 @@ function onSpanFinished (span) {
|
|
|
280
317
|
// overwrite the record, and in ACF mode there is no `before` hook either, so
|
|
281
318
|
// they would keep exposing the finished span's IDs.
|
|
282
319
|
context.invalidate()
|
|
283
|
-
// Marks the record dead for any pendingEndpoints waiter still holding this
|
|
284
|
-
// entry, which must not append to an invalidated record.
|
|
285
|
-
cached.context = undefined
|
|
286
320
|
// Also detach from the current frame when it is the holder, so the record
|
|
287
321
|
// becomes unreachable and collectable instead of lingering as an invalid one
|
|
288
322
|
// for the rest of the frame's life.
|
|
@@ -299,29 +333,24 @@ function onSpanFinished (span) {
|
|
|
299
333
|
// would strip trace and endpoint attribution off that work entirely.
|
|
300
334
|
}
|
|
301
335
|
|
|
302
|
-
//
|
|
303
|
-
|
|
304
|
-
// descendants enlisted under.
|
|
336
|
+
// Update the active records when a request's endpoint becomes available or changes.
|
|
337
|
+
/** @param {DatadogSpan} span */
|
|
305
338
|
function onEndpointResolved (span) {
|
|
306
339
|
if (!started) return
|
|
307
340
|
const webTags = span.context().getTags()
|
|
308
341
|
const own = span[CachedSym]
|
|
309
|
-
const ownWaits = own !== undefined && own.
|
|
342
|
+
const ownWaits = own !== undefined && own.endpointIndex === AWAITING_OWN_ENDPOINT
|
|
310
343
|
const waiting = pendingEndpoints.get(webTags)
|
|
311
344
|
if (!ownWaits && waiting === undefined) return
|
|
312
345
|
const endpoint = finalEndpoint(webTags)
|
|
313
|
-
// webTagsCache only announces
|
|
346
|
+
// webTagsCache only announces available endpoints, so this is belt and braces.
|
|
314
347
|
if (endpoint === undefined) return
|
|
315
348
|
if (ownWaits) {
|
|
316
|
-
own.
|
|
317
|
-
if (own.context !== undefined && own.webTags === webTags) appendEndpoint(own.context, endpoint)
|
|
349
|
+
appendEndpoint(own.context, endpoint)
|
|
318
350
|
}
|
|
319
351
|
if (waiting === undefined) return
|
|
320
|
-
pendingEndpoints.delete(webTags)
|
|
321
352
|
for (const cached of waiting) {
|
|
322
|
-
|
|
323
|
-
// enlisted again under that bag, and this one is no longer its endpoint.
|
|
324
|
-
if (cached.context !== undefined && cached.webTags === webTags) appendEndpoint(cached.context, endpoint)
|
|
353
|
+
appendEndpoint(cached.context, endpoint)
|
|
325
354
|
}
|
|
326
355
|
}
|
|
327
356
|
|
|
@@ -330,25 +359,19 @@ function onEndpointResolved (span) {
|
|
|
330
359
|
// built without any web-server ancestry its first endpoint, or a nearer
|
|
331
360
|
// web-server span superseded the one this record is showing. Give the record
|
|
332
361
|
// the new request's endpoint if it has settled, or wait for its announcement.
|
|
362
|
+
/** @param {DatadogSpan} span */
|
|
333
363
|
function onWebTagsResolved (span) {
|
|
334
364
|
if (!started) return
|
|
335
365
|
const cached = span[CachedSym]
|
|
336
366
|
if (cached === undefined || cached.context === undefined) return
|
|
337
367
|
const webTags = webTagsCache.getCachedWebTags(span)
|
|
338
368
|
if (webTags === cached.webTags) return
|
|
339
|
-
|
|
340
|
-
// waiting on no longer applies to it.
|
|
369
|
+
removePendingEndpoint(cached)
|
|
341
370
|
cached.webTags = webTags
|
|
342
371
|
const endpoint = finalEndpoint(webTags)
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
// there is no way to take the attribute back, and rebuilding the
|
|
347
|
-
// ThreadContext would strand every async-context frame holding this one.
|
|
348
|
-
// The work is still nested in the outer request, which makes that the least
|
|
349
|
-
// wrong of the values available.
|
|
350
|
-
awaitEndpoint(span, webTags, cached)
|
|
351
|
-
} else {
|
|
372
|
+
awaitEndpoint(span, webTags, cached)
|
|
373
|
+
// Keep the outer endpoint until the nearer request supplies a replacement; records are append-only.
|
|
374
|
+
if (endpoint !== undefined) {
|
|
352
375
|
appendEndpoint(cached.context, endpoint)
|
|
353
376
|
}
|
|
354
377
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const { channel } = require('dc-polyfill')
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
|
-
getEnvironmentVariable,
|
|
7
6
|
getValueFromEnvSources,
|
|
8
7
|
isSupportedConfiguration,
|
|
9
8
|
} = require('./config/helper')
|
|
@@ -45,18 +44,15 @@ loadChannel.subscribe(({ name }) => {
|
|
|
45
44
|
|
|
46
45
|
// instrument everything that needs Plugin System V2 instrumentation
|
|
47
46
|
require('../../datadog-instrumentations')
|
|
48
|
-
if (getEnvironmentVariable('AWS_LAMBDA_FUNCTION_NAME') !== undefined) {
|
|
49
|
-
// instrument lambda environment
|
|
50
|
-
require('./lambda')
|
|
51
|
-
}
|
|
52
47
|
|
|
53
48
|
function maybeEnable (Plugin) {
|
|
54
49
|
if (!Plugin || typeof Plugin !== 'function') return
|
|
55
|
-
|
|
50
|
+
const disabled = disabledPlugins.has(Plugin.id)
|
|
51
|
+
if (!pluginClasses[Plugin.id] || disabled) {
|
|
56
52
|
const enabled = getEnabled(Plugin)
|
|
57
53
|
|
|
58
54
|
// TODO: remove the need to load the plugin class in order to disable the plugin
|
|
59
|
-
if (isFalse(enabled) ||
|
|
55
|
+
if (isFalse(enabled) || disabled) {
|
|
60
56
|
log.debug('Plugin "%s" was disabled via configuration option.', Plugin.id)
|
|
61
57
|
|
|
62
58
|
pluginClasses[Plugin.id] = null
|
|
@@ -159,6 +155,10 @@ module.exports = class PluginManager {
|
|
|
159
155
|
for (const name in pluginClasses) {
|
|
160
156
|
this.loadPlugin(name)
|
|
161
157
|
}
|
|
158
|
+
|
|
159
|
+
// Initialization can publish load events that configure plugins immediately; use the current settings.
|
|
160
|
+
const initializeLambda = require('./lambda')
|
|
161
|
+
initializeLambda()
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// This is basically just for testing. like intrumenter.disable()
|
|
@@ -181,6 +181,7 @@ module.exports = class PluginManager {
|
|
|
181
181
|
#getSharedConfig (name) {
|
|
182
182
|
const {
|
|
183
183
|
logInjection,
|
|
184
|
+
lambda,
|
|
184
185
|
serviceMapping,
|
|
185
186
|
DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP,
|
|
186
187
|
site,
|
|
@@ -209,6 +210,9 @@ module.exports = class PluginManager {
|
|
|
209
210
|
traceWebsocketMessagesSeparateTraces,
|
|
210
211
|
tracing,
|
|
211
212
|
DD_TRACE_RESOURCE_RENAMING_ENABLED,
|
|
213
|
+
DD_APM_FLUSH_DEADLINE_MILLISECONDS,
|
|
214
|
+
DD_API_KEY,
|
|
215
|
+
DD_TRACE_AWS_ADD_SPAN_POINTERS,
|
|
212
216
|
} = /** @type {import('./config/config-base')} */ (this._tracerConfig)
|
|
213
217
|
|
|
214
218
|
const sharedConfig = {
|
|
@@ -267,6 +271,29 @@ module.exports = class PluginManager {
|
|
|
267
271
|
sharedConfig.depth = DD_TRACE_GRAPHQL_DEPTH
|
|
268
272
|
sharedConfig.variables = DD_TRACE_GRAPHQL_VARIABLES
|
|
269
273
|
sharedConfig.errorExtensions = DD_TRACE_GRAPHQL_ERROR_EXTENSIONS
|
|
274
|
+
} else if (name === 'aws-lambda') {
|
|
275
|
+
Object.assign(sharedConfig, {
|
|
276
|
+
addSpanPointers: DD_TRACE_AWS_ADD_SPAN_POINTERS,
|
|
277
|
+
apiKey: DD_API_KEY,
|
|
278
|
+
apiKeyKms: lambda?.DD_KMS_API_KEY,
|
|
279
|
+
apiKeySecretArn: lambda?.DD_API_KEY_SECRET_ARN,
|
|
280
|
+
apmFlushDeadlineMs: DD_APM_FLUSH_DEADLINE_MILLISECONDS,
|
|
281
|
+
captureLambdaPayload: lambda?.DD_CAPTURE_LAMBDA_PAYLOAD,
|
|
282
|
+
captureLambdaPayloadMaxDepth: lambda?.DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH,
|
|
283
|
+
coldStartTraceSkipLib: lambda?.DD_COLD_START_TRACE_SKIP_LIB,
|
|
284
|
+
coldStartTracing: lambda?.DD_COLD_START_TRACING,
|
|
285
|
+
createInferredSpan: lambda?.DD_TRACE_MANAGED_SERVICES,
|
|
286
|
+
dataStreamsEnabled: dsmEnabled,
|
|
287
|
+
decodeAuthorizerContext: lambda?.DD_DECODE_AUTHORIZER_CONTEXT,
|
|
288
|
+
encodeAuthorizerContext: lambda?.DD_ENCODE_AUTHORIZER_CONTEXT,
|
|
289
|
+
enhancedMetrics: lambda?.DD_ENHANCED_METRICS,
|
|
290
|
+
fipsMode: lambda?.DD_LAMBDA_FIPS_MODE,
|
|
291
|
+
logForwarding: lambda?.DD_FLUSH_TO_LOG,
|
|
292
|
+
logInjection,
|
|
293
|
+
mergeXrayTraces: lambda?.DD_MERGE_XRAY_TRACES,
|
|
294
|
+
minColdStartTraceDurationMs: lambda?.DD_MIN_COLD_START_DURATION,
|
|
295
|
+
serviceRepresentationEnabled: lambda?.DD_TRACE_AWS_SERVICE_REPRESENTATION_ENABLED,
|
|
296
|
+
})
|
|
270
297
|
}
|
|
271
298
|
|
|
272
299
|
return sharedConfig
|
|
@@ -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 } = require('./util/user-provided-git')
|
|
39
56
|
const {
|
|
40
57
|
getTestEnvironmentMetadata,
|
|
41
58
|
getTestLevelsMetadataTags,
|
|
@@ -223,7 +240,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
223
240
|
this.libraryConfig = undefined
|
|
224
241
|
this.itrCorrelationId = undefined
|
|
225
242
|
this.skippableSuitesCoverage = undefined
|
|
226
|
-
log.error('Library configuration could not be fetched
|
|
243
|
+
log.error('Library configuration could not be fetched', err)
|
|
227
244
|
this._addRequestErrorTag(DD_CI_LIBRARY_CONFIGURATION_ERROR_SETTINGS, err)
|
|
228
245
|
} else {
|
|
229
246
|
this.libraryConfig = effectiveLibraryConfig
|
|
@@ -263,7 +280,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
263
280
|
},
|
|
264
281
|
(err, skippableSuites, itrCorrelationId, skippableSuitesCoverage) => {
|
|
265
282
|
if (err) {
|
|
266
|
-
log.error('Skippable suites could not be fetched
|
|
283
|
+
log.error('Skippable suites could not be fetched', err)
|
|
267
284
|
this._addRequestErrorTag(DD_CI_LIBRARY_CONFIGURATION_ERROR_SKIPPABLE_TESTS, err)
|
|
268
285
|
} else {
|
|
269
286
|
this.itrCorrelationId = itrCorrelationId
|
|
@@ -378,7 +395,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
378
395
|
}
|
|
379
396
|
this.tracer._exporter.getKnownTests(this.testConfiguration, (err, knownTests) => {
|
|
380
397
|
if (err) {
|
|
381
|
-
log.error('Known tests could not be fetched
|
|
398
|
+
log.error('Known tests could not be fetched', err)
|
|
382
399
|
this._addRequestErrorTag(DD_CI_LIBRARY_CONFIGURATION_ERROR_KNOWN_TESTS, err)
|
|
383
400
|
if (this.libraryConfig) {
|
|
384
401
|
this.libraryConfig = Object.freeze({
|
|
@@ -402,7 +419,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
402
419
|
}
|
|
403
420
|
this.tracer._exporter.getTestManagementTests(this.testConfiguration, (err, testManagementTests) => {
|
|
404
421
|
if (err) {
|
|
405
|
-
log.error('Test management tests could not be fetched
|
|
422
|
+
log.error('Test management tests could not be fetched', err)
|
|
406
423
|
this._addRequestErrorTag(DD_CI_LIBRARY_CONFIGURATION_ERROR_TEST_MANAGEMENT_TESTS, err)
|
|
407
424
|
if (this.libraryConfig) {
|
|
408
425
|
this.libraryConfig = Object.freeze({
|
|
@@ -420,16 +437,21 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
420
437
|
})
|
|
421
438
|
|
|
422
439
|
this.addSub(`ci:${this.constructor.id}:modified-files`, ({ onDone }) => {
|
|
440
|
+
const isCustomCheckout = this.testEnvironmentMetadata[GIT_CHECKOUT_IS_CUSTOM] === 'true'
|
|
441
|
+
const diffMetadata = isCustomCheckout ? getUserProviderGitMetadata() : this.testEnvironmentMetadata
|
|
423
442
|
const {
|
|
424
443
|
[GIT_PULL_REQUEST_BASE_BRANCH]: pullRequestBaseBranch,
|
|
425
444
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseBranchSha,
|
|
426
445
|
[GIT_COMMIT_HEAD_SHA]: commitHeadSha,
|
|
427
|
-
} =
|
|
446
|
+
} = diffMetadata
|
|
447
|
+
const targetCommit = commitHeadSha ||
|
|
448
|
+
(isCustomCheckout ? this.testEnvironmentMetadata[GIT_COMMIT_SHA] : undefined)
|
|
428
449
|
|
|
429
|
-
const baseBranchSha = pullRequestBaseBranchSha ||
|
|
450
|
+
const baseBranchSha = pullRequestBaseBranchSha ||
|
|
451
|
+
getPullRequestBaseBranch(pullRequestBaseBranch, this.repositoryRoot)
|
|
430
452
|
|
|
431
453
|
if (baseBranchSha) {
|
|
432
|
-
const diff = getPullRequestDiff(baseBranchSha,
|
|
454
|
+
const diff = getPullRequestDiff(baseBranchSha, targetCommit, this.repositoryRoot)
|
|
433
455
|
const modifiedFiles = getModifiedFilesFromDiff(diff)
|
|
434
456
|
|
|
435
457
|
if (modifiedFiles) {
|
|
@@ -602,6 +624,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
602
624
|
if (!repositoryRoot || repositoryRoot === this.repositoryRoot) return
|
|
603
625
|
|
|
604
626
|
this.repositoryRoot = repositoryRoot
|
|
627
|
+
if (this.testConfiguration) this.testConfiguration.gitRoot = repositoryRoot
|
|
605
628
|
if (codeOwnersEntries === undefined) {
|
|
606
629
|
this.codeOwnersEntries = getCodeOwnersFileEntries(this.repositoryRoot)
|
|
607
630
|
}
|
|
@@ -640,11 +663,14 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
640
663
|
if (span.name === `${this.constructor.id}.test` || span.name === `${this.constructor.id}.test_suite`) {
|
|
641
664
|
Object.assign(span.meta, getSessionItrSkippingEnabledTags(this.testSessionSpan))
|
|
642
665
|
}
|
|
643
|
-
//
|
|
644
|
-
for (const key
|
|
666
|
+
// Replace worker repository metadata, including fields omitted by the coordinator.
|
|
667
|
+
for (const key of REPOSITORY_METADATA_KEYS) {
|
|
668
|
+
delete span.meta[key]
|
|
669
|
+
}
|
|
670
|
+
for (const key of Object.keys(this.testEnvironmentMetadata)) {
|
|
645
671
|
// CAREFUL: this bypasses the metadata/metrics distinction
|
|
646
672
|
// Be careful not to pass numbers in `meta`
|
|
647
|
-
if (key.startsWith('git.')) {
|
|
673
|
+
if (key.startsWith('git.') || key === CI_WORKSPACE_PATH || key === CI_GIT_MERGE_COMMIT_SHA) {
|
|
648
674
|
span.meta[key] = this.testEnvironmentMetadata[key]
|
|
649
675
|
}
|
|
650
676
|
}
|
|
@@ -811,7 +837,8 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
811
837
|
[RUNTIME_VERSION]: runtimeVersion,
|
|
812
838
|
[GIT_BRANCH]: branch,
|
|
813
839
|
[CI_PROVIDER_NAME]: ciProviderName,
|
|
814
|
-
[
|
|
840
|
+
[GIT_CHECKOUT_ROOT]: gitRoot,
|
|
841
|
+
[GIT_CHECKOUT_IS_CUSTOM]: isCustomCheckout,
|
|
815
842
|
[GIT_COMMIT_MESSAGE]: commitMessage,
|
|
816
843
|
[GIT_TAG]: tag,
|
|
817
844
|
[GIT_PULL_REQUEST_BASE_BRANCH_SHA]: pullRequestBaseSha,
|
|
@@ -819,7 +846,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
819
846
|
[GIT_COMMIT_HEAD_MESSAGE]: commitHeadMessage,
|
|
820
847
|
} = this.testEnvironmentMetadata
|
|
821
848
|
|
|
822
|
-
this.repositoryRoot =
|
|
849
|
+
this.repositoryRoot = gitRoot ||
|
|
823
850
|
(shouldDeferRepositoryRoot ? process.cwd() : getRepositoryRoot() || process.cwd())
|
|
824
851
|
|
|
825
852
|
this.codeOwnersEntries = shouldDeferCodeOwnersEntries ? null : getCodeOwnersFileEntries(this.repositoryRoot)
|
|
@@ -829,6 +856,7 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
829
856
|
this.testConfiguration = {
|
|
830
857
|
repositoryUrl,
|
|
831
858
|
sha,
|
|
859
|
+
gitRoot: this.repositoryRoot,
|
|
832
860
|
osVersion,
|
|
833
861
|
osPlatform,
|
|
834
862
|
osArchitecture,
|
|
@@ -839,8 +867,11 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
839
867
|
commitMessage,
|
|
840
868
|
tag,
|
|
841
869
|
pullRequestBaseSha,
|
|
842
|
-
|
|
843
|
-
|
|
870
|
+
// Only an explicit PR head can override the selected commit in a custom checkout.
|
|
871
|
+
commitHeadSha: isCustomCheckout === 'true'
|
|
872
|
+
? getUserProviderGitMetadata()[GIT_COMMIT_HEAD_SHA]
|
|
873
|
+
: commitHeadSha,
|
|
874
|
+
commitHeadMessage: isCustomCheckout === 'true' ? undefined : commitHeadMessage,
|
|
844
875
|
}
|
|
845
876
|
}
|
|
846
877
|
|
|
@@ -15,10 +15,12 @@ const plugins = {
|
|
|
15
15
|
get '@supabase/postgrest-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
16
16
|
get '@supabase/realtime-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
17
17
|
get '@supabase/storage-js' () { return require('../../../datadog-plugin-supabase/src') },
|
|
18
|
+
get '@trpc/server' () { return require('../../../datadog-plugin-trpc/src') },
|
|
18
19
|
get 'durable-functions' () { return require('../../../datadog-plugin-azure-durable-functions/src') },
|
|
19
20
|
get '@azure/service-bus' () { return require('../../../datadog-plugin-azure-service-bus/src') },
|
|
20
21
|
get '@cucumber/cucumber' () { return require('../../../datadog-plugin-cucumber/src') },
|
|
21
22
|
get '@playwright/test' () { return require('../../../datadog-plugin-playwright/src') },
|
|
23
|
+
get '@elevenlabs/elevenlabs-js' () { return require('../../../datadog-plugin-elevenlabs/src') },
|
|
22
24
|
get '@elastic/elasticsearch' () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
23
25
|
get '@elastic/transport' () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
24
26
|
get '@google-cloud/pubsub' () { return require('../../../datadog-plugin-google-cloud-pubsub/src') },
|
|
@@ -41,16 +43,20 @@ const plugins = {
|
|
|
41
43
|
get '@redis/client' () { return require('../../../datadog-plugin-redis/src') },
|
|
42
44
|
get '@smithy/core' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
43
45
|
get '@smithy/smithy-client' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
46
|
+
get '@typesafe-ai/sdk' () { return require('../../../datadog-plugin-typesafe/src') },
|
|
44
47
|
get '@vitest/runner' () { return require('../../../datadog-plugin-vitest/src') },
|
|
45
48
|
get '@wdio/jasmine-framework' () { return require('../../../datadog-plugin-mocha/src') },
|
|
46
49
|
get '@wdio/local-runner' () { return require('../../../datadog-plugin-mocha/src') },
|
|
47
50
|
get '@langchain/langgraph' () { return require('../../../datadog-plugin-langgraph/src') },
|
|
48
51
|
get '@openai/agents' () { return require('../../../datadog-plugin-openai-agents/src') },
|
|
52
|
+
get '@openai/agents-realtime' () { return require('../../../datadog-plugin-openai/src') },
|
|
49
53
|
get aerospike () { return require('../../../datadog-plugin-aerospike/src') },
|
|
50
54
|
get ai () { return require('../../../datadog-plugin-ai/src') },
|
|
51
55
|
get amqp10 () { return require('../../../datadog-plugin-amqp10/src') },
|
|
52
56
|
get amqplib () { return require('../../../datadog-plugin-amqplib/src') },
|
|
57
|
+
get 'async-mutex' () { return require('../../../datadog-plugin-async-mutex/src') },
|
|
53
58
|
get avsc () { return require('../../../datadog-plugin-avsc/src') },
|
|
59
|
+
get 'aws-lambda' () { return require('../../../datadog-plugin-aws-lambda/src') },
|
|
54
60
|
get 'aws-sdk' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
55
61
|
get 'browser-bunyan' () { return require('../../../datadog-plugin-browser-bunyan/src') },
|
|
56
62
|
get bullmq () { return require('../../../datadog-plugin-bullmq/src') },
|
|
@@ -65,12 +71,14 @@ const plugins = {
|
|
|
65
71
|
get 'dd-trace-api' () { return require('../../../datadog-plugin-dd-trace-api/src') },
|
|
66
72
|
get elasticsearch () { return require('../../../datadog-plugin-elasticsearch/src') },
|
|
67
73
|
get electron () { return require('../../../datadog-plugin-electron/src') },
|
|
74
|
+
get elevenlabs () { return require('../../../datadog-plugin-elevenlabs/src') },
|
|
68
75
|
get express () { return require('../../../datadog-plugin-express/src') },
|
|
69
76
|
get fastify () { return require('../../../datadog-plugin-fastify/src') },
|
|
70
77
|
get 'find-my-way' () { return require('../../../datadog-plugin-find-my-way/src') },
|
|
71
78
|
get fs () { return require('../../../datadog-plugin-fs/src') },
|
|
72
79
|
get 'global:fetch' () { return require('../../../datadog-plugin-fetch/src') },
|
|
73
80
|
get graphql () { return require('../../../datadog-plugin-graphql/src') },
|
|
81
|
+
get 'graphql-jit' () { return require('../../../datadog-plugin-graphql/src') },
|
|
74
82
|
get grpc () { return require('../../../datadog-plugin-grpc/src') },
|
|
75
83
|
get hapi () { return require('../../../datadog-plugin-hapi/src') },
|
|
76
84
|
get hono () { return require('../../../datadog-plugin-hono/src') },
|
|
@@ -128,6 +136,7 @@ const plugins = {
|
|
|
128
136
|
get playwright () { return require('../../../datadog-plugin-playwright/src') },
|
|
129
137
|
get postgres () { return require('../../../datadog-plugin-postgres/src') },
|
|
130
138
|
get protobufjs () { return require('../../../datadog-plugin-protobufjs/src') },
|
|
139
|
+
get 'react-router' () { return require('../../../datadog-plugin-react-router/src') },
|
|
131
140
|
get redis () { return require('../../../datadog-plugin-redis/src') },
|
|
132
141
|
get restify () { return require('../../../datadog-plugin-restify/src') },
|
|
133
142
|
get rhea () { return require('../../../datadog-plugin-rhea/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))
|