dd-trace 6.16.0 → 6.18.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/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 +0 -6
- 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/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 +0 -1
- package/ci/test-optimization-validation/source-text.js +0 -3
- package/ci/vitest-no-worker-init-setup.mjs +41 -16
- package/index.d.ts +208 -0
- package/package.json +17 -16
- package/packages/datadog-esbuild/src/utils.js +0 -2
- package/packages/datadog-instrumentations/src/aerospike.js +28 -6
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +0 -2
- package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/console.js +97 -0
- package/packages/datadog-instrumentations/src/cucumber.js +77 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +27 -38
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +2 -1
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -6
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +0 -3
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +24 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +111 -26
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -17
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +55 -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 +13 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +28 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +20 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
- package/packages/datadog-instrumentations/src/jest.js +165 -51
- package/packages/datadog-instrumentations/src/knex.js +0 -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/mocha/common.js +0 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +25 -26
- 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/mysql2.js +0 -2
- 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 +51 -12
- package/packages/datadog-instrumentations/src/oracledb.js +9 -3
- package/packages/datadog-instrumentations/src/playwright-reporter.js +6 -20
- package/packages/datadog-instrumentations/src/playwright.js +280 -56
- package/packages/datadog-instrumentations/src/{azure-cosmos.js → postgres.js} +1 -1
- 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/undici.js +7 -3
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +121 -30
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +49 -13
- package/packages/datadog-instrumentations/src/webdriverio.js +44 -47
- package/packages/datadog-instrumentations/src/ws.js +41 -2
- 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 +0 -1
- 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-durable-functions/src/index.js +0 -1
- package/packages/datadog-plugin-cucumber/src/index.js +9 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +211 -85
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/index.js +3 -1
- 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-graphql/src/resolve-error.js +1 -2
- package/packages/datadog-plugin-graphql/src/utils.js +0 -5
- package/packages/datadog-plugin-jest/src/index.js +12 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +38 -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 +81 -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 +9 -0
- package/packages/datadog-plugin-ws/src/producer.js +1 -1
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-shimmer/src/shimmer.js +14 -10
- package/packages/datadog-turbopack/index.js +4 -7
- package/packages/datadog-turbopack/src/loader.js +6 -18
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/agent/info.js +5 -4
- 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 +2 -2
- package/packages/dd-trace/src/aiguard/integrations/index.js +1 -1
- package/packages/dd-trace/src/aiguard/integrations/openai.js +81 -7
- 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 +0 -1
- 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-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/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 +88 -82
- package/packages/dd-trace/src/config/helper.js +0 -1
- package/packages/dd-trace/src/config/index.js +31 -30
- 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 +150 -10
- 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 +62 -10
- package/packages/dd-trace/src/debugger/devtools_client/config.js +4 -1
- 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 +21 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +41 -15
- 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/redaction.js +5 -3
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +21 -7
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +51 -3
- 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/constants.js +2 -0
- package/packages/dd-trace/src/evp_proxy/direct.js +17 -13
- package/packages/dd-trace/src/evp_proxy/discovery.js +14 -11
- package/packages/dd-trace/src/evp_proxy/path.js +21 -9
- 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/final-flush-request-tracker.js +0 -6
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/common/url.js +33 -4
- 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 +647 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +158 -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 +39 -11
- 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/configuration_source.js +4 -1
- 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/flagging_provider.js +3 -3
- package/packages/dd-trace/src/openfeature/index.js +6 -6
- 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 +90 -23
- package/packages/dd-trace/src/openfeature/writers/exposures.js +4 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +104 -37
- 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/meter_provider.js +0 -1
- 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 +1 -14
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +30 -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/opentracing/tracer.js +3 -3
- 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 +27 -8
- package/packages/dd-trace/src/plugins/ci_plugin.js +1 -2
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +7 -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 +26 -20
- 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 +23 -47
- 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/send-data.js +2 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/tracer.js +5 -4
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/packages/datadog-instrumentations/src/bullmq.js +0 -11
- package/packages/datadog-instrumentations/src/langchain.js +0 -7
- package/packages/datadog-instrumentations/src/langgraph.js +0 -7
- package/packages/datadog-instrumentations/src/mercurius.js +0 -11
|
@@ -5,17 +5,18 @@ const { stringify } = require('querystring')
|
|
|
5
5
|
|
|
6
6
|
const { version } = require('../../../../../package.json')
|
|
7
7
|
const request = require('../../exporters/common/request')
|
|
8
|
-
const { DEBUGGER_DIAGNOSTICS_V1, DEBUGGER_INPUT_V2 } = require('../constants')
|
|
8
|
+
const { DEBUGGER_DIAGNOSTICS_V1, DEBUGGER_INPUT_V2, MAX_MESSAGE_LENGTH } = require('../constants')
|
|
9
|
+
const { DROPPED_REASON, INCOMPLETE_REASON } = require('../guardrail-metrics')
|
|
9
10
|
const log = require('./log')
|
|
10
11
|
const JSONBuffer = require('./json-buffer')
|
|
11
12
|
const config = require('./config')
|
|
13
|
+
const guardrailMetrics = require('./guardrail-metrics')
|
|
12
14
|
const getRequestOptions = require('./request-options')
|
|
13
15
|
const { pruneSnapshot } = require('./snapshot-pruner')
|
|
14
16
|
const buildTags = require('./tags')
|
|
15
17
|
|
|
16
18
|
module.exports = send
|
|
17
19
|
|
|
18
|
-
const MAX_MESSAGE_LENGTH = 8 * 1024 // 8KB
|
|
19
20
|
const MAX_LOG_PAYLOAD_SIZE_MB = 1
|
|
20
21
|
const MAX_LOG_PAYLOAD_SIZE_BYTES = MAX_LOG_PAYLOAD_SIZE_MB * 1024 * 1024
|
|
21
22
|
|
|
@@ -30,18 +31,33 @@ setInputPath(config.inputPath)
|
|
|
30
31
|
|
|
31
32
|
const jsonBuffer = new JSONBuffer({
|
|
32
33
|
size: config.maxTotalPayloadSize,
|
|
33
|
-
|
|
34
|
+
maxQueueBytes: config.queueMaxBytes,
|
|
35
|
+
timeout: config.dynamicInstrumentation.DD_DYNAMIC_INSTRUMENTATION_UPLOAD_INTERVAL_SECONDS * 1000,
|
|
34
36
|
onFlush,
|
|
35
37
|
})
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Queue a probe result for upload.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} message - The evaluated log message
|
|
43
|
+
* @param {object} logger - The logger metadata
|
|
44
|
+
* @param {object | undefined} dd - The trace and span ids of the active trace, if any
|
|
45
|
+
* @param {object} snapshot - The snapshot payload
|
|
46
|
+
* @param {string | undefined} processTags - The serialized process tags, if enabled
|
|
47
|
+
* @param {number} eventType - The guardrail event type, one of `EVENT_TYPE`
|
|
48
|
+
* @param {number} incompleteReasons - Bitmask of `INCOMPLETE_REASON` flags enforced while capturing the snapshot
|
|
49
|
+
*/
|
|
50
|
+
function send (message, logger, dd, snapshot, processTags, eventType, incompleteReasons) {
|
|
51
|
+
if (message?.length > MAX_MESSAGE_LENGTH) {
|
|
52
|
+
message = message.slice(0, MAX_MESSAGE_LENGTH) + '…'
|
|
53
|
+
incompleteReasons |= INCOMPLETE_REASON.STRING_LENGTH
|
|
54
|
+
}
|
|
55
|
+
|
|
38
56
|
const payload = {
|
|
39
57
|
ddsource,
|
|
40
58
|
hostname,
|
|
41
59
|
service,
|
|
42
|
-
message
|
|
43
|
-
? message.slice(0, MAX_MESSAGE_LENGTH) + '…'
|
|
44
|
-
: message,
|
|
60
|
+
message,
|
|
45
61
|
logger,
|
|
46
62
|
dd,
|
|
47
63
|
process_tags: processTags,
|
|
@@ -52,6 +68,7 @@ function send (message, logger, dd, snapshot, processTags) {
|
|
|
52
68
|
let size = Buffer.byteLength(json)
|
|
53
69
|
|
|
54
70
|
if (size > MAX_LOG_PAYLOAD_SIZE_BYTES) {
|
|
71
|
+
incompleteReasons |= INCOMPLETE_REASON.PAYLOAD_TOO_LARGE
|
|
55
72
|
let pruned
|
|
56
73
|
try {
|
|
57
74
|
pruned = pruneSnapshot(json, size, MAX_LOG_PAYLOAD_SIZE_BYTES)
|
|
@@ -61,7 +78,7 @@ function send (message, logger, dd, snapshot, processTags) {
|
|
|
61
78
|
|
|
62
79
|
if (pruned) {
|
|
63
80
|
json = pruned
|
|
64
|
-
} else {
|
|
81
|
+
} else if (snapshot.captures !== undefined) {
|
|
65
82
|
// Fallback if pruning fails
|
|
66
83
|
const line = Object.keys(snapshot.captures.lines)[0]
|
|
67
84
|
snapshot.captures.lines[line] = { pruned: true }
|
|
@@ -70,28 +87,36 @@ function send (message, logger, dd, snapshot, processTags) {
|
|
|
70
87
|
size = Buffer.byteLength(json)
|
|
71
88
|
}
|
|
72
89
|
|
|
73
|
-
jsonBuffer.write(json, size)
|
|
90
|
+
if (jsonBuffer.write(json, size)) {
|
|
91
|
+
if (incompleteReasons !== 0) guardrailMetrics.captureIncomplete(incompleteReasons, eventType)
|
|
92
|
+
} else {
|
|
93
|
+
// The upload queue is full, typically because the intake is slow or unreachable. Dropping is the only option that
|
|
94
|
+
// keeps memory bounded without blocking.
|
|
95
|
+
log.debug('[debugger:devtools_client] Dropping probe result for probe %s: upload queue is full', snapshot.probe.id)
|
|
96
|
+
guardrailMetrics.eventDropped(DROPPED_REASON.QUEUE_FULL, eventType)
|
|
97
|
+
}
|
|
74
98
|
}
|
|
75
99
|
|
|
76
100
|
/**
|
|
77
101
|
* @param {string} payload - The payload to send
|
|
102
|
+
* @param {() => void} done - Releases the payload from the upload queue
|
|
78
103
|
*/
|
|
79
|
-
function onFlush (payload) {
|
|
104
|
+
function onFlush (payload, done) {
|
|
80
105
|
log.debug('[debugger:devtools_client] Flushing probe payload buffer')
|
|
81
106
|
|
|
82
107
|
request(payload, buildRequestOptions(), (err, res, statusCode) => {
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
|
|
108
|
+
if (handleV2FallbackIfNeeded(statusCode, payload, done)) return
|
|
109
|
+
done()
|
|
110
|
+
if (err) log.error('[debugger:devtools_client] Error sending probe payload', err)
|
|
86
111
|
})
|
|
87
112
|
}
|
|
88
113
|
|
|
89
114
|
/**
|
|
90
115
|
* @param {number} statusCode - The status code of the response
|
|
91
116
|
* @param {string} payload - The payload to send
|
|
92
|
-
* @
|
|
117
|
+
* @param {() => void} done - Releases the payload from the upload queue
|
|
93
118
|
*/
|
|
94
|
-
function handleV2FallbackIfNeeded (statusCode, payload) {
|
|
119
|
+
function handleV2FallbackIfNeeded (statusCode, payload, done) {
|
|
95
120
|
if (statusCode !== 404 || config.inputPath !== DEBUGGER_INPUT_V2) {
|
|
96
121
|
return false
|
|
97
122
|
}
|
|
@@ -103,6 +128,7 @@ function handleV2FallbackIfNeeded (statusCode, payload) {
|
|
|
103
128
|
setInputPath(DEBUGGER_DIAGNOSTICS_V1)
|
|
104
129
|
|
|
105
130
|
request(payload, buildRequestOptions(), (err) => {
|
|
131
|
+
done()
|
|
106
132
|
if (err) {
|
|
107
133
|
log.error('[debugger:devtools_client] Error sending probe payload after fallback to %s',
|
|
108
134
|
DEBUGGER_DIAGNOSTICS_V1,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { INCOMPLETE_REASON } = require('../../guardrail-metrics')
|
|
3
4
|
const session = require('../session')
|
|
4
5
|
const { collectObjectProperties } = require('./collector')
|
|
5
6
|
const { processRawState, processRemoteObject } = require('./processor')
|
|
7
|
+
const { fieldCountSym } = require('./symbols')
|
|
6
8
|
|
|
7
9
|
const BIGINT_MAX = (1n << 256n) - 1n
|
|
8
10
|
|
|
@@ -26,8 +28,13 @@ module.exports = {
|
|
|
26
28
|
* @param {CaptureLimits} limits - The capture limits
|
|
27
29
|
* @param {bigint} [deadlineNs] - The deadline in nanoseconds compared to `process.hrtime.bigint()`. Defaults to
|
|
28
30
|
* {@link BIGINT_MAX}. If the deadline is reached, the snapshot will be truncated.
|
|
29
|
-
* @returns {Promise<{
|
|
30
|
-
*
|
|
31
|
+
* @returns {Promise<{
|
|
32
|
+
* processLocalState: () => ReturnType<typeof processRawState>,
|
|
33
|
+
* fatalErrors: Error[],
|
|
34
|
+
* incomplete: import('./processor').IncompleteCapture
|
|
35
|
+
* }>} The local state for the call frame. `incomplete` is only fully populated once `processLocalState` has run.
|
|
36
|
+
* Not every fatal error is recorded as a runtime error: the collector also raises one when it hits its large object
|
|
37
|
+
* safety threshold, which is reported as the field count limit it is.
|
|
31
38
|
*/
|
|
32
39
|
async function getLocalStateForCallFrame (callFrame, limits, deadlineNs = BIGINT_MAX) {
|
|
33
40
|
const { maxReferenceDepth, maxCollectionSize, maxFieldCount, maxLength } = limits
|
|
@@ -35,39 +42,63 @@ async function getLocalStateForCallFrame (callFrame, limits, deadlineNs = BIGINT
|
|
|
35
42
|
const ctx = { deadlineReached: false, fatalErrors: [] }
|
|
36
43
|
const opts = { maxReferenceDepth, maxCollectionSize, maxFieldCount, deadlineNs, ctx }
|
|
37
44
|
const rawState = []
|
|
45
|
+
/** @type {import('./processor').IncompleteCapture} */
|
|
46
|
+
const incomplete = { reasons: 0 }
|
|
38
47
|
/** @type {ReturnType<typeof processRawState> | null} */
|
|
39
48
|
let processedState = null
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
const { scopeChain } = callFrame
|
|
51
|
+
for (const scope of scopeChain) {
|
|
52
|
+
if (!isCollectable(scope)) continue
|
|
53
|
+
const objectId = /** @type {string} */ (scope.object.objectId)
|
|
45
54
|
try {
|
|
46
55
|
// The objectId for a scope points to a pseudo-object whose properties are the actual variables in the scope.
|
|
47
56
|
// This is why we can just call `collectObjectProperties` directly and expect it to return the in-scope variables
|
|
48
57
|
// as an array.
|
|
49
58
|
// eslint-disable-next-line no-await-in-loop
|
|
50
|
-
|
|
59
|
+
const variables = await collectObjectProperties(objectId, opts)
|
|
60
|
+
// A scope with more variables than the field count limit is trimmed like any other object, but since the scope
|
|
61
|
+
// itself is not part of the snapshot, the marker would be lost once its variables are spread into the state
|
|
62
|
+
if (variables[fieldCountSym] !== undefined) incomplete.reasons |= INCOMPLETE_REASON.FIELD_COUNT
|
|
63
|
+
rawState.push(...variables)
|
|
51
64
|
} catch (err) {
|
|
65
|
+
incomplete.reasons |= INCOMPLETE_REASON.RUNTIME_ERROR
|
|
52
66
|
ctx.fatalErrors.push(new Error(
|
|
53
67
|
`Error getting local state for closure scope (type: ${scope.type}). ` +
|
|
54
68
|
'Future snapshots for existing probes in this location will be skipped until the probes are re-applied',
|
|
55
69
|
{ cause: err } // TODO: The cause is not used by the backend
|
|
56
70
|
))
|
|
57
71
|
}
|
|
58
|
-
if (ctx.deadlineReached === true)
|
|
72
|
+
if (ctx.deadlineReached === true) {
|
|
73
|
+
// Nodes skipped within this scope carry the timeout marker and are recorded when processed (unless they end up
|
|
74
|
+
// redacted), but the remaining scopes are dropped without any marker.
|
|
75
|
+
// TODO: Bad UX; Variables in remaining scopes are silently dropped
|
|
76
|
+
// @ts-expect-error - findLast is available in Node.js 18+ but TypeScript doesn't know about it without ES2023 lib
|
|
77
|
+
if (scope !== scopeChain.findLast(isCollectable)) incomplete.reasons |= INCOMPLETE_REASON.TIMEOUT
|
|
78
|
+
break
|
|
79
|
+
}
|
|
59
80
|
}
|
|
60
81
|
|
|
61
82
|
// Delay calling `processRawState` so caller can resume the main thread before processing `rawState`
|
|
62
83
|
return {
|
|
63
84
|
processLocalState () {
|
|
64
|
-
processedState ??= processRawState(rawState, maxLength)
|
|
85
|
+
processedState ??= processRawState(rawState, maxLength, incomplete)
|
|
65
86
|
return processedState
|
|
66
87
|
},
|
|
67
88
|
fatalErrors: ctx.fatalErrors,
|
|
89
|
+
incomplete,
|
|
68
90
|
}
|
|
69
91
|
}
|
|
70
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Returns whether the scope variables are collected into the snapshot.
|
|
95
|
+
* @param {import('inspector').Debugger.Scope} scope
|
|
96
|
+
*/
|
|
97
|
+
function isCollectable (scope) {
|
|
98
|
+
// The global scope is too noisy, and a scope without an object id is possible according to the types
|
|
99
|
+
return scope.type !== 'global' && scope.object.objectId !== undefined
|
|
100
|
+
}
|
|
101
|
+
|
|
71
102
|
/**
|
|
72
103
|
* @typedef {object} CompiledCaptureExpression
|
|
73
104
|
* @property {string} name - The name of the expression (used as key in snapshot)
|
|
@@ -82,6 +113,9 @@ async function getLocalStateForCallFrame (callFrame, limits, deadlineNs = BIGINT
|
|
|
82
113
|
* @property {{ expr: string, message: string }[]} evaluationErrors - Transient errors from expression evaluation
|
|
83
114
|
* (safe to retry)
|
|
84
115
|
* @property {Error[]} fatalErrors - Fatal errors that should disable capture expressions for this probe permanently
|
|
116
|
+
* @property {import('./processor').IncompleteCapture} incomplete - The capture limits enforced on the expressions,
|
|
117
|
+
* including a runtime error for every expression that threw or could not be evaluated. Only fully populated once
|
|
118
|
+
* `processCaptureExpressions` has run.
|
|
85
119
|
*/
|
|
86
120
|
|
|
87
121
|
/**
|
|
@@ -108,6 +142,8 @@ async function evaluateCaptureExpressions (callFrame, expressions, deadlineNs =
|
|
|
108
142
|
const evaluationErrors = []
|
|
109
143
|
/** @type {Error[]} */
|
|
110
144
|
const fatalErrors = []
|
|
145
|
+
/** @type {import('./processor').IncompleteCapture} */
|
|
146
|
+
const incomplete = { reasons: 0 }
|
|
111
147
|
/** @type {Record<string, ReturnType<typeof processRemoteObject>> | null} */
|
|
112
148
|
let processedResult = null
|
|
113
149
|
|
|
@@ -126,6 +162,7 @@ async function evaluateCaptureExpressions (callFrame, expressions, deadlineNs =
|
|
|
126
162
|
|
|
127
163
|
// Handle evaluation exceptions (maybe transient - bad expression, undefined var, etc.)
|
|
128
164
|
if (exceptionDetails) {
|
|
165
|
+
incomplete.reasons |= INCOMPLETE_REASON.RUNTIME_ERROR
|
|
129
166
|
evaluationErrors.push({ expr: name, message: extractErrorMessage(exceptionDetails) })
|
|
130
167
|
continue
|
|
131
168
|
}
|
|
@@ -156,9 +193,11 @@ async function evaluateCaptureExpressions (callFrame, expressions, deadlineNs =
|
|
|
156
193
|
}
|
|
157
194
|
|
|
158
195
|
if (ctx.deadlineReached) {
|
|
159
|
-
// Add the current expression (properties may be incomplete due to timeout)
|
|
196
|
+
// Add the current expression (properties may be incomplete due to timeout). Those carry the timeout marker
|
|
197
|
+
// and are recorded when processed, unless they end up redacted.
|
|
160
198
|
rawResults.push({ name, remoteObject: result, maxLength })
|
|
161
|
-
// Add stub entries for remaining uncaptured expressions
|
|
199
|
+
// Add stub entries for remaining uncaptured expressions. The stubs are used as-is, so record them here.
|
|
200
|
+
if (i + 1 < expressions.length) incomplete.reasons |= INCOMPLETE_REASON.TIMEOUT
|
|
162
201
|
for (let j = i + 1; j < expressions.length; j++) {
|
|
163
202
|
rawResults.push({
|
|
164
203
|
name: expressions[j].name,
|
|
@@ -172,6 +211,7 @@ async function evaluateCaptureExpressions (callFrame, expressions, deadlineNs =
|
|
|
172
211
|
|
|
173
212
|
rawResults.push({ name, remoteObject: result, maxLength })
|
|
174
213
|
} catch (err) {
|
|
214
|
+
incomplete.reasons |= INCOMPLETE_REASON.RUNTIME_ERROR
|
|
175
215
|
fatalErrors.push(new Error(
|
|
176
216
|
`Error capturing expression "${name}". ` +
|
|
177
217
|
'Capture expressions for this probe will be skipped until the probe is re-applied',
|
|
@@ -189,7 +229,7 @@ async function evaluateCaptureExpressions (callFrame, expressions, deadlineNs =
|
|
|
189
229
|
for (const { name, remoteObject, maxLength } of rawResults) {
|
|
190
230
|
// If the remote object has notCapturedReason (e.g., timeout), use it as-is without processing
|
|
191
231
|
processedResult[name] = remoteObject.notCapturedReason === undefined
|
|
192
|
-
? processRemoteObject(remoteObject, maxLength)
|
|
232
|
+
? processRemoteObject(remoteObject, maxLength, incomplete)
|
|
193
233
|
: remoteObject
|
|
194
234
|
}
|
|
195
235
|
|
|
@@ -197,6 +237,7 @@ async function evaluateCaptureExpressions (callFrame, expressions, deadlineNs =
|
|
|
197
237
|
},
|
|
198
238
|
evaluationErrors,
|
|
199
239
|
fatalErrors,
|
|
240
|
+
incomplete,
|
|
200
241
|
}
|
|
201
242
|
}
|
|
202
243
|
|
|
@@ -204,7 +245,6 @@ async function evaluateCaptureExpressions (callFrame, expressions, deadlineNs =
|
|
|
204
245
|
* Extract the error message from the exception details.
|
|
205
246
|
*
|
|
206
247
|
* @param {import('inspector').Runtime.ExceptionDetails} exceptionDetails - The exception details
|
|
207
|
-
* @returns {string} The error message
|
|
208
248
|
*/
|
|
209
249
|
function extractErrorMessage (exceptionDetails) {
|
|
210
250
|
const description = exceptionDetails.exception?.description
|