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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { channel } = require('dc-polyfill')
|
|
4
|
+
|
|
5
|
+
const { storage } = require('../../datadog-core')
|
|
6
|
+
const ElevenLabsLLMObsPlugin = require('../../dd-trace/src/llmobs/plugins/elevenlabs')
|
|
7
|
+
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
8
|
+
const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
9
|
+
|
|
10
|
+
const annotate = channel('apm:elevenlabs:annotate')
|
|
11
|
+
|
|
12
|
+
/** @typedef {import('../../datadog-instrumentations/src/elevenlabs/session').Scope} Scope */
|
|
13
|
+
/** @typedef {import('../../datadog-core/src/storage').Store<unknown>} Store */
|
|
14
|
+
|
|
15
|
+
class ElevenLabsTracingPlugin extends TracingPlugin {
|
|
16
|
+
static id = 'elevenlabs'
|
|
17
|
+
static prefix = 'tracing:apm:elevenlabs:span'
|
|
18
|
+
|
|
19
|
+
constructor (...args) {
|
|
20
|
+
super(...args)
|
|
21
|
+
this.addSub('dd-trace:elevenlabs:capture-context', message => {
|
|
22
|
+
const scope = /** @type {Scope} */ (message)
|
|
23
|
+
// An absent store intentionally restores an explicit root context.
|
|
24
|
+
const store = /** @type {Store} */ (storage('legacy').getStore())
|
|
25
|
+
const previous = scope.runInContext ?? (fn => fn())
|
|
26
|
+
scope.runInContext = fn => previous(() => storage('legacy').run(store, fn))
|
|
27
|
+
})
|
|
28
|
+
this.addSub('apm:elevenlabs:finish', ctx => this.finish(ctx))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** @param {object} ctx */
|
|
32
|
+
bindStart (ctx) {
|
|
33
|
+
this.startSpan('elevenlabs.request', {
|
|
34
|
+
service: this.config.service,
|
|
35
|
+
resource: ctx.name,
|
|
36
|
+
type: 'llm',
|
|
37
|
+
kind: 'client',
|
|
38
|
+
startTime: ctx.startTime,
|
|
39
|
+
}, ctx)
|
|
40
|
+
return ctx.currentStore
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @param {object} ctx */
|
|
44
|
+
end (ctx) { if (!ctx.deferred) this.finish(ctx) }
|
|
45
|
+
|
|
46
|
+
/** @param {object} ctx */
|
|
47
|
+
finish (ctx) {
|
|
48
|
+
if (ctx.finished) return
|
|
49
|
+
const span = ctx.currentStore?.span
|
|
50
|
+
// Configuration changes can reorder subscribers. Keep deferred spans, speech phases, and
|
|
51
|
+
// asynchronous tools annotated before serialization through one explicit completion owner.
|
|
52
|
+
annotate.publish(ctx)
|
|
53
|
+
if (ctx.error) this.addError(ctx.error, span)
|
|
54
|
+
if (ctx.turn.failed && ['elevenlabs audio turn', 'elevenlabs response'].includes(ctx.name)) {
|
|
55
|
+
span?.setTag('error', 1)
|
|
56
|
+
}
|
|
57
|
+
span?.finish(ctx.finishTime)
|
|
58
|
+
ctx.finished = true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
class ElevenLabsPlugin extends CompositePlugin {
|
|
63
|
+
static id = 'elevenlabs'
|
|
64
|
+
static get plugins () {
|
|
65
|
+
return { llmobs: ElevenLabsLLMObsPlugin, tracing: ElevenLabsTracingPlugin }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = ElevenLabsPlugin
|
|
@@ -104,9 +104,12 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
|
104
104
|
|
|
105
105
|
let childOf = this.tracer.extract('text_map', message.attributes)
|
|
106
106
|
|
|
107
|
+
let pubsubRequestContext
|
|
107
108
|
const isFirstMessage = batchIndex === 0
|
|
108
109
|
if (isFirstMessage && batchRequestSpanId) {
|
|
109
|
-
|
|
110
|
+
pubsubRequestContext = reconstructPubSubRequestContext(
|
|
111
|
+
message.attributes, childOf, this._tracerConfig.DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT
|
|
112
|
+
)
|
|
110
113
|
if (pubsubRequestContext) {
|
|
111
114
|
childOf = pubsubRequestContext
|
|
112
115
|
}
|
|
@@ -125,14 +128,12 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
|
125
128
|
'messaging.operation': 'receive',
|
|
126
129
|
}
|
|
127
130
|
|
|
131
|
+
let batchContext
|
|
128
132
|
if (batchRequestTraceId && batchRequestSpanId) {
|
|
129
133
|
meta['pubsub.batch.request_trace_id'] = batchRequestTraceId
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
span_id: batchRequestSpanId,
|
|
134
|
-
flags: 0,
|
|
135
|
-
}])
|
|
134
|
+
batchContext = pubsubRequestContext || reconstructPubSubRequestContext(
|
|
135
|
+
message.attributes, null, this._tracerConfig.DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT
|
|
136
|
+
)
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
const metrics = {
|
|
@@ -161,6 +162,8 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
|
161
162
|
metrics,
|
|
162
163
|
}, ctx)
|
|
163
164
|
|
|
165
|
+
if (batchContext) span.addLink({ context: batchContext })
|
|
166
|
+
|
|
164
167
|
if (message.publishTime) {
|
|
165
168
|
span.setTag('pubsub.publish_time', message.publishTime.toISOString())
|
|
166
169
|
}
|
|
@@ -5,12 +5,10 @@ const {
|
|
|
5
5
|
readDatadogSamplingPriority,
|
|
6
6
|
readDatadogTraceId,
|
|
7
7
|
readTraceparent,
|
|
8
|
-
writeDatadogParentId,
|
|
9
|
-
writeDatadogSamplingPriority,
|
|
10
|
-
writeDatadogTraceId,
|
|
11
8
|
} = require('../../dd-trace/src/carrier')
|
|
12
9
|
const { DsmPathwayCodec, getHeadersSize } = require('../../dd-trace/src/datastreams')
|
|
13
10
|
const id = require('../../dd-trace/src/id')
|
|
11
|
+
const SpanContext = require('../../dd-trace/src/opentracing/span_context')
|
|
14
12
|
const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
15
13
|
|
|
16
14
|
class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
@@ -71,6 +69,9 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
71
69
|
const topic = request.topic
|
|
72
70
|
const messageCount = messages.length
|
|
73
71
|
const hasTraceContext = messages[0]?.attributes && readDatadogTraceId(messages[0].attributes)
|
|
72
|
+
const parentContext = hasTraceContext && readDatadogParentId(messages[0].attributes)
|
|
73
|
+
? this.tracer.extract('text_map', messages[0].attributes)
|
|
74
|
+
: undefined
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
77
|
* Batch Publishing Strategy:
|
|
@@ -81,30 +82,18 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
81
82
|
* - Inject batch span context + metadata into all message attributes for downstream
|
|
82
83
|
* consumers to reconstruct the trace and understand batch relationships
|
|
83
84
|
*/
|
|
84
|
-
const
|
|
85
|
+
const spanLinks = []
|
|
85
86
|
if (hasTraceContext) {
|
|
86
87
|
for (let i = 1; i < messageCount; i++) {
|
|
87
88
|
const link = this.#extractSpanLink(messages[i].attributes)
|
|
88
|
-
if (link)
|
|
89
|
+
if (link) spanLinks.push(link)
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
const firstAttrs = messages[0]?.attributes
|
|
93
|
-
const traceId = firstAttrs && readDatadogTraceId(firstAttrs)
|
|
94
|
-
const spanId = firstAttrs && readDatadogParentId(firstAttrs)
|
|
95
|
-
const parentData = traceId && spanId
|
|
96
|
-
? {
|
|
97
|
-
traceId,
|
|
98
|
-
spanId,
|
|
99
|
-
traceIdUpper: firstAttrs['_dd.p.tid'],
|
|
100
|
-
samplingPriority: readDatadogSamplingPriority(firstAttrs),
|
|
101
|
-
}
|
|
102
|
-
: null
|
|
103
|
-
|
|
104
93
|
const lastSlash = topic.lastIndexOf('/')
|
|
105
94
|
const topicName = lastSlash === -1 ? topic : topic.slice(lastSlash + 1)
|
|
106
95
|
const batchSpan = this.startSpan({
|
|
107
|
-
childOf:
|
|
96
|
+
childOf: parentContext,
|
|
108
97
|
resource: `${api} to Topic ${topicName}`,
|
|
109
98
|
meta: {
|
|
110
99
|
'gcloud.project_id': projectId,
|
|
@@ -113,7 +102,7 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
113
102
|
'span.kind': 'producer',
|
|
114
103
|
'_dd.base_service': this.tracer._service,
|
|
115
104
|
'_dd.serviceoverride.type': 'integration',
|
|
116
|
-
'pubsub.linked_message_count':
|
|
105
|
+
'pubsub.linked_message_count': spanLinks.length || undefined,
|
|
117
106
|
operation: messageCount > 1 ? 'batched.pubsub.request' : 'pubsub.request',
|
|
118
107
|
},
|
|
119
108
|
metrics: {
|
|
@@ -130,15 +119,7 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
130
119
|
const batchTraceIdHex = fullTraceIdHex.slice(-16)
|
|
131
120
|
const batchTraceIdUpper = spanCtx._trace.tags['_dd.p.tid']
|
|
132
121
|
|
|
133
|
-
if (
|
|
134
|
-
batchSpan.setTag('_dd.span_links', JSON.stringify(
|
|
135
|
-
spanLinkData.map(link => ({
|
|
136
|
-
trace_id: link.traceId,
|
|
137
|
-
span_id: link.spanId,
|
|
138
|
-
flags: link.samplingPriority || 0,
|
|
139
|
-
}))
|
|
140
|
-
))
|
|
141
|
-
}
|
|
122
|
+
if (spanLinks.length) batchSpan.addLinks(spanLinks)
|
|
142
123
|
|
|
143
124
|
const messageCountStr = String(messageCount)
|
|
144
125
|
const startTimeStr = String(Math.floor(batchSpan._startTime))
|
|
@@ -189,34 +170,20 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
189
170
|
const spanId = readDatadogParentId(attrs)
|
|
190
171
|
if (!traceId || !spanId) return null
|
|
191
172
|
|
|
192
|
-
// Convert to hex strings
|
|
193
|
-
const lowerHex = id(traceId).toString(16)
|
|
194
|
-
const spanIdHex = id(spanId).toString(16)
|
|
195
|
-
|
|
196
|
-
// Build full 128-bit trace ID
|
|
197
|
-
const traceIdHex = attrs['_dd.p.tid']
|
|
198
|
-
? attrs['_dd.p.tid'] + lowerHex
|
|
199
|
-
: lowerHex.padStart(32, '0')
|
|
200
|
-
|
|
201
173
|
const samplingPriority = readDatadogSamplingPriority(attrs)
|
|
202
174
|
return {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
? Number.parseInt(samplingPriority, 10)
|
|
207
|
-
:
|
|
175
|
+
context: new SpanContext({
|
|
176
|
+
traceId: id(traceId, 10),
|
|
177
|
+
spanId: id(spanId, 10),
|
|
178
|
+
sampling: { priority: samplingPriority ? Number.parseInt(samplingPriority, 10) : 0 },
|
|
179
|
+
trace: {
|
|
180
|
+
started: [],
|
|
181
|
+
finished: [],
|
|
182
|
+
tags: attrs['_dd.p.tid'] ? { '_dd.p.tid': attrs['_dd.p.tid'] } : {},
|
|
183
|
+
},
|
|
184
|
+
}),
|
|
208
185
|
}
|
|
209
186
|
}
|
|
210
|
-
|
|
211
|
-
#extractParentContext (data) {
|
|
212
|
-
const carrier = /** @type {Record<string, unknown>} */ ({})
|
|
213
|
-
writeDatadogTraceId(carrier, data.traceId)
|
|
214
|
-
writeDatadogParentId(carrier, data.spanId)
|
|
215
|
-
if (data.traceIdUpper) carrier['_dd.p.tid'] = data.traceIdUpper
|
|
216
|
-
if (data.samplingPriority) writeDatadogSamplingPriority(carrier, String(data.samplingPriority))
|
|
217
|
-
|
|
218
|
-
return this.tracer.extract('text_map', carrier)
|
|
219
|
-
}
|
|
220
187
|
}
|
|
221
188
|
|
|
222
189
|
module.exports = GoogleCloudPubsubProducerPlugin
|
|
@@ -68,9 +68,11 @@ class GoogleCloudPubsubPushSubscriptionPlugin extends TracingPlugin {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const originalContext = this.#extractContext(messageData)
|
|
71
|
-
const pubsubRequestContext = reconstructPubSubRequestContext(
|
|
71
|
+
const pubsubRequestContext = reconstructPubSubRequestContext(
|
|
72
|
+
messageData.attrs, originalContext, this._tracerConfig.DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT
|
|
73
|
+
) || originalContext
|
|
72
74
|
const isSameTrace = pubsubRequestContext &&
|
|
73
|
-
originalContext?.toTraceId() === pubsubRequestContext.toTraceId()
|
|
75
|
+
originalContext?.toTraceId(true) === pubsubRequestContext.toTraceId(true)
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
78
|
* Create receive span, choosing parent context:
|
|
@@ -5,9 +5,11 @@ const id = require('../../dd-trace/src/id')
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @param {Record<string, string>} attributes
|
|
8
|
+
* @param {SpanContext | null | undefined} originalContext
|
|
9
|
+
* @param {import('../../dd-trace/src/config/config-base')['DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT']} propagationBehavior
|
|
8
10
|
* @returns {import('../../dd-trace/src/opentracing/span_context') | null}
|
|
9
11
|
*/
|
|
10
|
-
function reconstructPubSubRequestContext (attributes) {
|
|
12
|
+
function reconstructPubSubRequestContext (attributes, originalContext, propagationBehavior) {
|
|
11
13
|
const traceIdLower = attributes['_dd.pubsub_request.trace_id']
|
|
12
14
|
const spanId = attributes['_dd.pubsub_request.span_id']
|
|
13
15
|
const traceIdUpper = attributes['_dd.pubsub_request.p.tid']
|
|
@@ -15,16 +17,35 @@ function reconstructPubSubRequestContext (attributes) {
|
|
|
15
17
|
if (!traceIdLower || !spanId) return null
|
|
16
18
|
|
|
17
19
|
const traceId128 = traceIdUpper ? traceIdUpper + traceIdLower : traceIdLower.padStart(32, '0')
|
|
18
|
-
const traceId = id(traceId128, 16)
|
|
19
20
|
const parentId = id(spanId, 16)
|
|
20
21
|
|
|
22
|
+
if (originalContext?.toTraceId(true) === traceId128) {
|
|
23
|
+
if (propagationBehavior !== 'restart') {
|
|
24
|
+
originalContext._spanId = parentId
|
|
25
|
+
return originalContext
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Restart links reference the extracted context, so preserve its original span ID.
|
|
29
|
+
return new SpanContext({
|
|
30
|
+
traceId: originalContext._traceId,
|
|
31
|
+
spanId: parentId,
|
|
32
|
+
isRemote: originalContext._isRemote,
|
|
33
|
+
sampling: originalContext._sampling,
|
|
34
|
+
baggageItems: originalContext._baggageItems,
|
|
35
|
+
trace: originalContext._trace,
|
|
36
|
+
traceparent: originalContext._traceparent,
|
|
37
|
+
tracestate: originalContext._tracestate,
|
|
38
|
+
links: originalContext._links,
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
21
42
|
const tags = {}
|
|
22
43
|
if (traceIdUpper) tags['_dd.p.tid'] = traceIdUpper
|
|
23
44
|
|
|
24
45
|
return new SpanContext({
|
|
25
|
-
traceId,
|
|
46
|
+
traceId: id(traceId128, 16),
|
|
26
47
|
spanId: parentId,
|
|
27
|
-
tags,
|
|
48
|
+
trace: { started: [], finished: [], tags },
|
|
28
49
|
})
|
|
29
50
|
}
|
|
30
51
|
|
|
@@ -960,10 +960,10 @@ function getJitDefaultArguments (rootCtx, descriptor, argumentFactory, mutable)
|
|
|
960
960
|
if (mutable) {
|
|
961
961
|
return argumentFactory === undefined
|
|
962
962
|
? {}
|
|
963
|
-
: argumentFactory(rootCtx.variableValues, cloneArgumentValue)
|
|
963
|
+
: argumentFactory(rootCtx.variableValues, cloneArgumentValue, descriptor)
|
|
964
964
|
}
|
|
965
965
|
if (descriptor.hasArgumentVariables) {
|
|
966
|
-
return argumentFactory(rootCtx.variableValues)
|
|
966
|
+
return argumentFactory(rootCtx.variableValues, undefined, descriptor)
|
|
967
967
|
}
|
|
968
968
|
return descriptor.staticArguments
|
|
969
969
|
}
|
|
@@ -53,7 +53,7 @@ function getRequestCache (owner, configuredLimit) {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* @param {string | null | undefined} operationName
|
|
56
|
-
* @param {boolean} calculateSignature
|
|
56
|
+
* @param {boolean | undefined} calculateSignature
|
|
57
57
|
*/
|
|
58
58
|
function operationCacheKey (operationName, calculateSignature) {
|
|
59
59
|
return `${calculateSignature === false ? 0 : 1}\n${operationName ?? ''}`
|
|
@@ -62,7 +62,7 @@ function operationCacheKey (operationName, calculateSignature) {
|
|
|
62
62
|
/**
|
|
63
63
|
* @param {unknown} source
|
|
64
64
|
* @param {string | null | undefined} operationName
|
|
65
|
-
* @param {boolean} calculateSignature
|
|
65
|
+
* @param {boolean | undefined} calculateSignature
|
|
66
66
|
* @param {RequestCache | undefined} requestCache
|
|
67
67
|
* @returns {RequestOperation | undefined}
|
|
68
68
|
*/
|
|
@@ -156,7 +156,7 @@ function refineRequestSpanMetadata (requestSpan, signature, type, name) {
|
|
|
156
156
|
* @param {import('graphql').DocumentNode | undefined} document
|
|
157
157
|
* @param {unknown} requestSource
|
|
158
158
|
* @param {string | null | undefined} operationName
|
|
159
|
-
* @param {boolean} calculateSignature
|
|
159
|
+
* @param {boolean | undefined} calculateSignature
|
|
160
160
|
* @param {boolean} validated
|
|
161
161
|
* @param {RequestCache | undefined} requestCache
|
|
162
162
|
*/
|
|
@@ -193,7 +193,7 @@ function refineRequestSpan (
|
|
|
193
193
|
* @param {RequestCache} requestCache
|
|
194
194
|
* @param {string | object} source
|
|
195
195
|
* @param {string | null | undefined} operationName
|
|
196
|
-
* @param {boolean} calculateSignature
|
|
196
|
+
* @param {boolean | undefined} calculateSignature
|
|
197
197
|
* @param {RequestOperation} operation
|
|
198
198
|
* @param {import('graphql').DocumentNode} document
|
|
199
199
|
*/
|
|
@@ -229,7 +229,7 @@ function cacheRequestOperation (
|
|
|
229
229
|
/**
|
|
230
230
|
* @param {import('graphql').DocumentNode} document
|
|
231
231
|
* @param {string | null | undefined} operationName
|
|
232
|
-
* @param {boolean} calculateSignature
|
|
232
|
+
* @param {boolean | undefined} calculateSignature
|
|
233
233
|
* @returns {RequestOperation | undefined}
|
|
234
234
|
*/
|
|
235
235
|
function getRequestOperation (document, operationName, calculateSignature) {
|
|
@@ -8,6 +8,11 @@ const tags = require('../../../ext/tags')
|
|
|
8
8
|
const formats = require('../../../ext/formats')
|
|
9
9
|
const HTTP_HEADERS = formats.HTTP_HEADERS
|
|
10
10
|
const urlFilter = require('../../dd-trace/src/plugins/util/urlfilter')
|
|
11
|
+
const {
|
|
12
|
+
HTTP_STATUS_ERROR,
|
|
13
|
+
INSTRUMENTATION_HTTP_RESOURCE,
|
|
14
|
+
otelHttpResourceName,
|
|
15
|
+
} = require('../../dd-trace/src/plugins/util/http-otel-semantics')
|
|
11
16
|
const { getClientStatusValidator } = require('../../dd-trace/src/plugins/util/status-validator')
|
|
12
17
|
const { buildClientHttpUrl } = require('../../dd-trace/src/plugins/util/url')
|
|
13
18
|
const { stripQueryAndFragment } = require('../../dd-trace/src/util')
|
|
@@ -40,21 +45,36 @@ class HttpClientPlugin extends ClientPlugin {
|
|
|
40
45
|
|
|
41
46
|
const method = (options.method || 'GET').toUpperCase()
|
|
42
47
|
const otelSemantics = this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED
|
|
48
|
+
let otelUrl = uri
|
|
49
|
+
if (otelSemantics) {
|
|
50
|
+
const otelHostname = hostname.includes(':') && !hostname.startsWith('[') ? `[${hostname}]` : hostname
|
|
51
|
+
const otelHost = options.port ? `${otelHostname}:${options.port}` : otelHostname
|
|
52
|
+
const auth = typeof options.auth === 'string' && options.auth ? 'REDACTED:REDACTED@' : ''
|
|
53
|
+
const otelBase = `${protocol}//${auth}${otelHost}`
|
|
54
|
+
otelUrl = buildClientHttpUrl(this.config, otelBase, pathname, `${otelBase}${path}`)
|
|
55
|
+
}
|
|
43
56
|
const childOf = store && allowed ? store.span : null
|
|
44
57
|
// TODO delegate to super.startspan
|
|
58
|
+
const meta = {
|
|
59
|
+
[COMPONENT]: this.component,
|
|
60
|
+
'span.kind': 'client',
|
|
61
|
+
'resource.name': method,
|
|
62
|
+
'span.type': 'http',
|
|
63
|
+
'http.method': method,
|
|
64
|
+
'http.url': otelUrl,
|
|
65
|
+
'out.host': hostname,
|
|
66
|
+
}
|
|
67
|
+
if (otelSemantics) {
|
|
68
|
+
const resource = otelHttpResourceName(method)
|
|
69
|
+
meta['resource.name'] = resource
|
|
70
|
+
meta[INSTRUMENTATION_HTTP_RESOURCE] = resource
|
|
71
|
+
}
|
|
72
|
+
|
|
45
73
|
const span = this.startSpan(this.operationName(), {
|
|
46
74
|
childOf,
|
|
47
75
|
integrationName: this.component,
|
|
48
76
|
service: this.serviceName({ pluginConfig: this.config, sessionDetails: extractSessionDetails(options) }),
|
|
49
|
-
meta
|
|
50
|
-
[COMPONENT]: this.component,
|
|
51
|
-
'span.kind': 'client',
|
|
52
|
-
'resource.name': method,
|
|
53
|
-
'span.type': 'http',
|
|
54
|
-
'http.method': method,
|
|
55
|
-
'http.url': otelSemantics ? buildClientHttpUrl(this.config, base, pathname, uri) : uri,
|
|
56
|
-
'out.host': hostname,
|
|
57
|
-
},
|
|
77
|
+
meta,
|
|
58
78
|
metrics: {
|
|
59
79
|
[CLIENT_PORT_KEY]: Number.parseInt(options.port, 10),
|
|
60
80
|
},
|
|
@@ -99,6 +119,9 @@ class HttpClientPlugin extends ClientPlugin {
|
|
|
99
119
|
|
|
100
120
|
if (!this.config.validateStatus(status)) {
|
|
101
121
|
span.setTag('error', 1)
|
|
122
|
+
if (this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
123
|
+
span.setTag(HTTP_STATUS_ERROR, String(status))
|
|
124
|
+
}
|
|
102
125
|
}
|
|
103
126
|
|
|
104
127
|
addResponseHeaders(res, span, this.config)
|
|
@@ -9,6 +9,11 @@ const kinds = require('../../../ext/kinds')
|
|
|
9
9
|
const formats = require('../../../ext/formats')
|
|
10
10
|
const { COMPONENT, CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
11
11
|
const urlFilter = require('../../dd-trace/src/plugins/util/urlfilter')
|
|
12
|
+
const {
|
|
13
|
+
HTTP_STATUS_ERROR,
|
|
14
|
+
INSTRUMENTATION_HTTP_RESOURCE,
|
|
15
|
+
otelHttpResourceName,
|
|
16
|
+
} = require('../../dd-trace/src/plugins/util/http-otel-semantics')
|
|
12
17
|
const { getClientStatusValidator } = require('../../dd-trace/src/plugins/util/status-validator')
|
|
13
18
|
const { buildClientHttpUrl } = require('../../dd-trace/src/plugins/util/url')
|
|
14
19
|
|
|
@@ -30,30 +35,41 @@ class Http2ClientPlugin extends ClientPlugin {
|
|
|
30
35
|
|
|
31
36
|
bindStart (message) {
|
|
32
37
|
const { authority, options, headers = {} } = message
|
|
33
|
-
const
|
|
38
|
+
const otelSemantics = this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED
|
|
39
|
+
const sessionDetails = extractSessionDetails(authority, options, otelSemantics)
|
|
34
40
|
const path = headers[HTTP2_HEADER_PATH] || '/'
|
|
35
41
|
const pathname = path.split(/[?#]/, 1)[0]
|
|
36
42
|
const method = headers[HTTP2_HEADER_METHOD] || HTTP2_METHOD_GET
|
|
37
43
|
const base = `${sessionDetails.protocol}//${sessionDetails.host}:${sessionDetails.port}`
|
|
38
44
|
const uri = `${base}${pathname}`
|
|
39
45
|
const allowed = this.config.filter(uri)
|
|
40
|
-
const
|
|
46
|
+
const otelBase = sessionDetails.hasAuth
|
|
47
|
+
? `${sessionDetails.protocol}//REDACTED:REDACTED@${sessionDetails.host}:${sessionDetails.port}`
|
|
48
|
+
: base
|
|
49
|
+
const otelUri = sessionDetails.hasAuth ? `${otelBase}${pathname}` : uri
|
|
41
50
|
|
|
42
51
|
const store = storage('legacy').getStore()
|
|
43
52
|
const childOf = store && allowed ? store.span : null
|
|
53
|
+
const meta = {
|
|
54
|
+
[COMPONENT]: this.constructor.id,
|
|
55
|
+
[SPAN_KIND]: CLIENT,
|
|
56
|
+
'resource.name': method,
|
|
57
|
+
'span.type': 'http',
|
|
58
|
+
'http.method': method,
|
|
59
|
+
'http.url': otelSemantics ? buildClientHttpUrl(this.config, otelBase, path, otelUri) : uri,
|
|
60
|
+
'out.host': sessionDetails.host,
|
|
61
|
+
}
|
|
62
|
+
if (otelSemantics) {
|
|
63
|
+
const resource = otelHttpResourceName(method)
|
|
64
|
+
meta['resource.name'] = resource
|
|
65
|
+
meta[INSTRUMENTATION_HTTP_RESOURCE] = resource
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
const span = this.startSpan(this.operationName(), {
|
|
45
69
|
childOf,
|
|
46
70
|
integrationName: this.constructor.id,
|
|
47
71
|
service: this.serviceName({ pluginConfig: this.config, sessionDetails }),
|
|
48
|
-
meta
|
|
49
|
-
[COMPONENT]: this.constructor.id,
|
|
50
|
-
[SPAN_KIND]: CLIENT,
|
|
51
|
-
'resource.name': method,
|
|
52
|
-
'span.type': 'http',
|
|
53
|
-
'http.method': method,
|
|
54
|
-
'http.url': otelSemantics ? buildClientHttpUrl(this.config, base, path, uri) : uri,
|
|
55
|
-
'out.host': sessionDetails.host,
|
|
56
|
-
},
|
|
72
|
+
meta,
|
|
57
73
|
metrics: {
|
|
58
74
|
[CLIENT_PORT_KEY]: Number.parseInt(sessionDetails.port, 10),
|
|
59
75
|
},
|
|
@@ -108,6 +124,9 @@ class Http2ClientPlugin extends ClientPlugin {
|
|
|
108
124
|
|
|
109
125
|
if (!this.config.validateStatus(status)) {
|
|
110
126
|
storage('legacy').run(store, () => this.addError())
|
|
127
|
+
if (this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
128
|
+
store.span.setTag(HTTP_STATUS_ERROR, String(status))
|
|
129
|
+
}
|
|
111
130
|
}
|
|
112
131
|
|
|
113
132
|
addHeaderTags(store.span, headers, HTTP_RESPONSE_HEADERS, this.config)
|
|
@@ -123,7 +142,12 @@ class Http2ClientPlugin extends ClientPlugin {
|
|
|
123
142
|
}
|
|
124
143
|
}
|
|
125
144
|
|
|
126
|
-
|
|
145
|
+
/**
|
|
146
|
+
* @param {string | URL | import('node:http2').ClientSessionOptions} authority
|
|
147
|
+
* @param {import('node:http2').SecureClientSessionOptions} options
|
|
148
|
+
* @param {boolean} otelSemantics
|
|
149
|
+
*/
|
|
150
|
+
function extractSessionDetails (authority, options, otelSemantics) {
|
|
127
151
|
if (typeof authority === 'string') {
|
|
128
152
|
authority = new URL(authority)
|
|
129
153
|
}
|
|
@@ -139,7 +163,8 @@ function extractSessionDetails (authority, options) {
|
|
|
139
163
|
host = options.host || host
|
|
140
164
|
}
|
|
141
165
|
|
|
142
|
-
|
|
166
|
+
const hasAuth = otelSemantics && Boolean(authority.username || authority.password)
|
|
167
|
+
return { protocol, port, host, hasAuth }
|
|
143
168
|
}
|
|
144
169
|
|
|
145
170
|
function hasAmazonSignature (headers, path) {
|
|
@@ -36,6 +36,8 @@ const {
|
|
|
36
36
|
TEST_MANAGEMENT_ENABLED,
|
|
37
37
|
TEST_MANAGEMENT_IS_QUARANTINED,
|
|
38
38
|
TEST_MANAGEMENT_IS_DISABLED,
|
|
39
|
+
TEST_MANAGEMENT_PREVENT_FAILURE_SUPPRESSION,
|
|
40
|
+
TEST_MANAGEMENT_NO_AUTO_RETRY,
|
|
39
41
|
TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX,
|
|
40
42
|
TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED,
|
|
41
43
|
TEST_HAS_FAILED_ALL_RETRIES,
|
|
@@ -436,6 +438,7 @@ class JestPlugin extends CiPlugin {
|
|
|
436
438
|
attemptToFixFailed,
|
|
437
439
|
isAtrRetry,
|
|
438
440
|
finalStatus,
|
|
441
|
+
deferredFinish,
|
|
439
442
|
earlyFlakeAbortReason,
|
|
440
443
|
promises,
|
|
441
444
|
}) => {
|
|
@@ -468,6 +471,20 @@ class JestPlugin extends CiPlugin {
|
|
|
468
471
|
this.getTestTelemetryTags(span)
|
|
469
472
|
)
|
|
470
473
|
|
|
474
|
+
if (deferredFinish) {
|
|
475
|
+
// Native describe retries can stop after later process errors or hooks.
|
|
476
|
+
// Delay publication, not the execution's monotonic end time or child cleanup.
|
|
477
|
+
const finishTime = span._getTime()
|
|
478
|
+
finishAllTraceSpans(span)
|
|
479
|
+
this.activeTestSpan = null
|
|
480
|
+
deferredFinish.finish = finalStatus => {
|
|
481
|
+
if (finalStatus) span.setTag(TEST_FINAL_STATUS, finalStatus)
|
|
482
|
+
span.finish(finishTime)
|
|
483
|
+
if (finalStatus) this.cancelDiBreakpointHitWait()
|
|
484
|
+
}
|
|
485
|
+
return
|
|
486
|
+
}
|
|
487
|
+
|
|
471
488
|
const finish = () => {
|
|
472
489
|
span.finish()
|
|
473
490
|
finishAllTraceSpans(span)
|
|
@@ -562,6 +579,9 @@ class JestPlugin extends CiPlugin {
|
|
|
562
579
|
isQuarantined,
|
|
563
580
|
isModified,
|
|
564
581
|
hasDynamicName,
|
|
582
|
+
mustFail,
|
|
583
|
+
noAutoRetry,
|
|
584
|
+
assignedManagementProperties,
|
|
565
585
|
testSuiteAbsolutePath,
|
|
566
586
|
} = test
|
|
567
587
|
|
|
@@ -570,6 +590,8 @@ class JestPlugin extends CiPlugin {
|
|
|
570
590
|
[TEST_PARAMETERS]: testParameters,
|
|
571
591
|
[TEST_FRAMEWORK_VERSION]: frameworkVersion,
|
|
572
592
|
}
|
|
593
|
+
if (mustFail) extraTags[TEST_MANAGEMENT_PREVENT_FAILURE_SUPPRESSION] = 'true'
|
|
594
|
+
if (noAutoRetry) extraTags[TEST_MANAGEMENT_NO_AUTO_RETRY] = 'true'
|
|
573
595
|
if (testStartLine) {
|
|
574
596
|
extraTags[TEST_SOURCE_START] = testStartLine
|
|
575
597
|
}
|
|
@@ -580,7 +602,7 @@ class JestPlugin extends CiPlugin {
|
|
|
580
602
|
extraTags[JEST_DISPLAY_NAME] = displayName
|
|
581
603
|
}
|
|
582
604
|
|
|
583
|
-
if (isAttemptToFix) {
|
|
605
|
+
if (assignedManagementProperties?.isAttemptToFix ?? isAttemptToFix) {
|
|
584
606
|
extraTags[TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX] = 'true'
|
|
585
607
|
}
|
|
586
608
|
|
|
@@ -595,11 +617,11 @@ class JestPlugin extends CiPlugin {
|
|
|
595
617
|
extraTags[TEST_RETRY_REASON] = TEST_RETRY_REASON_TYPES.ext
|
|
596
618
|
}
|
|
597
619
|
|
|
598
|
-
if (isDisabled) {
|
|
620
|
+
if (assignedManagementProperties?.isDisabled ?? isDisabled) {
|
|
599
621
|
extraTags[TEST_MANAGEMENT_IS_DISABLED] = 'true'
|
|
600
622
|
}
|
|
601
623
|
|
|
602
|
-
if (isQuarantined) {
|
|
624
|
+
if (assignedManagementProperties?.isQuarantined ?? isQuarantined) {
|
|
603
625
|
extraTags[TEST_MANAGEMENT_IS_QUARANTINED] = 'true'
|
|
604
626
|
}
|
|
605
627
|
|