dd-trace 5.134.0 → 5.136.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
|
@@ -16,6 +16,7 @@ const {
|
|
|
16
16
|
getDynamicAtrRetryCount,
|
|
17
17
|
} = require('../../dd-trace/src/ci-visibility/dynamic-atr-retries')
|
|
18
18
|
const { FINAL_FLUSH_TIMEOUT } = require('../../dd-trace/src/ci-visibility/final-flush')
|
|
19
|
+
const { getTestAnnotations, copyTestAnnotations } = require('../../dd-trace/src/ci-visibility/test-annotations')
|
|
19
20
|
const {
|
|
20
21
|
SCREENSHOT_UPLOAD_RESULT_ERROR,
|
|
21
22
|
SCREENSHOT_UPLOAD_RESULT_UPLOADED,
|
|
@@ -283,6 +284,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
283
284
|
static id = 'mocha'
|
|
284
285
|
|
|
285
286
|
#pendingWebdriverioVideos = new Set()
|
|
287
|
+
#webdriverioJasmineAnnotations = new Map()
|
|
286
288
|
#webdriverioCapture
|
|
287
289
|
#webdriverioVideoFlushTimer
|
|
288
290
|
|
|
@@ -402,6 +404,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
402
404
|
suiteFiles: new Map(),
|
|
403
405
|
suiteStatuses: new Map(),
|
|
404
406
|
tests: new Map(),
|
|
407
|
+
testAnnotations: this.#webdriverioJasmineAnnotations,
|
|
405
408
|
}
|
|
406
409
|
}
|
|
407
410
|
})
|
|
@@ -414,6 +417,29 @@ class MochaPlugin extends CiPlugin {
|
|
|
414
417
|
setWebdriverioRumTestCorrelation(ctx, activeSpan)
|
|
415
418
|
})
|
|
416
419
|
|
|
420
|
+
this.addSub('tracing:orchestrion:@wdio/jasmine-framework:JasmineAdapter_init:start', () => {
|
|
421
|
+
// Declarations run during adapter initialization, before coordinator settings arrive.
|
|
422
|
+
this.#webdriverioJasmineAnnotations = new Map()
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
this.addSub('tracing:orchestrion:@wdio/utils:runSpec:end', (ctx) => {
|
|
426
|
+
if (!ctx.result?.id) return
|
|
427
|
+
const annotations = getTestAnnotations(ctx.arguments?.[1])
|
|
428
|
+
if (annotations.mustFail || annotations.noAutoRetry) {
|
|
429
|
+
if (ctx.result.type === 'test') {
|
|
430
|
+
if (ctx.result.fn) {
|
|
431
|
+
// Mocha's runnable holds WebdriverIO's wrapper rather than the annotated callback.
|
|
432
|
+
copyTestAnnotations(ctx.arguments[1], ctx.result.fn)
|
|
433
|
+
} else {
|
|
434
|
+
// Mocha discards callbacks inherited from a pending suite.
|
|
435
|
+
ctx.result._ddDeclaredAnnotations = annotations
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
this.#webdriverioJasmineAnnotations.set(ctx.result.id, annotations)
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
})
|
|
442
|
+
|
|
417
443
|
this.addBind(jasmineTestFunctionStartCh, (ctx) => {
|
|
418
444
|
if (this.testFrameworkAdapter !== WEBDRIVERIO_JASMINE_ADAPTER) {
|
|
419
445
|
return storage('legacy').getStore()
|
|
@@ -853,7 +879,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
853
879
|
const store = storage('legacy').getStore()
|
|
854
880
|
// skipped through it.skip, so the span is not created yet
|
|
855
881
|
// for this test
|
|
856
|
-
if (!
|
|
882
|
+
if (!ctx.currentStore) {
|
|
857
883
|
const span = this.startTestSpan(ctx)
|
|
858
884
|
|
|
859
885
|
ctx.parentStore = store
|
|
@@ -1139,9 +1165,14 @@ class MochaPlugin extends CiPlugin {
|
|
|
1139
1165
|
const testSuite = getTestSuitePath(testSuiteAbsolutePath, this.sourceRoot)
|
|
1140
1166
|
const properties = this.libraryConfig?.testManagementTests?.mocha
|
|
1141
1167
|
?.suites?.[testSuite]?.tests?.[testName]?.properties || {}
|
|
1142
|
-
const
|
|
1143
|
-
const
|
|
1144
|
-
const
|
|
1168
|
+
const testAnnotations = state.testAnnotations.get(result.id) || getTestAnnotations()
|
|
1169
|
+
const assignedProperties = this.libraryConfig?.isTestManagementTestsEnabled ? properties : undefined
|
|
1170
|
+
const isAttemptToFix = this.libraryConfig?.isTestManagementTestsEnabled &&
|
|
1171
|
+
!testAnnotations.noAutoRetry && properties.attempt_to_fix
|
|
1172
|
+
const isDisabled = this.libraryConfig?.isTestManagementTestsEnabled &&
|
|
1173
|
+
!testAnnotations.mustFail && properties.disabled
|
|
1174
|
+
const isQuarantined = this.libraryConfig?.isTestManagementTestsEnabled &&
|
|
1175
|
+
!testAnnotations.mustFail && properties.quarantined
|
|
1145
1176
|
const isModified = this.libraryConfig?.isImpactedTestsEnabled && isModifiedTest(
|
|
1146
1177
|
getTestSuitePath(testSuiteAbsolutePath, this.repositoryRoot || this.sourceRoot),
|
|
1147
1178
|
null,
|
|
@@ -1152,10 +1183,10 @@ class MochaPlugin extends CiPlugin {
|
|
|
1152
1183
|
const knownTests = this.libraryConfig?.knownTests?.mocha
|
|
1153
1184
|
const isNew = this.libraryConfig?.isKnownTestsEnabled && knownTests &&
|
|
1154
1185
|
!(knownTests[testSuite] || []).includes(testName)
|
|
1155
|
-
const isEarlyFlakeDetection = this.libraryConfig?.isEarlyFlakeDetectionEnabled &&
|
|
1186
|
+
const isEarlyFlakeDetection = !testAnnotations.noAutoRetry && this.libraryConfig?.isEarlyFlakeDetectionEnabled &&
|
|
1156
1187
|
hasEfdRetries(this.libraryConfig.earlyFlakeDetectionRetryPolicy) &&
|
|
1157
1188
|
!isAttemptToFix && !isDisabled && (isNew || isModified)
|
|
1158
|
-
const isAtr = this.libraryConfig?.isFlakyTestRetriesEnabled &&
|
|
1189
|
+
const isAtr = !testAnnotations.noAutoRetry && this.libraryConfig?.isFlakyTestRetriesEnabled &&
|
|
1159
1190
|
!isAttemptToFix && !isEarlyFlakeDetection
|
|
1160
1191
|
let retryCount = 0
|
|
1161
1192
|
if (isAttemptToFix) {
|
|
@@ -1177,6 +1208,8 @@ class MochaPlugin extends CiPlugin {
|
|
|
1177
1208
|
}
|
|
1178
1209
|
|
|
1179
1210
|
const test = {
|
|
1211
|
+
assignedProperties,
|
|
1212
|
+
testAnnotations,
|
|
1180
1213
|
attempt: 0,
|
|
1181
1214
|
attemptStart: undefined,
|
|
1182
1215
|
currentStore: undefined,
|
|
@@ -1242,6 +1275,8 @@ class MochaPlugin extends CiPlugin {
|
|
|
1242
1275
|
test.attemptStart = performance.now()
|
|
1243
1276
|
test.hasFinalHookFailure = false
|
|
1244
1277
|
const span = this.startTestSpan({
|
|
1278
|
+
assignedProperties: test.assignedProperties,
|
|
1279
|
+
testAnnotations: test.testAnnotations,
|
|
1245
1280
|
hasDynamicName: test.hasDynamicName,
|
|
1246
1281
|
isAttemptToFix: test.isAttemptToFix,
|
|
1247
1282
|
isDisabled: test.isDisabled,
|
|
@@ -1923,6 +1958,12 @@ class MochaPlugin extends CiPlugin {
|
|
|
1923
1958
|
} = testInfo
|
|
1924
1959
|
|
|
1925
1960
|
const extraTags = {}
|
|
1961
|
+
const { testAnnotations, assignedProperties } = testInfo
|
|
1962
|
+
if (testAnnotations?.mustFail) extraTags['test.test_management.prevent_failure_suppression'] = 'true'
|
|
1963
|
+
if (testAnnotations?.noAutoRetry) extraTags['test.test_management.no_auto_retry'] = 'true'
|
|
1964
|
+
if (assignedProperties?.attempt_to_fix) extraTags[TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX] = 'true'
|
|
1965
|
+
if (assignedProperties?.disabled) extraTags[TEST_MANAGEMENT_IS_DISABLED] = 'true'
|
|
1966
|
+
if (assignedProperties?.quarantined) extraTags[TEST_MANAGEMENT_IS_QUARANTINED] = 'true'
|
|
1926
1967
|
const testParametersString = getTestParametersString(this._testTitleToParams, title)
|
|
1927
1968
|
if (testParametersString) {
|
|
1928
1969
|
extraTags[TEST_PARAMETERS] = testParametersString
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { channel } = require('dc-polyfill')
|
|
4
|
+
|
|
3
5
|
const ServerPlugin = require('../../dd-trace/src/plugins/server')
|
|
4
6
|
const { storage } = require('../../datadog-core')
|
|
5
7
|
const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
|
|
6
8
|
const { COMPONENT, SVC_SRC_KEY } = require('../../dd-trace/src/constants')
|
|
9
|
+
const {
|
|
10
|
+
HTTP_STATUS_ERROR,
|
|
11
|
+
INSTRUMENTATION_HTTP_RESOURCE,
|
|
12
|
+
isInstrumentationOwnedResource,
|
|
13
|
+
NETWORK_PEER_ADDRESS,
|
|
14
|
+
otelHttpResourceName,
|
|
15
|
+
setInstrumentationHttpResource,
|
|
16
|
+
} = require('../../dd-trace/src/plugins/util/http-otel-semantics')
|
|
7
17
|
const web = require('../../dd-trace/src/plugins/util/web')
|
|
8
18
|
const { HTTP_ROUTE, RESOURCE_NAME } = require('../../../ext/tags')
|
|
19
|
+
const { extractURL, obfuscateQs } = require('../../dd-trace/src/plugins/util/url')
|
|
9
20
|
|
|
10
21
|
const errorPages = new Set(['/404', '/500', '/_error', '/_not-found', '/_not-found/page'])
|
|
11
22
|
const reusedNextRequestStores = new WeakSet()
|
|
12
23
|
const nextParentRoutes = new WeakMap()
|
|
24
|
+
const requestMeta = Symbol.for('NextInternalRequestMeta')
|
|
25
|
+
const finishChannel = channel('apm:next:request:finish')
|
|
13
26
|
|
|
14
27
|
/**
|
|
15
28
|
* @typedef {Record<string, unknown> & {
|
|
@@ -18,8 +31,7 @@ const nextParentRoutes = new WeakMap()
|
|
|
18
31
|
* backgroundRevalidationRequest?: import('node:http').IncomingMessage
|
|
19
32
|
* }} NextRequestStore
|
|
20
33
|
*
|
|
21
|
-
* @typedef {
|
|
22
|
-
* @property {unknown} [error]
|
|
34
|
+
* @typedef {Request & { error?: unknown }} NextRequest
|
|
23
35
|
*
|
|
24
36
|
* @typedef {object} NextRequestContext
|
|
25
37
|
* @property {import('node:http').IncomingMessage} req
|
|
@@ -47,6 +59,33 @@ class NextPlugin extends ServerPlugin {
|
|
|
47
59
|
backgroundRevalidationRequest: req,
|
|
48
60
|
}))
|
|
49
61
|
this.addSub('apm:next:page:load', message => this.pageLoad(message))
|
|
62
|
+
for (const operation of ['imageRequest', 'imageRequestWithMiddleware']) {
|
|
63
|
+
const prefix = `tracing:orchestrion:next:${operation}`
|
|
64
|
+
this.addBind(`${prefix}:start`, ctx => {
|
|
65
|
+
const args = ctx.arguments
|
|
66
|
+
const pathname = (args[3] || args[2])?.pathname
|
|
67
|
+
if (!pathname?.startsWith('/_next/image')) return storage('legacy').getStore()
|
|
68
|
+
if (operation === 'imageRequestWithMiddleware' && args[0][requestMeta]?.middlewareInvoke) {
|
|
69
|
+
return storage('legacy').getStore()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ctx.req = args[0].originalRequest || args[0]
|
|
73
|
+
ctx.res = args[1].originalResponse || args[1]
|
|
74
|
+
ctx.currentStore = this.bindStart(ctx)
|
|
75
|
+
return ctx.currentStore
|
|
76
|
+
})
|
|
77
|
+
this.addSub(`${prefix}:start`, ctx => {
|
|
78
|
+
if (ctx.currentStore) this.pageLoad({ page: '/_next/image' })
|
|
79
|
+
})
|
|
80
|
+
this.addSub(`${prefix}:asyncEnd`, ctx => {
|
|
81
|
+
if (!ctx.currentStore) return
|
|
82
|
+
if (ctx.error && !ctx.res.destroyed && !reusedNextRequestStores.has(ctx.currentStore)) {
|
|
83
|
+
ctx.res.once('close', () => finishChannel.publish(ctx))
|
|
84
|
+
} else {
|
|
85
|
+
this.finish(ctx)
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
}
|
|
50
89
|
}
|
|
51
90
|
|
|
52
91
|
/** @param {NextRequestContext} ctx */
|
|
@@ -76,6 +115,11 @@ class NextPlugin extends ServerPlugin {
|
|
|
76
115
|
'http.method': req.method,
|
|
77
116
|
}
|
|
78
117
|
if (serviceSource !== undefined) tags[SVC_SRC_KEY] = serviceSource
|
|
118
|
+
if (this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
119
|
+
const resource = otelHttpResourceName(req.method)
|
|
120
|
+
tags['resource.name'] = resource
|
|
121
|
+
tags[INSTRUMENTATION_HTTP_RESOURCE] = resource
|
|
122
|
+
}
|
|
79
123
|
|
|
80
124
|
const span = this.tracer.startSpan(this.operationName(), {
|
|
81
125
|
childOf,
|
|
@@ -83,6 +127,8 @@ class NextPlugin extends ServerPlugin {
|
|
|
83
127
|
integrationName: this.constructor.id,
|
|
84
128
|
})
|
|
85
129
|
|
|
130
|
+
if (this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED) addOtelRequestTags(span, this.config, req)
|
|
131
|
+
|
|
86
132
|
this.stampIntegrationService(span, serviceName)
|
|
87
133
|
|
|
88
134
|
analyticsSampler.sample(span, this.config.measured, true)
|
|
@@ -104,14 +150,14 @@ class NextPlugin extends ServerPlugin {
|
|
|
104
150
|
|
|
105
151
|
/** @param {NextRequestContext} ctx */
|
|
106
152
|
finish (ctx) {
|
|
107
|
-
const { req, res, nextRequest
|
|
153
|
+
const { req, res, nextRequest } = ctx
|
|
108
154
|
const store = ctx.currentStore ?? storage('legacy').getStore()
|
|
109
155
|
|
|
110
156
|
if (!store || reusedNextRequestStores.has(store)) return
|
|
111
157
|
|
|
112
158
|
const span = store.span
|
|
113
159
|
const error = ctx.error ?? span.context().getTag('error')
|
|
114
|
-
const requestError = req.error || nextRequest
|
|
160
|
+
const requestError = req.error || nextRequest?.error
|
|
115
161
|
|
|
116
162
|
if (requestError) {
|
|
117
163
|
// prioritize user-set errors from API routes
|
|
@@ -124,6 +170,9 @@ class NextPlugin extends ServerPlugin {
|
|
|
124
170
|
} else if (!this.config.validateStatus(res.statusCode)) {
|
|
125
171
|
// where there's no error, we still need to validate status
|
|
126
172
|
span.setTag('error', true)
|
|
173
|
+
if (this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
174
|
+
span.setTag(HTTP_STATUS_ERROR, String(res.statusCode))
|
|
175
|
+
}
|
|
127
176
|
web.addError(req, true)
|
|
128
177
|
}
|
|
129
178
|
|
|
@@ -146,11 +195,11 @@ class NextPlugin extends ServerPlugin {
|
|
|
146
195
|
// safeguard against missing req in complicated timeout scenarios
|
|
147
196
|
if (!req) return
|
|
148
197
|
|
|
149
|
-
//
|
|
198
|
+
// Nested requests, static loads, and error pages must preserve the matched route.
|
|
150
199
|
const current = span.context().getTag('next.page')
|
|
151
200
|
const isErrorPage = errorPages.has(page)
|
|
152
201
|
|
|
153
|
-
if (current && isErrorPage) {
|
|
202
|
+
if (current && (isErrorPage || isStatic || reusedNextRequestStores.has(store))) {
|
|
154
203
|
return
|
|
155
204
|
}
|
|
156
205
|
|
|
@@ -167,13 +216,24 @@ class NextPlugin extends ServerPlugin {
|
|
|
167
216
|
: '/public/*'
|
|
168
217
|
}
|
|
169
218
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
219
|
+
let resource = `${req.method} ${page}`.trim()
|
|
220
|
+
span.setTag(COMPONENT, this.constructor.id)
|
|
221
|
+
span.setTag('next.page', page)
|
|
222
|
+
if (this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
223
|
+
resource = otelHttpResourceName(req.method, page)
|
|
224
|
+
span.setTag(HTTP_ROUTE, page)
|
|
225
|
+
setInstrumentationHttpResourceIfOwned(span, resource)
|
|
226
|
+
} else {
|
|
227
|
+
span.setTag(RESOURCE_NAME, resource)
|
|
228
|
+
}
|
|
175
229
|
web.setRouteOrEndpointTag(req)
|
|
176
|
-
setHttpParentRoute(
|
|
230
|
+
setHttpParentRoute(
|
|
231
|
+
httpParentSpan,
|
|
232
|
+
page,
|
|
233
|
+
isStatic,
|
|
234
|
+
this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED,
|
|
235
|
+
resource
|
|
236
|
+
)
|
|
177
237
|
web.setRoute(req, page)
|
|
178
238
|
}
|
|
179
239
|
|
|
@@ -200,7 +260,14 @@ function normalizeAppPath (page) {
|
|
|
200
260
|
return page
|
|
201
261
|
}
|
|
202
262
|
|
|
203
|
-
|
|
263
|
+
/**
|
|
264
|
+
* @param {import('../../dd-trace/src/opentracing/span') | undefined} span
|
|
265
|
+
* @param {string | undefined} page
|
|
266
|
+
* @param {boolean} isStatic
|
|
267
|
+
* @param {boolean} otelSemanticsEnabled
|
|
268
|
+
* @param {string} resource
|
|
269
|
+
*/
|
|
270
|
+
function setHttpParentRoute (span, page, isStatic, otelSemanticsEnabled, resource) {
|
|
204
271
|
if (!span) return
|
|
205
272
|
const currentRoute = span.context().getTag(HTTP_ROUTE)
|
|
206
273
|
|
|
@@ -208,7 +275,38 @@ function setHttpParentRoute (span, method, page, isStatic) {
|
|
|
208
275
|
if (currentRoute && (nextParentRoutes.get(span) !== currentRoute || isStatic)) return
|
|
209
276
|
|
|
210
277
|
span.setTag(HTTP_ROUTE, page)
|
|
211
|
-
|
|
278
|
+
if (otelSemanticsEnabled) {
|
|
279
|
+
setInstrumentationHttpResourceIfOwned(span, resource)
|
|
280
|
+
} else {
|
|
281
|
+
span.setTag(RESOURCE_NAME, resource)
|
|
282
|
+
}
|
|
212
283
|
nextParentRoutes.set(span, page)
|
|
213
284
|
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @param {import('../../dd-trace/src/opentracing/span')} span
|
|
288
|
+
* @param {string} resource
|
|
289
|
+
*/
|
|
290
|
+
function setInstrumentationHttpResourceIfOwned (span, resource) {
|
|
291
|
+
const context = span.context()
|
|
292
|
+
if (isInstrumentationOwnedResource(
|
|
293
|
+
context.getTag(RESOURCE_NAME),
|
|
294
|
+
context.getTag(INSTRUMENTATION_HTTP_RESOURCE)
|
|
295
|
+
)) {
|
|
296
|
+
setInstrumentationHttpResource(span, resource)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* @param {import('../../dd-trace/src/opentracing/span')} span
|
|
301
|
+
* @param {Record<string, unknown>} config
|
|
302
|
+
* @param {import('node:http').IncomingMessage} req
|
|
303
|
+
*/
|
|
304
|
+
function addOtelRequestTags (span, config, req) {
|
|
305
|
+
const userAgent = req.headers['user-agent']
|
|
306
|
+
const peerAddress = req.socket?.remoteAddress
|
|
307
|
+
span.setTag('http.url', obfuscateQs(config, extractURL(req)))
|
|
308
|
+
if (userAgent !== undefined) span.setTag('http.useragent', userAgent)
|
|
309
|
+
if (peerAddress) span.setTag(NETWORK_PEER_ADDRESS, peerAddress)
|
|
310
|
+
}
|
|
311
|
+
|
|
214
312
|
module.exports = NextPlugin
|
|
@@ -4,6 +4,8 @@ const { URL } = require('url')
|
|
|
4
4
|
const log = require('../../dd-trace/src/log')
|
|
5
5
|
|
|
6
6
|
const easyConnectProtocol = /^tcps?:\/\//i
|
|
7
|
+
let cachedConnectString
|
|
8
|
+
let cachedInfo
|
|
7
9
|
|
|
8
10
|
function parseOracleDescriptor (descriptor) {
|
|
9
11
|
const hostnameMatch = descriptor.match(/HOST\s*=\s*([^)]+)/i)
|
|
@@ -22,18 +24,26 @@ function parseOracleDescriptor (descriptor) {
|
|
|
22
24
|
module.exports = function getDBInformation (connAttrs) {
|
|
23
25
|
// Users can pass either connectString or connectionString
|
|
24
26
|
const connectString = ((connAttrs.connectString || connAttrs.connectionString) ?? '').trim()
|
|
27
|
+
if (connectString === cachedConnectString) return cachedInfo
|
|
28
|
+
|
|
29
|
+
let dbInfo
|
|
25
30
|
if (connectString.startsWith('(')) {
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
dbInfo = parseOracleDescriptor(connectString)
|
|
32
|
+
} else {
|
|
33
|
+
try {
|
|
34
|
+
const url = new URL(easyConnectProtocol.test(connectString) ? connectString : `oracle://${connectString}`)
|
|
35
|
+
dbInfo = {
|
|
36
|
+
hostname: url.hostname || 'localhost', // Default Oracle hostname
|
|
37
|
+
port: url.port || '1521', // Default Oracle port
|
|
38
|
+
dbInstance: url.pathname && url.pathname.slice(1) || 'XEPDB1', // Default Oracle service name
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
log.error('Invalid oracle connection string', error)
|
|
42
|
+
return {}
|
|
34
43
|
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
log.error('Invalid oracle connection string', error)
|
|
37
|
-
return {}
|
|
38
44
|
}
|
|
45
|
+
|
|
46
|
+
cachedConnectString = connectString
|
|
47
|
+
cachedInfo = dbInfo
|
|
48
|
+
return dbInfo
|
|
39
49
|
}
|
|
@@ -510,6 +510,8 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
510
510
|
testSourceFileAbsolutePath
|
|
511
511
|
)
|
|
512
512
|
|
|
513
|
+
span.addTags(ctx.extraTags)
|
|
514
|
+
|
|
513
515
|
if (isDisabled) {
|
|
514
516
|
span.setTag(TEST_MANAGEMENT_IS_DISABLED, 'true')
|
|
515
517
|
}
|
|
@@ -699,6 +701,7 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
699
701
|
})
|
|
700
702
|
|
|
701
703
|
this.addSub('ci:playwright:test:skip', ({
|
|
704
|
+
extraTags,
|
|
702
705
|
testName,
|
|
703
706
|
testSuiteAbsolutePath,
|
|
704
707
|
testSourceFileAbsolutePath,
|
|
@@ -725,6 +728,7 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
725
728
|
testSourceFileAbsolutePath
|
|
726
729
|
)
|
|
727
730
|
|
|
731
|
+
span.addTags(extraTags)
|
|
728
732
|
span.setTag(TEST_STATUS, 'skip')
|
|
729
733
|
span.setTag(TEST_FINAL_STATUS, 'skip')
|
|
730
734
|
|
|
@@ -56,7 +56,7 @@ class DatadogTracingHelper {
|
|
|
56
56
|
* @param {object[]} spans
|
|
57
57
|
*/
|
|
58
58
|
dispatchEngineSpans (spans) {
|
|
59
|
-
if (!spans?.length) {
|
|
59
|
+
if (!spans?.length || this.#prismaClient.config?.engine === false) {
|
|
60
60
|
return
|
|
61
61
|
}
|
|
62
62
|
const childrenByParent = new Map()
|
|
@@ -90,8 +90,10 @@ class DatadogTracingHelper {
|
|
|
90
90
|
* @returns {unknown}
|
|
91
91
|
*/
|
|
92
92
|
runInChildSpan (options, callback) {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
// Skipping here rather than in the plugin's `bindStart` avoids finishing the parent span, which
|
|
94
|
+
// `finish()` would fall back to when no client span was started.
|
|
95
|
+
if (!clientCH.start?.hasSubscribers || this.#prismaClient.config?.client === false) {
|
|
96
|
+
return callback()
|
|
95
97
|
}
|
|
96
98
|
if (typeof options === 'string') {
|
|
97
99
|
options = {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { storage } = require('../../datadog-core')
|
|
4
|
+
const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
|
|
5
|
+
const { getRequest } = require('../../dd-trace/src/appsec/store')
|
|
6
|
+
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
7
|
+
const log = require('../../dd-trace/src/log')
|
|
8
|
+
const web = require('../../dd-trace/src/plugins/util/web')
|
|
9
|
+
const WebPlugin = require('../../datadog-plugin-web/src')
|
|
10
|
+
const { HTTP_ROUTE, HTTP_URL, RESOURCE_NAME } = require('../../../ext/tags')
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {{ arguments: unknown[], result: Array<{ route?: { path?: string } }> | null }} RouteMatchContext
|
|
14
|
+
* @typedef {object} HandlerContext
|
|
15
|
+
* @property {string} routeId
|
|
16
|
+
* @property {string} [pattern]
|
|
17
|
+
* @property {(result: unknown, rejected: boolean) => void} [complete]
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
class ReactRouterPlugin extends WebPlugin {
|
|
21
|
+
static id = 'react-router'
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {object} tracer
|
|
25
|
+
* @param {import('../../dd-trace/src/config/config-base')} tracerConfig
|
|
26
|
+
*/
|
|
27
|
+
constructor (tracer, tracerConfig) {
|
|
28
|
+
super(tracer, tracerConfig)
|
|
29
|
+
|
|
30
|
+
this.addSub('tracing:orchestrion:react-router:matchServerRoutes:end', ctx => {
|
|
31
|
+
this.#setRouteFromMatches(/** @type {RouteMatchContext} */ (ctx))
|
|
32
|
+
})
|
|
33
|
+
this.addBind('apm:react-router:loader:start', ctx => {
|
|
34
|
+
return this.#startHandlerSpan('loader', /** @type {HandlerContext} */ (ctx))
|
|
35
|
+
})
|
|
36
|
+
this.addBind('apm:react-router:action:start', ctx => {
|
|
37
|
+
return this.#startHandlerSpan('action', /** @type {HandlerContext} */ (ctx))
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @param {RouteMatchContext} ctx */
|
|
42
|
+
#setRouteFromMatches (ctx) {
|
|
43
|
+
const matches = ctx.result
|
|
44
|
+
if (!matches?.length) return
|
|
45
|
+
|
|
46
|
+
const store = storage('legacy').getStore()
|
|
47
|
+
const request = getRequest(store) ?? store?.req
|
|
48
|
+
const span = (request && web.root(request)) || web.rootFromSpan(
|
|
49
|
+
/** @type {import('../../dd-trace/src/opentracing/span') | undefined} */ (store?.span)
|
|
50
|
+
)
|
|
51
|
+
if (!span) return
|
|
52
|
+
const httpUrl = /** @type {string} */ (span.context().getTag(HTTP_URL))
|
|
53
|
+
|
|
54
|
+
let pathname
|
|
55
|
+
try {
|
|
56
|
+
pathname = new URL(httpUrl, 'http://localhost').pathname
|
|
57
|
+
} catch (error) {
|
|
58
|
+
log.debug('Skipping React Router route for invalid HTTP URL: %s', error)
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
const args = ctx.arguments
|
|
62
|
+
const matchedPathname = typeof args[1] === 'string' ? args[1] : args[3] ?? args[2]
|
|
63
|
+
if (pathname.endsWith('/_root.data') && typeof matchedPathname === 'string' &&
|
|
64
|
+
pathname.toLowerCase() === ((matchedPathname.endsWith('/')
|
|
65
|
+
? matchedPathname.slice(0, -1)
|
|
66
|
+
: matchedPathname) + '/_root.data').toLowerCase()) {
|
|
67
|
+
pathname = matchedPathname
|
|
68
|
+
} else if (pathname.endsWith('.data')) {
|
|
69
|
+
pathname = pathname.slice(0, -'.data'.length)
|
|
70
|
+
}
|
|
71
|
+
if (pathname.length > 1 && pathname.endsWith('/')) pathname = pathname.slice(0, -1)
|
|
72
|
+
|
|
73
|
+
if (pathname !== matchedPathname && pathname + '/' !== matchedPathname &&
|
|
74
|
+
!(pathname.endsWith('/_') && pathname.slice(0, -1) === matchedPathname)) return
|
|
75
|
+
|
|
76
|
+
let route = ''
|
|
77
|
+
for (const match of matches) {
|
|
78
|
+
const path = match.route?.path
|
|
79
|
+
if (path) route = path.startsWith('/') ? path : route + '/' + path
|
|
80
|
+
}
|
|
81
|
+
route = route.replaceAll(/\/+/g, '/') || '/'
|
|
82
|
+
|
|
83
|
+
span.setTag(HTTP_ROUTE, route)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @param {'loader' | 'action'} kind
|
|
88
|
+
* @param {HandlerContext} ctx
|
|
89
|
+
*/
|
|
90
|
+
#startHandlerSpan (kind, ctx) {
|
|
91
|
+
const store = storage('legacy').getStore()
|
|
92
|
+
const childOf = store?.span
|
|
93
|
+
if (!childOf) return store
|
|
94
|
+
|
|
95
|
+
const span = this.tracer.startSpan('react-router.' + kind, {
|
|
96
|
+
childOf,
|
|
97
|
+
integrationName: ReactRouterPlugin.id,
|
|
98
|
+
tags: {
|
|
99
|
+
[COMPONENT]: ReactRouterPlugin.id,
|
|
100
|
+
[RESOURCE_NAME]: ctx.pattern,
|
|
101
|
+
'react-router.route_id': ctx.routeId,
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
|
+
analyticsSampler.sample(span, this.config.measured, true)
|
|
105
|
+
|
|
106
|
+
ctx.complete = (result, rejected) => {
|
|
107
|
+
const outcome = /** @type {{ status?: string, error?: Error }} */ (result)
|
|
108
|
+
const error = rejected ? result : outcome?.status === 'error' ? outcome.error : undefined
|
|
109
|
+
if (error !== undefined && !span.context().getTag('error')) {
|
|
110
|
+
span.setTag('error', error)
|
|
111
|
+
}
|
|
112
|
+
span.finish()
|
|
113
|
+
}
|
|
114
|
+
return { ...store, span }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = ReactRouterPlugin
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
4
|
+
const TrpcProcedurePlugin = require('./procedure')
|
|
5
|
+
const TrpcRequestPlugin = require('./request')
|
|
6
|
+
|
|
7
|
+
class TrpcPlugin extends CompositePlugin {
|
|
8
|
+
static id = 'trpc'
|
|
9
|
+
static plugins = {
|
|
10
|
+
request: TrpcRequestPlugin,
|
|
11
|
+
procedure: TrpcProcedurePlugin,
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = TrpcPlugin
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { storage } = require('../../datadog-core')
|
|
4
|
+
const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
5
|
+
|
|
6
|
+
const legacyStorage = storage('legacy')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {{
|
|
10
|
+
* arguments: [{ path?: string, type?: string }],
|
|
11
|
+
* currentStore?: { span: import('../../dd-trace/src/opentracing/span') },
|
|
12
|
+
* error?: unknown
|
|
13
|
+
* }} ProcedureContext
|
|
14
|
+
* @typedef {{ currentStore?: { span: import('../../../').Span }, error?: unknown }}
|
|
15
|
+
* ProcedureCompletionContext
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class TrpcProcedurePlugin extends TracingPlugin {
|
|
19
|
+
static id = 'trpc'
|
|
20
|
+
static prefix = 'tracing:orchestrion:@trpc/server:procedure'
|
|
21
|
+
|
|
22
|
+
/** @param {ProcedureContext} ctx */
|
|
23
|
+
bindStart (ctx) {
|
|
24
|
+
const { path, type } = ctx.arguments[0]
|
|
25
|
+
if (typeof path !== 'string' || (type !== 'query' && type !== 'mutation')) {
|
|
26
|
+
return legacyStorage.getStore()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
this.startSpan('trpc.procedure', {
|
|
30
|
+
service: this.config.service,
|
|
31
|
+
resource: `${type} ${path}`,
|
|
32
|
+
kind: 'internal',
|
|
33
|
+
}, ctx)
|
|
34
|
+
return ctx.currentStore
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @param {ProcedureCompletionContext} ctx */
|
|
38
|
+
error (ctx) {
|
|
39
|
+
ctx.currentStore?.span.setTag('error', ctx.error)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** @param {ProcedureCompletionContext} ctx */
|
|
43
|
+
asyncEnd (ctx) {
|
|
44
|
+
ctx.currentStore?.span.finish()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = TrpcProcedurePlugin
|