dd-trace 6.15.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/ci/diagnose.js +0 -23
- package/ci/test-optimization-validation/approval-artifacts.js +0 -3
- package/ci/test-optimization-validation/approval.js +0 -6
- package/ci/test-optimization-validation/artifact-id.js +0 -1
- package/ci/test-optimization-validation/bounded-json.js +0 -1
- package/ci/test-optimization-validation/cli.js +0 -12
- package/ci/test-optimization-validation/command-output-policy.js +0 -1
- package/ci/test-optimization-validation/command-runner.js +0 -3
- package/ci/test-optimization-validation/environment.js +0 -4
- package/ci/test-optimization-validation/executable-approval.js +0 -1
- package/ci/test-optimization-validation/executable.js +0 -5
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +4 -8
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -3
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -6
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -4
- package/ci/test-optimization-validation/generated-test-contract.js +0 -5
- package/ci/test-optimization-validation/generated-verifier.js +0 -1
- package/ci/test-optimization-validation/literal-environment.js +0 -1
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -17
- package/ci/test-optimization-validation/manifest-schema.js +0 -21
- package/ci/test-optimization-validation/offline-fixtures.js +0 -4
- package/ci/test-optimization-validation/package-check.js +4 -1
- package/ci/test-optimization-validation/plan-writer.js +0 -11
- package/ci/test-optimization-validation/preflight-runner.js +0 -1
- package/ci/test-optimization-validation/redaction.js +0 -4
- package/ci/test-optimization-validation/report-writer.js +0 -16
- package/ci/test-optimization-validation/runner-command.js +0 -3
- package/ci/test-optimization-validation/runner-contract.js +0 -4
- package/ci/test-optimization-validation/safe-files.js +0 -1
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -1
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +1 -2
- package/ci/test-optimization-validation/source-text.js +0 -3
- package/ci/vitest-no-worker-init-setup.mjs +41 -16
- package/index.d.ts +169 -0
- package/next.d.ts +27 -0
- package/next.js +3 -0
- package/package.json +28 -23
- package/packages/datadog-esbuild/index.js +14 -1
- package/packages/datadog-esbuild/src/resolver.js +284 -0
- package/packages/datadog-esbuild/src/utils.js +162 -120
- package/packages/datadog-instrumentations/src/aerospike.js +28 -6
- package/packages/datadog-instrumentations/src/ai.js +39 -97
- package/packages/datadog-instrumentations/src/anthropic.js +76 -134
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +1 -3
- package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/azure-cosmos.js +1 -1
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +23 -9
- package/packages/datadog-instrumentations/src/azure-functions.js +48 -0
- package/packages/datadog-instrumentations/src/bullmq.js +1 -1
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +1 -3
- package/packages/datadog-instrumentations/src/console.js +97 -0
- package/packages/datadog-instrumentations/src/cucumber.js +72 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +0 -23
- package/packages/datadog-instrumentations/src/dd-trace-api.js +2 -2
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +39 -14
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +25 -8
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +69 -0
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +13 -64
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +109 -29
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +39 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/azure-durable-functions.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -16
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +36 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/supabase.js +128 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +6 -7
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +99 -75
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
- package/packages/datadog-instrumentations/src/jest.js +141 -51
- package/packages/datadog-instrumentations/src/knex.js +0 -1
- package/packages/datadog-instrumentations/src/langchain.js +1 -1
- package/packages/datadog-instrumentations/src/langgraph.js +1 -1
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +0 -24
- package/packages/datadog-instrumentations/src/mariadb.js +0 -2
- package/packages/datadog-instrumentations/src/mercurius.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/common.js +0 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +22 -25
- package/packages/datadog-instrumentations/src/mocha/utils.js +119 -49
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +0 -6
- package/packages/datadog-instrumentations/src/mocha/worker.js +14 -17
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +0 -2
- package/packages/datadog-instrumentations/src/openai-agents.js +1 -1
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +241 -0
- package/packages/datadog-instrumentations/src/openai-realtime/events.js +76 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +301 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +998 -0
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +211 -0
- package/packages/datadog-instrumentations/src/openai.js +97 -80
- package/packages/datadog-instrumentations/src/oracledb.js +9 -3
- package/packages/datadog-instrumentations/src/playwright-reporter.js +3 -16
- package/packages/datadog-instrumentations/src/playwright.js +238 -55
- package/packages/datadog-instrumentations/src/postgres.js +7 -0
- package/packages/datadog-instrumentations/src/router.js +0 -2
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +0 -2
- package/packages/datadog-instrumentations/src/sequelize.js +0 -1
- package/packages/datadog-instrumentations/src/supabase.js +15 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +37 -17
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +56 -23
- package/packages/datadog-instrumentations/src/webdriverio.js +23 -42
- package/packages/datadog-instrumentations/src/ws.js +0 -1
- package/packages/datadog-plugin-ai/src/utils.js +0 -2
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +0 -1
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +0 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +7 -2
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/util.js +0 -1
- package/packages/datadog-plugin-azure-cosmos/src/index.js +1 -1
- package/packages/datadog-plugin-azure-durable-functions/src/index.js +95 -1
- package/packages/datadog-plugin-cucumber/src/index.js +10 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +171 -75
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +0 -4
- package/packages/datadog-plugin-cypress/src/support.js +52 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -24
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +2 -36
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +31 -0
- package/packages/datadog-plugin-graphql/src/resolve-error.js +32 -11
- package/packages/datadog-plugin-graphql/src/utils.js +0 -5
- package/packages/datadog-plugin-jest/src/index.js +13 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +39 -11
- package/packages/datadog-plugin-mongodb-core/src/query.js +0 -1
- package/packages/datadog-plugin-openai/src/index.js +16 -1
- package/packages/datadog-plugin-openai/src/realtime.js +144 -0
- package/packages/datadog-plugin-openai-agents/src/integration.js +0 -4
- package/packages/datadog-plugin-openai-agents/src/util.js +0 -1
- package/packages/datadog-plugin-playwright/src/index.js +76 -9
- package/packages/datadog-plugin-postgres/src/index.js +167 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +0 -1
- package/packages/datadog-plugin-redis/src/index.js +15 -1
- package/packages/datadog-plugin-supabase/src/error.js +18 -0
- package/packages/datadog-plugin-supabase/src/index.js +21 -0
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +69 -0
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +70 -0
- package/packages/datadog-plugin-supabase/src/supabase-postgrest-js-postgrestbuilder-then.js +122 -0
- package/packages/datadog-plugin-supabase/src/supabase-realtime-js-realtimechannel-send.js +66 -0
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +93 -0
- package/packages/datadog-plugin-supabase/src/url.js +17 -0
- package/packages/datadog-plugin-vitest/src/index.js +10 -0
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-turbopack/index.js +206 -0
- package/packages/datadog-turbopack/src/constants.js +5 -0
- package/packages/datadog-turbopack/src/loader.js +484 -0
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/aiguard/client.js +2 -3
- package/packages/dd-trace/src/aiguard/evaluation.js +6 -12
- package/packages/dd-trace/src/aiguard/index.js +3 -2
- package/packages/dd-trace/src/aiguard/integrations/anthropic.js +53 -25
- package/packages/dd-trace/src/aiguard/integrations/evaluate.js +49 -25
- package/packages/dd-trace/src/aiguard/integrations/index.js +4 -3
- package/packages/dd-trace/src/aiguard/integrations/openai.js +132 -29
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +116 -42
- package/packages/dd-trace/src/aiguard/messages/anthropic.js +0 -2
- package/packages/dd-trace/src/aiguard/messages/openai.js +64 -1
- package/packages/dd-trace/src/aiguard/messages/utils.js +29 -2
- package/packages/dd-trace/src/aiguard/messages/vercel-ai.js +25 -0
- package/packages/dd-trace/src/aiguard/redaction.js +0 -1
- package/packages/dd-trace/src/aiguard/sdk.js +1 -1
- package/packages/dd-trace/src/appsec/activation.js +1 -1
- package/packages/dd-trace/src/appsec/api_security/normalized-route.js +0 -5
- package/packages/dd-trace/src/appsec/api_security/sampler.js +0 -4
- package/packages/dd-trace/src/appsec/blocking/index.js +3 -3
- package/packages/dd-trace/src/appsec/downstream_requests.js +1 -4
- package/packages/dd-trace/src/appsec/iast/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +5 -5
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +3 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +8 -10
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +4 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +7 -7
- package/packages/dd-trace/src/appsec/index.js +2 -2
- package/packages/dd-trace/src/appsec/lambda.js +71 -2
- package/packages/dd-trace/src/appsec/rasp/utils.js +5 -1
- package/packages/dd-trace/src/appsec/remote_config.js +8 -6
- package/packages/dd-trace/src/appsec/reporter.js +10 -6
- package/packages/dd-trace/src/appsec/rule_manager.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +0 -2
- package/packages/dd-trace/src/appsec/telemetry/api_security.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/common.js +4 -0
- package/packages/dd-trace/src/appsec/telemetry/index.js +23 -5
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +1 -20
- package/packages/dd-trace/src/appsec/telemetry/user.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/waf.js +1 -20
- package/packages/dd-trace/src/appsec/waf/index.js +2 -2
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +8 -5
- package/packages/dd-trace/src/carrier.js +0 -5
- package/packages/dd-trace/src/ci-visibility/dynamic-atr-retries.js +104 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +0 -2
- package/packages/dd-trace/src/ci-visibility/efd-retry-policy.js +34 -3
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -4
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +37 -15
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -3
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +0 -11
- package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +0 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +0 -6
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -2
- package/packages/dd-trace/src/ci-visibility/requests/rate-limit.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +0 -5
- package/packages/dd-trace/src/ci-visibility/requests/video-request.js +0 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +13 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +0 -1
- package/packages/dd-trace/src/ci-visibility/test-screenshot.js +0 -2
- package/packages/dd-trace/src/ci-visibility/test-video.js +0 -1
- package/packages/dd-trace/src/config/defaults.js +3 -2
- package/packages/dd-trace/src/config/generated-config-types.d.ts +74 -66
- package/packages/dd-trace/src/config/helper.js +9 -2
- package/packages/dd-trace/src/config/index.js +44 -29
- package/packages/dd-trace/src/config/parsers.js +34 -6
- package/packages/dd-trace/src/config/remote_config.js +25 -109
- package/packages/dd-trace/src/config/supported-configurations.json +146 -9
- package/packages/dd-trace/src/datastreams/encoding.js +0 -1
- package/packages/dd-trace/src/datastreams/pathway.js +0 -1
- package/packages/dd-trace/src/debugger/constants.js +10 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +76 -17
- package/packages/dd-trace/src/debugger/devtools_client/config.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/guardrail-metrics.js +15 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +103 -27
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +50 -7
- package/packages/dd-trace/src/debugger/devtools_client/log.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +34 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +40 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +53 -13
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +118 -71
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +20 -6
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +50 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +0 -3
- package/packages/dd-trace/src/debugger/probe_sampler.js +133 -9
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +31 -1
- package/packages/dd-trace/src/dogstatsd.js +0 -23
- package/packages/dd-trace/src/encode/0.4-cross-payload.js +0 -3
- package/packages/dd-trace/src/encode/0.4.js +0 -7
- package/packages/dd-trace/src/encode/0.5.js +0 -2
- package/packages/dd-trace/src/encode/tags-processors.js +0 -1
- package/packages/dd-trace/src/evp_proxy/discovery.js +3 -5
- package/packages/dd-trace/src/evp_proxy/path.js +11 -4
- package/packages/dd-trace/src/exporters/agent/writer.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/intake.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/writer.js +0 -3
- package/packages/dd-trace/src/exporters/common/docker.js +4 -1
- package/packages/dd-trace/src/exporters/common/final-flush-request-tracker.js +0 -6
- package/packages/dd-trace/src/exporters/common/proxy.js +3 -0
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/common/url.js +0 -2
- package/packages/dd-trace/src/exporters/common/writer.js +0 -2
- package/packages/dd-trace/src/id.js +0 -11
- package/packages/dd-trace/src/llmobs/audio-codec.js +192 -0
- package/packages/dd-trace/src/llmobs/audio-utils.js +121 -0
- package/packages/dd-trace/src/llmobs/constants/audio.js +35 -0
- package/packages/dd-trace/src/llmobs/constants/prompts.js +14 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +17 -0
- package/packages/dd-trace/src/llmobs/eval-metric.js +0 -6
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +0 -4
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +0 -3
- package/packages/dd-trace/src/llmobs/experiments/index.js +7 -6
- package/packages/dd-trace/src/llmobs/experiments/util.js +1 -11
- package/packages/dd-trace/src/llmobs/index.js +1 -3
- package/packages/dd-trace/src/llmobs/noop.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +0 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +285 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +16 -3
- package/packages/dd-trace/src/llmobs/prompts/cache.js +272 -0
- package/packages/dd-trace/src/llmobs/prompts/manager.js +639 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +92 -0
- package/packages/dd-trace/src/llmobs/sdk.js +21 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +81 -2
- package/packages/dd-trace/src/llmobs/tagger.js +30 -7
- package/packages/dd-trace/src/llmobs/telemetry.js +36 -4
- package/packages/dd-trace/src/llmobs/util.js +0 -34
- package/packages/dd-trace/src/llmobs/writers/base.js +0 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/channels.js +3 -0
- package/packages/dd-trace/src/log/index.js +23 -5
- package/packages/dd-trace/src/log-submission/log-submission-plugin.js +74 -6
- package/packages/dd-trace/src/msgpack/chunk.js +0 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +0 -12
- package/packages/dd-trace/src/openfeature/encoding.js +0 -2
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/index.js +0 -4
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/span-enrichment.js +0 -4
- package/packages/dd-trace/src/openfeature/writers/base.js +0 -6
- package/packages/dd-trace/src/openfeature/writers/exposures.js +0 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +0 -4
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +0 -2
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +103 -35
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +36 -13
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +0 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +0 -3
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +0 -6
- package/packages/dd-trace/src/opentracing/span_context.js +0 -1
- package/packages/dd-trace/src/otel-thread-ctx.js +38 -11
- package/packages/dd-trace/src/payload-tagging/tagging.js +15 -3
- package/packages/dd-trace/src/plugin_manager.js +9 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +0 -1
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +8 -0
- package/packages/dd-trace/src/plugins/plugin.js +0 -4
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +1 -3
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +0 -1
- package/packages/dd-trace/src/plugins/util/llm.js +0 -2
- package/packages/dd-trace/src/plugins/util/status-validator.js +0 -1
- package/packages/dd-trace/src/plugins/util/test.js +25 -21
- package/packages/dd-trace/src/plugins/util/url.js +0 -5
- package/packages/dd-trace/src/priority_sampler.js +0 -6
- package/packages/dd-trace/src/process-tags/index.js +0 -1
- package/packages/dd-trace/src/profiler.js +132 -35
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +0 -1
- package/packages/dd-trace/src/profiling/profiler.js +101 -41
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +29 -15
- package/packages/dd-trace/src/propagation-hash/index.js +0 -1
- package/packages/dd-trace/src/proxy.js +21 -45
- package/packages/dd-trace/src/random_sampler.js +0 -4
- package/packages/dd-trace/src/rate_limiter.js +0 -4
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -9
- package/packages/dd-trace/src/remote_config/index.js +0 -1
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +0 -3
- package/packages/dd-trace/src/sampler.js +0 -4
- package/packages/dd-trace/src/sampling_rule.js +0 -7
- package/packages/dd-trace/src/serverless/vercel.js +0 -1
- package/packages/dd-trace/src/serverless.js +0 -1
- package/packages/dd-trace/src/service-naming/index.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +7 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +5 -0
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/span_sampler.js +0 -1
- package/packages/dd-trace/src/standalone/product.js +2 -2
- package/packages/dd-trace/src/standalone/tracesource.js +0 -1
- package/packages/dd-trace/src/startup-log.js +1 -1
- package/packages/dd-trace/src/telemetry/endpoints.js +0 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +16 -5
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +16 -6
- package/packages/dd-trace/src/telemetry/metrics.js +0 -2
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +0 -10
|
@@ -16,10 +16,15 @@ let testManagementTests = {}
|
|
|
16
16
|
let isImpactedTestsEnabled = false
|
|
17
17
|
let isModifiedTest = false
|
|
18
18
|
let isTestIsolationEnabled = false
|
|
19
|
+
let isDynamicAtrEnabled = false
|
|
20
|
+
let isTextTerminal = false
|
|
19
21
|
let hasWarnedMissingBeforeEachTaskResult = false
|
|
20
22
|
let hasWarnedMissingBeforeEachRetryResult = false
|
|
21
23
|
// Array of test names that have been retried and the reason
|
|
22
24
|
const retryReasonsByTestName = new Map()
|
|
25
|
+
// Dynamic ATR computes the selected budget after the first attempt. Keep that result
|
|
26
|
+
// in browser state and apply it when Cypress starts the retry runnable.
|
|
27
|
+
const dynamicAtrRetryCountByTest = new Map()
|
|
23
28
|
// Track test errors suppressed by test management so we can still report them to Datadog.
|
|
24
29
|
const suppressedTestFailures = new Map()
|
|
25
30
|
|
|
@@ -93,7 +98,6 @@ function getTestProperties (testName) {
|
|
|
93
98
|
|
|
94
99
|
/**
|
|
95
100
|
* @param {string} message
|
|
96
|
-
* @returns {void}
|
|
97
101
|
*/
|
|
98
102
|
function warnMissingBeforeEachTaskResult (message) {
|
|
99
103
|
// eslint-disable-next-line no-console
|
|
@@ -192,7 +196,6 @@ function setRumCorrelationCookie (traceId) {
|
|
|
192
196
|
|
|
193
197
|
/**
|
|
194
198
|
* @param {boolean} isCookieSet
|
|
195
|
-
* @returns {void}
|
|
196
199
|
*/
|
|
197
200
|
function restartRumSession (isCookieSet) {
|
|
198
201
|
if (!isCookieSet || isTestIsolationEnabled || !originalWindow) {
|
|
@@ -362,20 +365,47 @@ Cypress.mocha.getRunner().runTests = function (suite, fn) {
|
|
|
362
365
|
return oldRunTests.apply(this, [suite, fn])
|
|
363
366
|
}
|
|
364
367
|
|
|
365
|
-
|
|
368
|
+
/**
|
|
369
|
+
* @param {{ id: string }} test
|
|
370
|
+
*/
|
|
371
|
+
function getDynamicAtrTestKey (test) {
|
|
372
|
+
// Cypress preserves the runnable ID when cloning a retry, including across browser reloads.
|
|
373
|
+
return `${Cypress.mocha.getRootSuite().file}\0${test.id}`
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* @param {{ id: string, _retries: number }} test
|
|
378
|
+
*/
|
|
379
|
+
function configureTestRetries (test) {
|
|
366
380
|
if (shouldDisableFrameworkRetries(test)) {
|
|
367
381
|
disableFrameworkRetries(test)
|
|
382
|
+
return
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (!isTextTerminal) return
|
|
386
|
+
|
|
387
|
+
const dynamicAtrRetryCount = dynamicAtrRetryCountByTest.get(getDynamicAtrTestKey(test))
|
|
388
|
+
if (Number.isSafeInteger(dynamicAtrRetryCount)) {
|
|
389
|
+
test._retries = dynamicAtrRetryCount
|
|
390
|
+
} else if (isDynamicAtrEnabled) {
|
|
391
|
+
// Cypress forbids calling retries(count) on the original runnable.
|
|
392
|
+
// Ensure local retries: 0 overrides still reach the duration-based budget selection.
|
|
393
|
+
test._retries = Math.max(1, test._retries)
|
|
368
394
|
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
Cypress.on('test:before:run', (attributes, test) => {
|
|
398
|
+
configureTestRetries(test)
|
|
369
399
|
})
|
|
370
400
|
|
|
371
401
|
Cypress.on('test:before:run:async', (attributes, test) => {
|
|
372
|
-
|
|
373
|
-
disableFrameworkRetries(test)
|
|
374
|
-
}
|
|
402
|
+
configureTestRetries(test)
|
|
375
403
|
})
|
|
376
404
|
|
|
377
405
|
beforeEach(function () {
|
|
378
406
|
const currentTest = Cypress.mocha.getRunner().suite.ctx.currentTest
|
|
407
|
+
// The first test:before:run event can precede the suite configuration task.
|
|
408
|
+
configureTestRetries(currentTest)
|
|
379
409
|
const testName = currentTest.fullTitle()
|
|
380
410
|
|
|
381
411
|
const retryMessage = retryReasonsByTestName.get(testName)
|
|
@@ -427,6 +457,7 @@ before(function () {
|
|
|
427
457
|
cy.task('dd:testSuiteStart', {
|
|
428
458
|
testSuite: Cypress.mocha.getRootSuite().file,
|
|
429
459
|
testSuiteAbsolutePath: Cypress.spec && Cypress.spec.absolute,
|
|
460
|
+
isTextTerminal: Cypress.config('isTextTerminal'),
|
|
430
461
|
}).then((suiteConfig) => {
|
|
431
462
|
if (suiteConfig) {
|
|
432
463
|
isEarlyFlakeDetectionEnabled = suiteConfig.isEarlyFlakeDetectionEnabled
|
|
@@ -439,6 +470,12 @@ before(function () {
|
|
|
439
470
|
isImpactedTestsEnabled = suiteConfig.isImpactedTestsEnabled
|
|
440
471
|
isModifiedTest = suiteConfig.isModifiedTest
|
|
441
472
|
isTestIsolationEnabled = suiteConfig.isTestIsolationEnabled
|
|
473
|
+
isDynamicAtrEnabled = suiteConfig.isDynamicAtrEnabled
|
|
474
|
+
isTextTerminal = suiteConfig.isTextTerminal
|
|
475
|
+
if (isDynamicAtrEnabled && isTextTerminal) {
|
|
476
|
+
// The first test event can precede this task, and an earlier user hook can skip our beforeEach.
|
|
477
|
+
Cypress.mocha.getRootSuite().eachTest(configureTestRetries)
|
|
478
|
+
}
|
|
442
479
|
rumTestExecutionIdCookieName = suiteConfig.rumTestExecutionIdCookieName
|
|
443
480
|
if (Number.isFinite(suiteConfig.rumFlushWaitMillis)) {
|
|
444
481
|
rumFlushWaitMillis = suiteConfig.rumFlushWaitMillis
|
|
@@ -448,6 +485,7 @@ before(function () {
|
|
|
448
485
|
})
|
|
449
486
|
|
|
450
487
|
after(() => {
|
|
488
|
+
dynamicAtrRetryCountByTest.clear()
|
|
451
489
|
try {
|
|
452
490
|
if (safeGetRum(originalWindow)) {
|
|
453
491
|
originalWindow.dispatchEvent(new Event('beforeunload'))
|
|
@@ -475,6 +513,7 @@ afterEach(function () {
|
|
|
475
513
|
: currentTest.err
|
|
476
514
|
|
|
477
515
|
const testInfo = {
|
|
516
|
+
testId: currentTest.id,
|
|
478
517
|
testName,
|
|
479
518
|
testItTitle: currentTest.title,
|
|
480
519
|
testSuite: Cypress.mocha.getRootSuite().file,
|
|
@@ -522,5 +561,11 @@ afterEach(function () {
|
|
|
522
561
|
suppressedTestFailures.delete(testName)
|
|
523
562
|
}
|
|
524
563
|
|
|
525
|
-
cy.task('dd:afterEach', { test: testInfo, coverage, commands: commandsToReport })
|
|
564
|
+
cy.task('dd:afterEach', { test: testInfo, coverage, commands: commandsToReport }).then((taskResult) => {
|
|
565
|
+
// Preserve the first-attempt result until Cypress starts the retry runnable.
|
|
566
|
+
// Changing the completed test here is too late for Cypress's retry lifecycle.
|
|
567
|
+
if (taskResult && Number.isSafeInteger(taskResult.dynamicAtrRetryCount)) {
|
|
568
|
+
dynamicAtrRetryCountByTest.set(getDynamicAtrTestKey(currentTest), taskResult.dynamicAtrRetryCount)
|
|
569
|
+
}
|
|
570
|
+
})
|
|
526
571
|
})
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const { getMessageSize } = require('../../dd-trace/src/datastreams')
|
|
4
4
|
const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
|
|
5
|
-
const SpanContext = require('../../dd-trace/src/opentracing/span_context')
|
|
6
|
-
const id = require('../../dd-trace/src/id')
|
|
7
5
|
const { storage } = require('../../datadog-core')
|
|
6
|
+
const reconstructPubSubRequestContext = require('./pubsub-request-context')
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* PULL SUBSCRIPTION: Service explicitly pulls messages from Pub/Sub and processes them.
|
|
@@ -75,27 +74,6 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
|
75
74
|
})
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
#reconstructPubSubRequestContext (attrs) {
|
|
79
|
-
const traceIdLower = attrs['_dd.pubsub_request.trace_id']
|
|
80
|
-
const spanId = attrs['_dd.pubsub_request.span_id']
|
|
81
|
-
const traceIdUpper = attrs['_dd.pubsub_request.p.tid']
|
|
82
|
-
|
|
83
|
-
if (!traceIdLower || !spanId) return null
|
|
84
|
-
|
|
85
|
-
const traceId128 = traceIdUpper ? traceIdUpper + traceIdLower : traceIdLower.padStart(32, '0')
|
|
86
|
-
const traceId = id(traceId128, 16)
|
|
87
|
-
const parentId = id(spanId, 16)
|
|
88
|
-
|
|
89
|
-
const tags = {}
|
|
90
|
-
if (traceIdUpper) tags['_dd.p.tid'] = traceIdUpper
|
|
91
|
-
|
|
92
|
-
return new SpanContext({
|
|
93
|
-
traceId,
|
|
94
|
-
spanId: parentId,
|
|
95
|
-
tags,
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
|
|
99
77
|
start (ctx) {
|
|
100
78
|
if (!this.config.dsmEnabled) return
|
|
101
79
|
const { message } = ctx
|
|
@@ -128,7 +106,7 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
|
128
106
|
|
|
129
107
|
const isFirstMessage = batchIndex === 0
|
|
130
108
|
if (isFirstMessage && batchRequestSpanId) {
|
|
131
|
-
const pubsubRequestContext =
|
|
109
|
+
const pubsubRequestContext = reconstructPubSubRequestContext(message.attributes)
|
|
132
110
|
if (pubsubRequestContext) {
|
|
133
111
|
childOf = pubsubRequestContext
|
|
134
112
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
4
|
-
const SpanContext = require('../../dd-trace/src/opentracing/span_context')
|
|
5
|
-
const id = require('../../dd-trace/src/id')
|
|
6
4
|
const log = require('../../dd-trace/src/log')
|
|
5
|
+
const reconstructPubSubRequestContext = require('./pubsub-request-context')
|
|
7
6
|
|
|
8
7
|
// WeakMap to track push receive spans by request
|
|
9
8
|
const pushReceiveSpans = new WeakMap()
|
|
@@ -69,7 +68,7 @@ class GoogleCloudPubsubPushSubscriptionPlugin extends TracingPlugin {
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
const originalContext = this.#extractContext(messageData)
|
|
72
|
-
const pubsubRequestContext =
|
|
71
|
+
const pubsubRequestContext = reconstructPubSubRequestContext(messageData.attrs) || originalContext
|
|
73
72
|
const isSameTrace = pubsubRequestContext &&
|
|
74
73
|
originalContext?.toTraceId() === pubsubRequestContext.toTraceId()
|
|
75
74
|
|
|
@@ -109,39 +108,6 @@ class GoogleCloudPubsubPushSubscriptionPlugin extends TracingPlugin {
|
|
|
109
108
|
return this.tracer.extract('text_map', messageData.attrs)
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
#reconstructPubSubContext (attrs) {
|
|
113
|
-
/**
|
|
114
|
-
* Reconstruct the batch publish span context from message attributes.
|
|
115
|
-
*
|
|
116
|
-
* When a batch is published, the producer injects:
|
|
117
|
-
* - _dd.pubsub_request.trace_id: lower 64 bits of the batch span's trace ID (hex)
|
|
118
|
-
* - _dd.pubsub_request.span_id: the batch span's span ID (hex)
|
|
119
|
-
* - _dd.pubsub_request.p.tid: upper 64 bits of trace ID (hex, optional for 128-bit traces)
|
|
120
|
-
*
|
|
121
|
-
* This context represents the "pubsub.request" span on the producer side.
|
|
122
|
-
* We use it to create span links, connecting each pubsub.push.receive span back to the original batch.
|
|
123
|
-
*/
|
|
124
|
-
const traceIdLower = attrs['_dd.pubsub_request.trace_id']
|
|
125
|
-
const spanId = attrs['_dd.pubsub_request.span_id']
|
|
126
|
-
const traceIdUpper = attrs['_dd.pubsub_request.p.tid']
|
|
127
|
-
|
|
128
|
-
if (!traceIdLower || !spanId) return null
|
|
129
|
-
|
|
130
|
-
// Reconstruct full 128-bit trace ID (or pad 64-bit to 128-bit)
|
|
131
|
-
const traceId128 = traceIdUpper ? traceIdUpper + traceIdLower : traceIdLower.padStart(32, '0')
|
|
132
|
-
const traceId = id(traceId128, 16)
|
|
133
|
-
const parentId = id(spanId, 16)
|
|
134
|
-
|
|
135
|
-
const tags = {}
|
|
136
|
-
if (traceIdUpper) tags['_dd.p.tid'] = traceIdUpper
|
|
137
|
-
|
|
138
|
-
return new SpanContext({
|
|
139
|
-
traceId,
|
|
140
|
-
spanId: parentId,
|
|
141
|
-
tags,
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
|
|
145
111
|
#createPushReceiveSpan (messageData, parentContext, linkContext) {
|
|
146
112
|
const { message, subscription, topicName, attrs } = messageData
|
|
147
113
|
const subscriptionName = subscription?.slice(subscription.lastIndexOf('/') + 1) ?? subscription
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const SpanContext = require('../../dd-trace/src/opentracing/span_context')
|
|
4
|
+
const id = require('../../dd-trace/src/id')
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {Record<string, string>} attributes
|
|
8
|
+
* @returns {import('../../dd-trace/src/opentracing/span_context') | null}
|
|
9
|
+
*/
|
|
10
|
+
function reconstructPubSubRequestContext (attributes) {
|
|
11
|
+
const traceIdLower = attributes['_dd.pubsub_request.trace_id']
|
|
12
|
+
const spanId = attributes['_dd.pubsub_request.span_id']
|
|
13
|
+
const traceIdUpper = attributes['_dd.pubsub_request.p.tid']
|
|
14
|
+
|
|
15
|
+
if (!traceIdLower || !spanId) return null
|
|
16
|
+
|
|
17
|
+
const traceId128 = traceIdUpper ? traceIdUpper + traceIdLower : traceIdLower.padStart(32, '0')
|
|
18
|
+
const traceId = id(traceId128, 16)
|
|
19
|
+
const parentId = id(spanId, 16)
|
|
20
|
+
|
|
21
|
+
const tags = {}
|
|
22
|
+
if (traceIdUpper) tags['_dd.p.tid'] = traceIdUpper
|
|
23
|
+
|
|
24
|
+
return new SpanContext({
|
|
25
|
+
traceId,
|
|
26
|
+
spanId: parentId,
|
|
27
|
+
tags,
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = reconstructPubSubRequestContext
|
|
@@ -61,28 +61,49 @@ class GraphQLToolsResolveErrorPlugin extends TracingPlugin {
|
|
|
61
61
|
* @param {readonly object[]} [fieldNodes]
|
|
62
62
|
*/
|
|
63
63
|
function recordResolveErrorForPath (error, path, fieldNodes) {
|
|
64
|
-
const fieldNode = fieldNodes?.[0]
|
|
65
64
|
const rootCtx = legacyStorage.getStore()?.graphqlRootCtx
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
}
|
|
65
|
+
if (!rootCtx?.config?.collapse || !rootCtx.fields) return
|
|
66
|
+
|
|
67
|
+
const field = findResolveField(rootCtx.fields, getPathString(path), fieldNodes?.[0])
|
|
68
|
+
if (field) recordResolveError(field, error)
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
/**
|
|
75
|
-
* @param {string} fieldPath
|
|
76
72
|
* @param {(string | number)[]} path
|
|
77
|
-
* @returns {boolean}
|
|
78
73
|
*/
|
|
79
|
-
function
|
|
74
|
+
function getPathString (path) {
|
|
80
75
|
let pathString = ''
|
|
81
76
|
for (let index = 0; index < path.length; index++) {
|
|
82
77
|
if (index !== 0) pathString += '.'
|
|
83
78
|
pathString += typeof path[index] === 'number' ? '*' : path[index]
|
|
84
79
|
}
|
|
85
|
-
return pathString
|
|
80
|
+
return pathString
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {Map<unknown, object>} fields
|
|
85
|
+
* @param {string} pathString
|
|
86
|
+
* @param {object} [fieldNode]
|
|
87
|
+
* @returns {object | undefined}
|
|
88
|
+
*/
|
|
89
|
+
function findResolveField (fields, pathString, fieldNode) {
|
|
90
|
+
const field = fields.get(pathString)
|
|
91
|
+
if (field === undefined) return
|
|
92
|
+
|
|
93
|
+
const parentTypeFields = field.parentTypeFields
|
|
94
|
+
if (parentTypeFields === undefined) {
|
|
95
|
+
return fieldNode === undefined || field.fieldNode === fieldNode ? field : undefined
|
|
96
|
+
}
|
|
97
|
+
if (parentTypeFields.parentTypeName !== undefined) {
|
|
98
|
+
if (fieldNode === undefined || parentTypeFields.fieldNode === fieldNode) return parentTypeFields
|
|
99
|
+
return field.fieldNode === fieldNode ? field : undefined
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let matchingField
|
|
103
|
+
for (const candidate of parentTypeFields.values()) {
|
|
104
|
+
if (fieldNode === undefined || candidate.fieldNode === fieldNode) matchingField = candidate
|
|
105
|
+
}
|
|
106
|
+
return matchingField
|
|
86
107
|
}
|
|
87
108
|
|
|
88
109
|
/**
|
|
@@ -54,7 +54,6 @@ function getRequestCache (owner, configuredLimit) {
|
|
|
54
54
|
/**
|
|
55
55
|
* @param {string | null | undefined} operationName
|
|
56
56
|
* @param {boolean} calculateSignature
|
|
57
|
-
* @returns {string}
|
|
58
57
|
*/
|
|
59
58
|
function operationCacheKey (operationName, calculateSignature) {
|
|
60
59
|
return `${calculateSignature === false ? 0 : 1}\n${operationName ?? ''}`
|
|
@@ -309,7 +308,6 @@ const HEALTH_CHECK_QUERY = 'query __ApolloServiceHealthCheck__ { __typename }'
|
|
|
309
308
|
* Matches the raw query string before it is parsed (the only input parse has).
|
|
310
309
|
*
|
|
311
310
|
* @param {unknown} source Raw query string or a graphql `Source` body.
|
|
312
|
-
* @returns {boolean}
|
|
313
311
|
*/
|
|
314
312
|
function isApolloHealthCheckSource (source) {
|
|
315
313
|
return source === HEALTH_CHECK_QUERY
|
|
@@ -319,7 +317,6 @@ function isApolloHealthCheckSource (source) {
|
|
|
319
317
|
* Matches Apollo's parsed health-check operation exactly for cached documents.
|
|
320
318
|
*
|
|
321
319
|
* @param {import('graphql').OperationDefinitionNode | undefined} operation
|
|
322
|
-
* @returns {boolean}
|
|
323
320
|
*/
|
|
324
321
|
function isApolloHealthCheck (operation) {
|
|
325
322
|
const selections = operation?.selectionSet?.selections
|
|
@@ -342,7 +339,6 @@ function isApolloHealthCheck (operation) {
|
|
|
342
339
|
|
|
343
340
|
/**
|
|
344
341
|
* @param {import('graphql').GraphQLOutputType} type
|
|
345
|
-
* @returns {string}
|
|
346
342
|
*/
|
|
347
343
|
function getBaseTypeName (type) {
|
|
348
344
|
let current = type
|
|
@@ -357,7 +353,6 @@ let tools
|
|
|
357
353
|
* @param {string | undefined} operationName
|
|
358
354
|
* @param {import('graphql').OperationTypeNode} operationType
|
|
359
355
|
* @param {boolean} [calculate]
|
|
360
|
-
* @returns {string}
|
|
361
356
|
*/
|
|
362
357
|
function getSignature (document, operationName, operationType, calculate) {
|
|
363
358
|
if (calculate !== false && tools !== false) {
|
|
@@ -41,6 +41,7 @@ const {
|
|
|
41
41
|
TEST_HAS_FAILED_ALL_RETRIES,
|
|
42
42
|
TEST_RETRY_REASON_TYPES,
|
|
43
43
|
TEST_IS_MODIFIED,
|
|
44
|
+
setExpectedEmptyTestSessionTags,
|
|
44
45
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
45
46
|
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
46
47
|
const id = require('../../dd-trace/src/id')
|
|
@@ -116,12 +117,22 @@ class JestPlugin extends CiPlugin {
|
|
|
116
117
|
isEarlyFlakeDetectionEnabled,
|
|
117
118
|
isEarlyFlakeDetectionFaulty,
|
|
118
119
|
isTestManagementTestsEnabled,
|
|
120
|
+
isExpectedEmptySession,
|
|
119
121
|
onDone,
|
|
120
122
|
}) => {
|
|
121
123
|
const finishSession = () => {
|
|
122
124
|
this.testSessionSpan.setTag(TEST_STATUS, status)
|
|
123
125
|
this.testModuleSpan.setTag(TEST_STATUS, status)
|
|
124
126
|
|
|
127
|
+
if (isExpectedEmptySession) {
|
|
128
|
+
setExpectedEmptyTestSessionTags(
|
|
129
|
+
this.testSessionSpan,
|
|
130
|
+
this.testModuleSpan,
|
|
131
|
+
'No tests were found',
|
|
132
|
+
'zero_tests'
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
125
136
|
if (error) {
|
|
126
137
|
this.testSessionSpan.setTag('error', error)
|
|
127
138
|
this.testModuleSpan.setTag('error', error)
|
|
@@ -204,6 +215,8 @@ class JestPlugin extends CiPlugin {
|
|
|
204
215
|
config._ddIsTestManagementTestsEnabled = this.libraryConfig?.isTestManagementEnabled ?? false
|
|
205
216
|
config._ddTestManagementAttemptToFixRetries = this.libraryConfig?.testManagementAttemptToFixRetries ?? 0
|
|
206
217
|
config._ddFlakyTestRetriesCount = this.libraryConfig?.flakyTestRetriesCount
|
|
218
|
+
config._ddIsDynamicAtrEnabled = this.libraryConfig?.isDynamicAtrEnabled ?? false
|
|
219
|
+
config._ddDynamicAtrBuckets = this.libraryConfig?.dynamicAtrBuckets
|
|
207
220
|
config._ddIsDiEnabled = this.libraryConfig?.isDiEnabled ?? false
|
|
208
221
|
config._ddIsKnownTestsEnabled = this.libraryConfig?.isKnownTestsEnabled ?? false
|
|
209
222
|
config._ddIsImpactedTestsEnabled = this.libraryConfig?.isImpactedTestsEnabled ?? false
|
|
@@ -12,6 +12,9 @@ const {
|
|
|
12
12
|
getEfdRetryCountForDuration,
|
|
13
13
|
hasEfdRetries,
|
|
14
14
|
} = require('../../dd-trace/src/ci-visibility/efd-retry-policy')
|
|
15
|
+
const {
|
|
16
|
+
getDynamicAtrRetryCount,
|
|
17
|
+
} = require('../../dd-trace/src/ci-visibility/dynamic-atr-retries')
|
|
15
18
|
const {
|
|
16
19
|
SCREENSHOT_UPLOAD_RESULT_ERROR,
|
|
17
20
|
SCREENSHOT_UPLOAD_RESULT_UPLOADED,
|
|
@@ -65,6 +68,7 @@ const {
|
|
|
65
68
|
TEST_BROWSER_NAME,
|
|
66
69
|
TEST_BROWSER_VERSION,
|
|
67
70
|
TEST_IS_RUM_ACTIVE,
|
|
71
|
+
setExpectedEmptyTestSessionTags,
|
|
68
72
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
69
73
|
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
70
74
|
const {
|
|
@@ -184,7 +188,6 @@ function setWebdriverioRumTestCorrelation (context, activeSpan) {
|
|
|
184
188
|
* Converts a screenshot capture failure into its upload result.
|
|
185
189
|
*
|
|
186
190
|
* @param {unknown} error
|
|
187
|
-
* @returns {string}
|
|
188
191
|
*/
|
|
189
192
|
function handleWebdriverioScreenshotError (error) {
|
|
190
193
|
log.error('Error capturing WebdriverIO failure screenshot: %s', error?.message || String(error))
|
|
@@ -882,6 +885,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
882
885
|
isTestManagementEnabled,
|
|
883
886
|
isParallel,
|
|
884
887
|
isFrameworkError,
|
|
888
|
+
isExpectedEmptySession,
|
|
885
889
|
onDone,
|
|
886
890
|
}) => {
|
|
887
891
|
this._exportPendingWorkerTraces()
|
|
@@ -894,6 +898,15 @@ class MochaPlugin extends CiPlugin {
|
|
|
894
898
|
this.testSessionSpan.setTag(TEST_STATUS, status)
|
|
895
899
|
this.testModuleSpan.setTag(TEST_STATUS, status)
|
|
896
900
|
|
|
901
|
+
if (isExpectedEmptySession) {
|
|
902
|
+
setExpectedEmptyTestSessionTags(
|
|
903
|
+
this.testSessionSpan,
|
|
904
|
+
this.testModuleSpan,
|
|
905
|
+
'No tests were executed',
|
|
906
|
+
'zero_tests'
|
|
907
|
+
)
|
|
908
|
+
}
|
|
909
|
+
|
|
897
910
|
if (error) {
|
|
898
911
|
this.testSessionSpan.setTag('error', error)
|
|
899
912
|
this.testModuleSpan.setTag('error', error)
|
|
@@ -1027,7 +1040,17 @@ class MochaPlugin extends CiPlugin {
|
|
|
1027
1040
|
} else if (isEarlyFlakeDetection) {
|
|
1028
1041
|
retryCount = this.libraryConfig.earlyFlakeDetectionRetryPolicy.schedulingRetryCount
|
|
1029
1042
|
} else if (isAtr) {
|
|
1030
|
-
|
|
1043
|
+
// When dynamic ATR is enabled, use the max bucket value as the initial count.
|
|
1044
|
+
// The actual duration-based count is computed after the first attempt.
|
|
1045
|
+
if (this.libraryConfig.isDynamicAtrEnabled) {
|
|
1046
|
+
const maximumDynamicAtrRetries = this.libraryConfig.dynamicAtrBuckets
|
|
1047
|
+
? Math.max(...this.libraryConfig.dynamicAtrBuckets)
|
|
1048
|
+
: this.libraryConfig.earlyFlakeDetectionRetryPolicy.schedulingRetryCount
|
|
1049
|
+
// Dynamic ATR guarantees one retry, including the >5m EFD fallback bucket.
|
|
1050
|
+
retryCount = Math.max(1, maximumDynamicAtrRetries)
|
|
1051
|
+
} else {
|
|
1052
|
+
retryCount = this.libraryConfig.flakyTestRetriesCount
|
|
1053
|
+
}
|
|
1031
1054
|
}
|
|
1032
1055
|
|
|
1033
1056
|
const test = {
|
|
@@ -1041,6 +1064,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
1041
1064
|
isAttemptToFix,
|
|
1042
1065
|
isAtr,
|
|
1043
1066
|
isDisabled,
|
|
1067
|
+
isDynamicAtr: isAtr && this.libraryConfig?.isDynamicAtrEnabled,
|
|
1044
1068
|
isEarlyFlakeDetection,
|
|
1045
1069
|
isModified,
|
|
1046
1070
|
isNew,
|
|
@@ -1090,7 +1114,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1090
1114
|
*
|
|
1091
1115
|
* @param {object} test
|
|
1092
1116
|
* @param {object|undefined} parentStore
|
|
1093
|
-
* @returns {void}
|
|
1094
1117
|
*/
|
|
1095
1118
|
#startWebdriverioJasmineAttempt (test, parentStore) {
|
|
1096
1119
|
test.attemptStart = performance.now()
|
|
@@ -1121,7 +1144,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1121
1144
|
* Delays Jasmine's parent runner until every Datadog-managed spec execution has completed.
|
|
1122
1145
|
*
|
|
1123
1146
|
* @param {object} context
|
|
1124
|
-
* @returns {void}
|
|
1125
1147
|
*/
|
|
1126
1148
|
#configureWebdriverioJasmineLifecycle (context) {
|
|
1127
1149
|
const isLegacyJasmine = Boolean(context.self?.queueableFn)
|
|
@@ -1215,6 +1237,19 @@ class MochaPlugin extends CiPlugin {
|
|
|
1215
1237
|
}
|
|
1216
1238
|
}
|
|
1217
1239
|
|
|
1240
|
+
// Dynamic ATR: after the first attempt, compute the duration-based retry budget.
|
|
1241
|
+
if (
|
|
1242
|
+
testStatus !== 'skip' &&
|
|
1243
|
+
test.isDynamicAtr &&
|
|
1244
|
+
test.attempt === 0
|
|
1245
|
+
) {
|
|
1246
|
+
test.retryCount = getDynamicAtrRetryCount(
|
|
1247
|
+
performance.now() - test.attemptStart,
|
|
1248
|
+
this.libraryConfig.earlyFlakeDetectionRetryPolicy,
|
|
1249
|
+
this.libraryConfig.dynamicAtrBuckets
|
|
1250
|
+
)
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1218
1253
|
const hasManagedRetry = testStatus !== 'skip' && test.attempt < test.retryCount
|
|
1219
1254
|
test.willRetry = hasManagedRetry && (
|
|
1220
1255
|
test.isAttemptToFix ||
|
|
@@ -1250,7 +1285,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1250
1285
|
*
|
|
1251
1286
|
* @param {object} test
|
|
1252
1287
|
* @param {WebdriverioJasmineResult} result
|
|
1253
|
-
* @returns {void}
|
|
1254
1288
|
*/
|
|
1255
1289
|
#finishWebdriverioJasmineRetry (test, result) {
|
|
1256
1290
|
const status = getJasmineStatus(test.reportedStatus || result.status)
|
|
@@ -1290,7 +1324,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1290
1324
|
* Advances a Jasmine test and starts its next attempt span.
|
|
1291
1325
|
*
|
|
1292
1326
|
* @param {object} test
|
|
1293
|
-
* @returns {void}
|
|
1294
1327
|
*/
|
|
1295
1328
|
#startNextWebdriverioJasmineAttempt (test) {
|
|
1296
1329
|
test.attempt++
|
|
@@ -1404,7 +1437,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1404
1437
|
*
|
|
1405
1438
|
* @param {object} test
|
|
1406
1439
|
* @param {WebdriverioJasmineResult} result
|
|
1407
|
-
* @returns {void}
|
|
1408
1440
|
*/
|
|
1409
1441
|
#completeWebdriverioJasmineTest (test, result) {
|
|
1410
1442
|
const state = this._webdriverioJasmineState
|
|
@@ -1460,7 +1492,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1460
1492
|
*
|
|
1461
1493
|
* @param {object} span - Failed test span
|
|
1462
1494
|
* @param {() => void} [onDone] - Called after the screenshot upload finishes
|
|
1463
|
-
* @returns {boolean} Whether a screenshot upload exists for the span
|
|
1464
1495
|
*/
|
|
1465
1496
|
#startWebdriverioScreenshotUpload (span, onDone) {
|
|
1466
1497
|
if (
|
|
@@ -1547,7 +1578,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1547
1578
|
* @param {object} span - Failed test span
|
|
1548
1579
|
* @param {{callbacks: Array<() => void>, finished: boolean}} upload - Upload state
|
|
1549
1580
|
* @param {string} result - Aggregate screenshot upload result
|
|
1550
|
-
* @returns {void}
|
|
1551
1581
|
*/
|
|
1552
1582
|
#finishWebdriverioScreenshotUpload (span, upload, result) {
|
|
1553
1583
|
if (upload.finished) return
|
|
@@ -1577,7 +1607,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1577
1607
|
* @param {object} span - Failed test span
|
|
1578
1608
|
* @param {string|string[]} screenshots - Base64-encoded PNG data
|
|
1579
1609
|
* @param {(result: string) => void} onDone - Aggregate upload completion callback
|
|
1580
|
-
* @returns {void}
|
|
1581
1610
|
*/
|
|
1582
1611
|
#uploadWebdriverioScreenshots (span, screenshots, onDone) {
|
|
1583
1612
|
const screenshotList = Array.isArray(screenshots) ? screenshots : [screenshots]
|
|
@@ -1647,7 +1676,6 @@ class MochaPlugin extends CiPlugin {
|
|
|
1647
1676
|
* resolveCallback?: (onDone: () => void) => void,
|
|
1648
1677
|
* rejectCallback?: (onDone: () => void) => void
|
|
1649
1678
|
* }} context
|
|
1650
|
-
* @returns {void}
|
|
1651
1679
|
*/
|
|
1652
1680
|
#finishWebdriverioJasmineWorker (context) {
|
|
1653
1681
|
const state = this._webdriverioJasmineState
|
|
@@ -2,15 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
4
4
|
const OpenAiLLMObsPlugin = require('../../dd-trace/src/llmobs/plugins/openai')
|
|
5
|
+
const OpenAiRealtimeLLMObsPlugins = require('../../dd-trace/src/llmobs/plugins/openai/realtime')
|
|
6
|
+
const OpenAiRealtimeTracingPlugins = require('./realtime')
|
|
5
7
|
const OpenAiTracingPlugin = require('./tracing')
|
|
6
8
|
|
|
7
9
|
class OpenAiPlugin extends CompositePlugin {
|
|
8
10
|
static id = 'openai'
|
|
9
11
|
static get plugins () {
|
|
10
|
-
|
|
12
|
+
const plugins = {
|
|
11
13
|
llmobs: OpenAiLLMObsPlugin,
|
|
12
14
|
tracing: OpenAiTracingPlugin,
|
|
13
15
|
}
|
|
16
|
+
|
|
17
|
+
// LLM Obs plugins must be registered before their tracing counterparts so that annotations are
|
|
18
|
+
// added to the span before it finishes: subscribers run in registration order, and the realtime
|
|
19
|
+
// tracing plugins finish their span in `end`.
|
|
20
|
+
for (const Plugin of OpenAiRealtimeLLMObsPlugins) {
|
|
21
|
+
plugins[Plugin.id] = Plugin
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const Plugin of OpenAiRealtimeTracingPlugins) {
|
|
25
|
+
plugins[Plugin.id] = Plugin
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return plugins
|
|
14
29
|
}
|
|
15
30
|
}
|
|
16
31
|
|