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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
4
|
+
const { extractPathFromUrl } = require('../../dd-trace/src/plugins/util/url')
|
|
5
|
+
const { stripQueryAndFragment } = require('../../dd-trace/src/util')
|
|
6
|
+
const normalizeError = require('./error')
|
|
7
|
+
const getHostname = require('./url')
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {{
|
|
11
|
+
* self: { url: string },
|
|
12
|
+
* currentStore?: { span: import('../../..').Span },
|
|
13
|
+
* result?: { error?: (Error & { status?: number }) | null },
|
|
14
|
+
* error?: Error & { status?: number }
|
|
15
|
+
* }} AuthContext
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class SupabaseGoTrueClientGetUserPlugin extends ClientPlugin {
|
|
19
|
+
static id = 'supabase'
|
|
20
|
+
static prefix = 'tracing:orchestrion:@supabase/auth-js:GoTrueClient_getUser'
|
|
21
|
+
|
|
22
|
+
/** @param {AuthContext} ctx */
|
|
23
|
+
bindStart (ctx) {
|
|
24
|
+
const method = 'GET'
|
|
25
|
+
const url = stripQueryAndFragment(`${ctx.self?.url}/user`)
|
|
26
|
+
|
|
27
|
+
this.startSpan('supabase.http.getuser', {
|
|
28
|
+
service: { name: this.tracer._service },
|
|
29
|
+
type: 'http',
|
|
30
|
+
resource: `${method} ${extractPathFromUrl(url)}`,
|
|
31
|
+
meta: {
|
|
32
|
+
component: 'supabase',
|
|
33
|
+
'span.kind': 'client',
|
|
34
|
+
'http.method': method,
|
|
35
|
+
'http.url': url,
|
|
36
|
+
'out.host': getHostname(url),
|
|
37
|
+
},
|
|
38
|
+
}, ctx)
|
|
39
|
+
|
|
40
|
+
return ctx.currentStore
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @param {AuthContext} ctx */
|
|
44
|
+
asyncEnd (ctx) {
|
|
45
|
+
this.finish(ctx)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// You may modify this method, but the guard below is REQUIRED and MUST NOT be removed!
|
|
49
|
+
/** @param {AuthContext} ctx */
|
|
50
|
+
finish (ctx) {
|
|
51
|
+
// CRITICAL GUARD - DO NOT REMOVE: Ensures span only finishes when operation completes
|
|
52
|
+
if (!ctx.hasOwnProperty('result') && !ctx.hasOwnProperty('error')) return
|
|
53
|
+
|
|
54
|
+
const error = normalizeError(ctx.result?.error, 'AuthError')
|
|
55
|
+
if (error) {
|
|
56
|
+
ctx.error = error
|
|
57
|
+
super.error(ctx)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const status = ctx.result?.error?.status ??
|
|
61
|
+
ctx.error?.status ??
|
|
62
|
+
(ctx.result && !ctx.result.error ? 200 : undefined)
|
|
63
|
+
if (status) ctx.currentStore?.span.setTag('http.status_code', status)
|
|
64
|
+
|
|
65
|
+
super.finish(ctx)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = SupabaseGoTrueClientGetUserPlugin
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
4
|
+
const { extractPathFromUrl } = require('../../dd-trace/src/plugins/util/url')
|
|
5
|
+
const { stripQueryAndFragment } = require('../../dd-trace/src/util')
|
|
6
|
+
const normalizeError = require('./error')
|
|
7
|
+
const getHostname = require('./url')
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {{
|
|
11
|
+
* arguments: { [index: number]: unknown, length: number, 0?: string, 1?: { method?: string } },
|
|
12
|
+
* self: { url: string },
|
|
13
|
+
* currentStore?: { span: import('../../..').Span },
|
|
14
|
+
* result?: { error?: Error | { message?: string } | null, response?: { status?: number } },
|
|
15
|
+
* error?: unknown
|
|
16
|
+
* }} FunctionsContext
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
class SupabaseFunctionsClientInvokePlugin extends ClientPlugin {
|
|
20
|
+
static id = 'supabase'
|
|
21
|
+
static prefix = 'tracing:orchestrion:@supabase/functions-js:FunctionsClient_invoke'
|
|
22
|
+
|
|
23
|
+
/** @param {FunctionsContext} ctx */
|
|
24
|
+
bindStart (ctx) {
|
|
25
|
+
const functionName = ctx.arguments?.[0]
|
|
26
|
+
const method = String(ctx.arguments?.[1]?.method || 'POST').toUpperCase()
|
|
27
|
+
const url = stripQueryAndFragment(`${ctx.self?.url}/${functionName}`)
|
|
28
|
+
|
|
29
|
+
this.startSpan('supabase.http.invoke', {
|
|
30
|
+
service: { name: this.tracer._service },
|
|
31
|
+
type: 'http',
|
|
32
|
+
resource: `${method} ${extractPathFromUrl(url)}`,
|
|
33
|
+
meta: {
|
|
34
|
+
component: 'supabase',
|
|
35
|
+
'span.kind': 'client',
|
|
36
|
+
'http.method': method,
|
|
37
|
+
'http.url': url,
|
|
38
|
+
'out.host': getHostname(url),
|
|
39
|
+
'faas.invoked_name': functionName,
|
|
40
|
+
},
|
|
41
|
+
}, ctx)
|
|
42
|
+
|
|
43
|
+
return ctx.currentStore
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @param {FunctionsContext} ctx */
|
|
47
|
+
asyncEnd (ctx) {
|
|
48
|
+
this.finish(ctx)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// You may modify this method, but the guard below is REQUIRED and MUST NOT be removed!
|
|
52
|
+
/** @param {FunctionsContext} ctx */
|
|
53
|
+
finish (ctx) {
|
|
54
|
+
// CRITICAL GUARD - DO NOT REMOVE: Ensures span only finishes when operation completes
|
|
55
|
+
if (!ctx.hasOwnProperty('result') && !ctx.hasOwnProperty('error')) return
|
|
56
|
+
|
|
57
|
+
const error = normalizeError(ctx.result?.error, 'FunctionsError')
|
|
58
|
+
if (error) {
|
|
59
|
+
ctx.error = error
|
|
60
|
+
super.error(ctx)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const status = ctx.result?.response?.status
|
|
64
|
+
if (status) ctx.currentStore?.span.setTag('http.status_code', status)
|
|
65
|
+
|
|
66
|
+
super.finish(ctx)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = SupabaseFunctionsClientInvokePlugin
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { storage } = require('../../datadog-core')
|
|
4
|
+
const log = require('../../dd-trace/src/log')
|
|
5
|
+
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
6
|
+
const { extractPathFromUrl } = require('../../dd-trace/src/plugins/util/url')
|
|
7
|
+
const { stripQueryAndFragment } = require('../../dd-trace/src/util')
|
|
8
|
+
const normalizeError = require('./error')
|
|
9
|
+
|
|
10
|
+
const spanFinished = Symbol('spanFinished')
|
|
11
|
+
|
|
12
|
+
const operationByMethod = {
|
|
13
|
+
DELETE: 'DELETE',
|
|
14
|
+
GET: 'SELECT',
|
|
15
|
+
HEAD: 'SELECT',
|
|
16
|
+
PATCH: 'UPDATE',
|
|
17
|
+
POST: 'INSERT',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {{
|
|
22
|
+
* arguments: { [index: number]: unknown, length: number, 0?: Function, 1?: Function },
|
|
23
|
+
* self: { method: string, url: URL, schema?: string },
|
|
24
|
+
* currentStore?: { span: import('../../..').Span },
|
|
25
|
+
* parentStore: import('../../datadog-core/src/storage').Store<unknown>,
|
|
26
|
+
* result?: { error?: Error | { message?: string } | null },
|
|
27
|
+
* error?: unknown
|
|
28
|
+
* } & Record<symbol, boolean | undefined>} PostgrestContext
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
function finishSafely (plugin, ctx, hasError = false) {
|
|
32
|
+
try {
|
|
33
|
+
if (hasError) plugin.error(ctx)
|
|
34
|
+
plugin.finish(ctx)
|
|
35
|
+
} catch (error) {
|
|
36
|
+
log.error('Error in plugin handler:', error)
|
|
37
|
+
log.info('Disabling plugin: %s', plugin.constructor.name)
|
|
38
|
+
plugin.configure(false)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class SupabasePostgrestBuilderThenPlugin extends DatabasePlugin {
|
|
43
|
+
static id = 'supabase'
|
|
44
|
+
static prefix = 'tracing:orchestrion:@supabase/postgrest-js:PostgrestBuilder_then'
|
|
45
|
+
|
|
46
|
+
/** @param {PostgrestContext} ctx */
|
|
47
|
+
bindStart (ctx) {
|
|
48
|
+
const method = ctx.self?.method
|
|
49
|
+
const requestUrl = ctx.self?.url
|
|
50
|
+
const url = stripQueryAndFragment(String(requestUrl))
|
|
51
|
+
const path = extractPathFromUrl(url)
|
|
52
|
+
const operation = path.includes('/rpc/') ? 'CALL' : operationByMethod[method] || method
|
|
53
|
+
const resource = `${operation} ${path.slice(path.lastIndexOf('/') + 1)}`
|
|
54
|
+
|
|
55
|
+
this.startSpan('supabase.database.query', {
|
|
56
|
+
service: { name: this.tracer._service },
|
|
57
|
+
type: 'sql',
|
|
58
|
+
resource,
|
|
59
|
+
meta: {
|
|
60
|
+
component: 'supabase',
|
|
61
|
+
'span.kind': 'client',
|
|
62
|
+
'db.type': 'postgres',
|
|
63
|
+
'db.name': ctx.self?.schema || 'public',
|
|
64
|
+
'db.operation': operation,
|
|
65
|
+
'out.host': requestUrl?.hostname,
|
|
66
|
+
},
|
|
67
|
+
}, ctx)
|
|
68
|
+
|
|
69
|
+
// PostgrestBuilder.then owns both the request and consumer callbacks. Finish the request span and
|
|
70
|
+
// restore its parent before invoking a callback so application failures and latency stay outside it.
|
|
71
|
+
const onFulfilled = ctx.arguments?.[0]
|
|
72
|
+
if (typeof onFulfilled === 'function') {
|
|
73
|
+
const plugin = this
|
|
74
|
+
ctx.arguments[0] = function (result) {
|
|
75
|
+
ctx.result = result
|
|
76
|
+
finishSafely(plugin, ctx)
|
|
77
|
+
return storage('legacy').run(ctx.parentStore, () => onFulfilled.apply(this, arguments))
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const onRejected = ctx.arguments?.[1]
|
|
82
|
+
if (typeof onRejected === 'function') {
|
|
83
|
+
const plugin = this
|
|
84
|
+
ctx.arguments[1] = function (error) {
|
|
85
|
+
ctx.error = error
|
|
86
|
+
finishSafely(plugin, ctx, true)
|
|
87
|
+
return storage('legacy').run(ctx.parentStore, () => onRejected.apply(this, arguments))
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return ctx.currentStore
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** @param {PostgrestContext} ctx */
|
|
95
|
+
asyncEnd (ctx) {
|
|
96
|
+
this.finish(ctx)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @param {PostgrestContext} ctx */
|
|
100
|
+
error (ctx) {
|
|
101
|
+
if (ctx[spanFinished]) return
|
|
102
|
+
super.error(ctx)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// You may modify this method, but the guard below is REQUIRED and MUST NOT be removed!
|
|
106
|
+
/** @param {PostgrestContext} ctx */
|
|
107
|
+
finish (ctx) {
|
|
108
|
+
// CRITICAL GUARD - DO NOT REMOVE: Ensures span only finishes when operation completes
|
|
109
|
+
if (ctx[spanFinished] || !ctx.hasOwnProperty('result') && !ctx.hasOwnProperty('error')) return
|
|
110
|
+
|
|
111
|
+
const error = normalizeError(ctx.result?.error, 'PostgrestError')
|
|
112
|
+
if (error) {
|
|
113
|
+
ctx.error = error
|
|
114
|
+
super.error(ctx)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
ctx[spanFinished] = true
|
|
118
|
+
super.finish(ctx)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = SupabasePostgrestBuilderThenPlugin
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
4
|
+
const normalizeError = require('./error')
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {{
|
|
8
|
+
* self: { subTopic: string },
|
|
9
|
+
* currentStore?: { span: import('../../..').Span },
|
|
10
|
+
* result?: 'ok' | 'error' | 'timed out',
|
|
11
|
+
* error?: unknown
|
|
12
|
+
* }} RealtimeContext
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
class SupabaseRealtimeChannelSendPlugin extends ProducerPlugin {
|
|
16
|
+
static id = 'supabase'
|
|
17
|
+
static prefix = 'tracing:orchestrion:@supabase/realtime-js:RealtimeChannel_send'
|
|
18
|
+
static peerServicePrecursors = ['messaging.destination.name']
|
|
19
|
+
|
|
20
|
+
/** @param {RealtimeContext} ctx */
|
|
21
|
+
bindStart (ctx) {
|
|
22
|
+
const destination = ctx.self?.subTopic
|
|
23
|
+
|
|
24
|
+
this.startSpan({
|
|
25
|
+
service: { name: this.tracer._service },
|
|
26
|
+
type: 'messaging',
|
|
27
|
+
resource: destination,
|
|
28
|
+
meta: {
|
|
29
|
+
component: 'supabase',
|
|
30
|
+
'span.kind': 'producer',
|
|
31
|
+
'messaging.system': 'supabase',
|
|
32
|
+
'messaging.destination.name': destination,
|
|
33
|
+
'messaging.destination.kind': 'topic',
|
|
34
|
+
'messaging.operation': 'send',
|
|
35
|
+
},
|
|
36
|
+
}, ctx)
|
|
37
|
+
|
|
38
|
+
return ctx.currentStore
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
operationName () {
|
|
42
|
+
return 'supabase.messaging.send'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @param {RealtimeContext} ctx */
|
|
46
|
+
asyncEnd (ctx) {
|
|
47
|
+
this.finish(ctx)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// You may modify this method, but the guard below is REQUIRED and MUST NOT be removed!
|
|
51
|
+
/** @param {RealtimeContext} ctx */
|
|
52
|
+
finish (ctx) {
|
|
53
|
+
// CRITICAL GUARD - DO NOT REMOVE: Ensures span only finishes when operation completes
|
|
54
|
+
if (!ctx.hasOwnProperty('result') && !ctx.hasOwnProperty('error')) return
|
|
55
|
+
|
|
56
|
+
const result = ctx.result
|
|
57
|
+
if (result === 'error' || result === 'timed out') {
|
|
58
|
+
ctx.error = normalizeError(result, 'RealtimeSendError', `Realtime send returned ${result}`)
|
|
59
|
+
super.error(ctx)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
super.finish(ctx)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = SupabaseRealtimeChannelSendPlugin
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const StoragePlugin = require('../../dd-trace/src/plugins/storage')
|
|
4
|
+
const { extractPathFromUrl } = require('../../dd-trace/src/plugins/util/url')
|
|
5
|
+
const { stripQueryAndFragment } = require('../../dd-trace/src/util')
|
|
6
|
+
const getHostname = require('./url')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {{
|
|
10
|
+
* arguments: { [index: number]: unknown, length: number, 1: string, 2: string | URL },
|
|
11
|
+
* currentStore?: { span: import('../../..').Span },
|
|
12
|
+
* result?: unknown,
|
|
13
|
+
* error?: Error & { status?: number }
|
|
14
|
+
* }} StorageContext
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const storageRoutes = [
|
|
18
|
+
'object/upload/sign',
|
|
19
|
+
'object/list-v2',
|
|
20
|
+
'object/list',
|
|
21
|
+
'object/sign',
|
|
22
|
+
'object/info',
|
|
23
|
+
'object/copy',
|
|
24
|
+
'object/move',
|
|
25
|
+
'render/image',
|
|
26
|
+
'bucket',
|
|
27
|
+
'object',
|
|
28
|
+
'cdn',
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns a low-cardinality storage route for a request URL.
|
|
33
|
+
*
|
|
34
|
+
* @param {string|URL} url Request URL.
|
|
35
|
+
*/
|
|
36
|
+
function getStorageRoute (url) {
|
|
37
|
+
const path = extractPathFromUrl(stripQueryAndFragment(String(url)))
|
|
38
|
+
const marker = '/storage/v1/'
|
|
39
|
+
const markerIndex = path.indexOf(marker)
|
|
40
|
+
const storagePath = markerIndex === -1 ? path.replace(/^\/+/, '') : path.slice(markerIndex + marker.length)
|
|
41
|
+
|
|
42
|
+
for (const route of storageRoutes) {
|
|
43
|
+
if (storagePath === route || storagePath.startsWith(`${route}/`)) return route
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return 'storage'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class SupabaseStorageHandleRequestPlugin extends StoragePlugin {
|
|
50
|
+
static id = 'supabase'
|
|
51
|
+
static prefix = 'tracing:orchestrion:@supabase/storage-js:handleRequest'
|
|
52
|
+
|
|
53
|
+
/** @param {StorageContext} ctx */
|
|
54
|
+
bindStart (ctx) {
|
|
55
|
+
const method = String(ctx.arguments?.[1] || 'GET').toUpperCase()
|
|
56
|
+
const url = ctx.arguments?.[2]
|
|
57
|
+
|
|
58
|
+
this.startSpan('supabase.storage.request', {
|
|
59
|
+
service: { name: this.tracer._service },
|
|
60
|
+
type: 'storage',
|
|
61
|
+
resource: `${method} ${getStorageRoute(url)}`,
|
|
62
|
+
meta: {
|
|
63
|
+
component: 'supabase',
|
|
64
|
+
'span.kind': 'client',
|
|
65
|
+
'http.method': method,
|
|
66
|
+
'http.url': stripQueryAndFragment(String(url)),
|
|
67
|
+
'out.host': getHostname(url),
|
|
68
|
+
},
|
|
69
|
+
}, ctx)
|
|
70
|
+
|
|
71
|
+
return ctx.currentStore
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** @param {StorageContext} ctx */
|
|
75
|
+
error (ctx) {
|
|
76
|
+
const status = ctx.error?.status
|
|
77
|
+
if (status) ctx.currentStore?.span.setTag('http.status_code', status)
|
|
78
|
+
super.error(ctx)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @param {StorageContext} ctx */
|
|
82
|
+
asyncEnd (ctx) {
|
|
83
|
+
this.finish(ctx)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** @param {StorageContext} ctx */
|
|
87
|
+
finish (ctx) {
|
|
88
|
+
if (!ctx.hasOwnProperty('result') && !ctx.hasOwnProperty('error')) return
|
|
89
|
+
super.finish(ctx)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = SupabaseStorageHandleRequestPlugin
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { URL } = require('node:url')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Extracts a hostname without allowing malformed SDK input to break instrumentation.
|
|
7
|
+
*
|
|
8
|
+
* @param {string|URL} url Request URL.
|
|
9
|
+
* @returns {string|undefined} Parsed hostname.
|
|
10
|
+
*/
|
|
11
|
+
function getHostname (url) {
|
|
12
|
+
try {
|
|
13
|
+
return new URL(url).hostname
|
|
14
|
+
} catch {}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = getHostname
|
|
@@ -44,6 +44,7 @@ const {
|
|
|
44
44
|
TEST_ITR_UNSKIPPABLE,
|
|
45
45
|
TEST_ITR_FORCED_RUN,
|
|
46
46
|
ITR_CORRELATION_ID,
|
|
47
|
+
setExpectedEmptyTestSessionTags,
|
|
47
48
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
48
49
|
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
49
50
|
const id = require('../../dd-trace/src/id')
|
|
@@ -579,6 +580,7 @@ class VitestPlugin extends CiPlugin {
|
|
|
579
580
|
requestErrorTags,
|
|
580
581
|
vitestPool,
|
|
581
582
|
isVitestNoWorkerInitActive,
|
|
583
|
+
isExpectedEmptySession,
|
|
582
584
|
onDone,
|
|
583
585
|
}) => {
|
|
584
586
|
for (const [tag, value] of Object.entries(requestErrorTags)) {
|
|
@@ -587,6 +589,14 @@ class VitestPlugin extends CiPlugin {
|
|
|
587
589
|
}
|
|
588
590
|
this.testSessionSpan.setTag(TEST_STATUS, status)
|
|
589
591
|
this.testModuleSpan.setTag(TEST_STATUS, status)
|
|
592
|
+
if (isExpectedEmptySession) {
|
|
593
|
+
setExpectedEmptyTestSessionTags(
|
|
594
|
+
this.testSessionSpan,
|
|
595
|
+
this.testModuleSpan,
|
|
596
|
+
'No tests were executed',
|
|
597
|
+
'zero_tests'
|
|
598
|
+
)
|
|
599
|
+
}
|
|
590
600
|
if (error) {
|
|
591
601
|
this.testModuleSpan.setTag('error', error)
|
|
592
602
|
this.testSessionSpan.setTag('error', error)
|
|
@@ -36,7 +36,6 @@ function createWebSocketSpanContext (spanContext) {
|
|
|
36
36
|
/**
|
|
37
37
|
* Returns whether distributed trace headers are present.
|
|
38
38
|
* @param {Record<string, string | string[] | undefined>} headers
|
|
39
|
-
* @returns {boolean}
|
|
40
39
|
*/
|
|
41
40
|
function hasTraceHeaders (headers) {
|
|
42
41
|
return !!(headers && (readDatadogTraceId(headers) || readTraceparent(headers)))
|
|
@@ -59,7 +58,6 @@ function initWebSocketMessageCounters (socket) {
|
|
|
59
58
|
* Increments and returns the WebSocket message counter.
|
|
60
59
|
* @param {object} socket - The WebSocket socket object
|
|
61
60
|
* @param {string} counterType - Either 'receiveCounter' or 'sendCounter'
|
|
62
|
-
* @returns {number} The incremented counter value
|
|
63
61
|
*/
|
|
64
62
|
function incrementWebSocketCounter (socket, counterType) {
|
|
65
63
|
if (!socketCounters.has(socket)) {
|
|
@@ -81,7 +79,6 @@ function incrementWebSocketCounter (socket, counterType) {
|
|
|
81
79
|
* @param {number} counter - The message counter
|
|
82
80
|
* @param {boolean} isServer - Whether this is a server (true) or client (false)
|
|
83
81
|
* @param {boolean} isIncoming - Whether this is an incoming message (true) or outgoing (false)
|
|
84
|
-
* @returns {string} The span pointer hash
|
|
85
82
|
*/
|
|
86
83
|
function buildWebSocketSpanPointerHash (handshakeTraceId, handshakeSpanId, counter, isServer, isIncoming) {
|
|
87
84
|
// Determine prefix based on server/client and incoming/outgoing
|
|
@@ -110,7 +107,6 @@ function buildWebSocketSpanPointerHash (handshakeTraceId, handshakeSpanId, count
|
|
|
110
107
|
*
|
|
111
108
|
* @param {DatadogSpanContext} spanContext - The handshake span context
|
|
112
109
|
* @param {{ hasTraceHeaders?: boolean } | undefined} socket - The WebSocket socket object
|
|
113
|
-
* @returns {boolean} True if the span has distributed tracing context
|
|
114
110
|
*/
|
|
115
111
|
function hasDistributedTracingContext (spanContext, socket) {
|
|
116
112
|
if (!spanContext) return false
|