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
|
@@ -10,6 +10,11 @@ const DEFAULT_LONG_LIVED_THRESHOLD = 30_000
|
|
|
10
10
|
* This class embodies the SSI profiler-triggering heuristics under SSI.
|
|
11
11
|
*/
|
|
12
12
|
class SSIHeuristics {
|
|
13
|
+
#active = false
|
|
14
|
+
#longLivedTimer
|
|
15
|
+
#onAppClosing = this.disable.bind(this)
|
|
16
|
+
#onSpanCreated = this.#handleSpanCreated.bind(this)
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* @param {import('../config/config-base')} config - Tracer configuration
|
|
15
20
|
*/
|
|
@@ -32,20 +37,36 @@ class SSIHeuristics {
|
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
start () {
|
|
40
|
+
if (this.#active) return
|
|
41
|
+
this.#active = true
|
|
42
|
+
|
|
35
43
|
// Used to determine short-livedness of the process. We could use the process start time as the
|
|
36
44
|
// reference point, but the tracer initialization point is more relevant, as we couldn't be
|
|
37
45
|
// collecting profiles earlier anyway. The difference is not particularly significant if the
|
|
38
46
|
// tracer is initialized early in the process lifetime.
|
|
39
|
-
setTimeout(() => {
|
|
47
|
+
this.#longLivedTimer = setTimeout(() => {
|
|
48
|
+
this.#longLivedTimer = undefined
|
|
40
49
|
this.shortLived = false
|
|
41
50
|
this._maybeTriggered()
|
|
42
|
-
}, this.longLivedThreshold)
|
|
51
|
+
}, this.longLivedThreshold)
|
|
52
|
+
this.#longLivedTimer.unref?.()
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
dc.subscribe('
|
|
54
|
+
dc.subscribe('dd-trace:span:start', this.#onSpanCreated)
|
|
55
|
+
dc.subscribe('datadog:telemetry:app-closing', this.#onAppClosing)
|
|
56
|
+
}
|
|
46
57
|
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Cancels the pending heuristic and releases all resources owned by this instance.
|
|
60
|
+
*/
|
|
61
|
+
disable () {
|
|
62
|
+
this.triggeredCallback = undefined
|
|
63
|
+
if (!this.#active) return
|
|
64
|
+
|
|
65
|
+
this.#active = false
|
|
66
|
+
clearTimeout(this.#longLivedTimer)
|
|
67
|
+
this.#longLivedTimer = undefined
|
|
68
|
+
dc.unsubscribe('dd-trace:span:start', this.#onSpanCreated)
|
|
69
|
+
dc.unsubscribe('datadog:telemetry:app-closing', this.#onAppClosing)
|
|
49
70
|
}
|
|
50
71
|
|
|
51
72
|
onTriggered (callback) {
|
|
@@ -70,17 +91,10 @@ class SSIHeuristics {
|
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
93
|
|
|
73
|
-
|
|
94
|
+
#handleSpanCreated () {
|
|
74
95
|
this.noSpan = false
|
|
75
96
|
this._maybeTriggered()
|
|
76
|
-
dc.unsubscribe('dd-trace:span:start', this
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
_onAppClosing () {
|
|
80
|
-
dc.unsubscribe('datadog:telemetry:app-closing', this._onAppClosing)
|
|
81
|
-
if (this.noSpan) {
|
|
82
|
-
dc.unsubscribe('dd-trace:span:start', this._onSpanCreated)
|
|
83
|
-
}
|
|
97
|
+
dc.unsubscribe('dd-trace:span:start', this.#onSpanCreated)
|
|
84
98
|
}
|
|
85
99
|
}
|
|
86
100
|
|
|
@@ -49,6 +49,10 @@ const OPENFEATURE_STATE_NOOP = 0
|
|
|
49
49
|
const OPENFEATURE_STATE_LAZY = 1
|
|
50
50
|
const OPENFEATURE_STATE_ACTIVE = 2
|
|
51
51
|
|
|
52
|
+
const configUpdateChannel = channel('datadog:config:update')
|
|
53
|
+
|
|
54
|
+
const profiler = require('./profiler')
|
|
55
|
+
|
|
52
56
|
let dynamicInstrumentation
|
|
53
57
|
|
|
54
58
|
function getDynamicInstrumentation () {
|
|
@@ -114,6 +118,9 @@ function defineLazily (obj, property, getClass, ...args) {
|
|
|
114
118
|
class Tracer extends NoopProxy {
|
|
115
119
|
#openfeatureState = OPENFEATURE_STATE_NOOP
|
|
116
120
|
|
|
121
|
+
/** @type {boolean} */
|
|
122
|
+
#configPublished = false
|
|
123
|
+
|
|
117
124
|
constructor () {
|
|
118
125
|
super()
|
|
119
126
|
|
|
@@ -239,7 +246,7 @@ class Tracer extends NoopProxy {
|
|
|
239
246
|
appsecRemoteConfig.enable(rc, config, this._modules.appsec)
|
|
240
247
|
}
|
|
241
248
|
|
|
242
|
-
if (config.dynamicInstrumentation.
|
|
249
|
+
if (config.dynamicInstrumentation.DD_DYNAMIC_INSTRUMENTATION_ENABLED) {
|
|
243
250
|
getDynamicInstrumentation().start(config, rc)
|
|
244
251
|
}
|
|
245
252
|
|
|
@@ -249,20 +256,8 @@ class Tracer extends NoopProxy {
|
|
|
249
256
|
openfeatureRemoteConfig.enable(rc, () => this.openfeature, subscribeOpenfeatureToRemoteConfig)
|
|
250
257
|
}
|
|
251
258
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
} else {
|
|
255
|
-
this._profilerStarted = false
|
|
256
|
-
if (config.profiling.DD_PROFILING_ENABLED === 'auto') {
|
|
257
|
-
const { SSIHeuristics } = require('./profiling/ssi-heuristics')
|
|
258
|
-
const ssiHeuristics = new SSIHeuristics(config)
|
|
259
|
-
ssiHeuristics.start()
|
|
260
|
-
ssiHeuristics.onTriggered(() => {
|
|
261
|
-
this._startProfiler(config)
|
|
262
|
-
ssiHeuristics.onTriggered() // deregister this callback
|
|
263
|
-
})
|
|
264
|
-
}
|
|
265
|
-
}
|
|
259
|
+
configUpdateChannel.publish(config)
|
|
260
|
+
this.#configPublished = true
|
|
266
261
|
|
|
267
262
|
// Experimental: mirror the active trace ID, span ID and endpoint into
|
|
268
263
|
// an OTEP-4947 thread-local context record an out-of-process eBPF
|
|
@@ -297,7 +292,7 @@ class Tracer extends NoopProxy {
|
|
|
297
292
|
|
|
298
293
|
this.#updateTracing(config)
|
|
299
294
|
|
|
300
|
-
if (config.iast.
|
|
295
|
+
if (config.iast.DD_IAST_ENABLED) {
|
|
301
296
|
this._modules.rewriter.enable(config)
|
|
302
297
|
}
|
|
303
298
|
|
|
@@ -373,22 +368,6 @@ class Tracer extends NoopProxy {
|
|
|
373
368
|
ch.subscribe(onHttpRequest)
|
|
374
369
|
}
|
|
375
370
|
|
|
376
|
-
/**
|
|
377
|
-
* @param {import('./config/config-base')} config - Tracer configuration
|
|
378
|
-
*/
|
|
379
|
-
_startProfiler (config) {
|
|
380
|
-
// do not stop tracer initialization if the profiler fails to be imported
|
|
381
|
-
try {
|
|
382
|
-
return require('./profiler').start(config)
|
|
383
|
-
} catch (error) {
|
|
384
|
-
log.error(
|
|
385
|
-
'Error starting profiler. For troubleshooting tips, see <https://dtdg.co/nodejs-profiler-troubleshooting>',
|
|
386
|
-
error
|
|
387
|
-
)
|
|
388
|
-
return false
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
371
|
/**
|
|
393
372
|
* `tracer.openfeature` is only reachable through this proxy. SSI itself (auto-injecting
|
|
394
373
|
* the tracer, resolving the vendored provider regardless of the customer's own
|
|
@@ -428,7 +407,7 @@ class Tracer extends NoopProxy {
|
|
|
428
407
|
*/
|
|
429
408
|
#updateTracing (config) {
|
|
430
409
|
if (config.DD_TRACE_ENABLED !== false) {
|
|
431
|
-
if (config.appsec.
|
|
410
|
+
if (config.appsec.DD_APPSEC_ENABLED) {
|
|
432
411
|
this._modules.appsec.enable(config)
|
|
433
412
|
}
|
|
434
413
|
if (config.llmobs.DD_LLMOBS_ENABLED) {
|
|
@@ -441,17 +420,18 @@ class Tracer extends NoopProxy {
|
|
|
441
420
|
this._tracer = new DatadogTracer(config, prioritySampler)
|
|
442
421
|
this.dataStreamsCheckpointer = this._tracer.dataStreamsCheckpointer
|
|
443
422
|
lazyProxy(this, 'appsec', () => require('./appsec/sdk'), this._tracer, config)
|
|
444
|
-
lazyProxy(this, 'llmobs', () => require('./llmobs/sdk'), this._tracer, this._modules.llmobs, config
|
|
423
|
+
lazyProxy(this, 'llmobs', () => require('./llmobs/sdk'), this._tracer, this._modules.llmobs, config,
|
|
424
|
+
() => this.openfeature)
|
|
445
425
|
|
|
446
|
-
if (config.
|
|
426
|
+
if (config.aiguard.DD_AI_GUARD_ENABLED) {
|
|
447
427
|
lazyProxy(this, 'aiguard', () => require('./aiguard/sdk'), this._tracer, config)
|
|
448
428
|
}
|
|
449
429
|
this._tracingInitialized = true
|
|
450
430
|
}
|
|
451
|
-
if (config.
|
|
431
|
+
if (config.aiguard.DD_AI_GUARD_ENABLED) {
|
|
452
432
|
this._modules.aiguard.enable(this._tracer, config)
|
|
453
433
|
}
|
|
454
|
-
if (config.iast.
|
|
434
|
+
if (config.iast.DD_IAST_ENABLED) {
|
|
455
435
|
this._modules.iast.enable(config, this._tracer)
|
|
456
436
|
}
|
|
457
437
|
// This needs to be after the IAST module is enabled
|
|
@@ -483,7 +463,7 @@ class Tracer extends NoopProxy {
|
|
|
483
463
|
* @param {object} rc - The RemoteConfig instance
|
|
484
464
|
*/
|
|
485
465
|
#updateDebugger (config, rc) {
|
|
486
|
-
const shouldBeEnabled = config.dynamicInstrumentation.
|
|
466
|
+
const shouldBeEnabled = config.dynamicInstrumentation.DD_DYNAMIC_INSTRUMENTATION_ENABLED
|
|
487
467
|
if (!shouldBeEnabled && dynamicInstrumentation === undefined) return
|
|
488
468
|
|
|
489
469
|
const DynamicInstrumentation = getDynamicInstrumentation()
|
|
@@ -507,15 +487,13 @@ class Tracer extends NoopProxy {
|
|
|
507
487
|
* @override
|
|
508
488
|
*/
|
|
509
489
|
get profiling () {
|
|
510
|
-
//
|
|
511
|
-
// is not enabled, runWithLabels still works as a passthrough (just calls fn()).
|
|
512
|
-
const profilerModule = require('./profiler')
|
|
490
|
+
// If profiling is not enabled, runWithLabels still works as a passthrough (just calls fn()).
|
|
513
491
|
const profiling = {
|
|
514
492
|
setCustomLabelKeys (keys) {
|
|
515
|
-
|
|
493
|
+
profiler.setCustomLabelKeys(keys)
|
|
516
494
|
},
|
|
517
495
|
runWithLabels (labels, fn) {
|
|
518
|
-
return
|
|
496
|
+
return profiler.runWithLabels(labels, fn)
|
|
519
497
|
},
|
|
520
498
|
}
|
|
521
499
|
Reflect.defineProperty(this, 'profiling', { value: profiling, configurable: true, enumerable: true })
|
|
@@ -526,11 +504,11 @@ class Tracer extends NoopProxy {
|
|
|
526
504
|
* @override
|
|
527
505
|
*/
|
|
528
506
|
profilerStarted () {
|
|
529
|
-
if (this
|
|
507
|
+
if (!this.#configPublished) {
|
|
530
508
|
// injection hardening: this is only ever invoked from tests.
|
|
531
509
|
throw new Error('profilerStarted() must be called after init()')
|
|
532
510
|
}
|
|
533
|
-
return Promise.resolve(
|
|
511
|
+
return Promise.resolve(profiler.isStarted())
|
|
534
512
|
}
|
|
535
513
|
|
|
536
514
|
/**
|
|
@@ -552,7 +530,6 @@ class Tracer extends NoopProxy {
|
|
|
552
530
|
/**
|
|
553
531
|
* Checks the private filesystem-only Test Optimization validation mode.
|
|
554
532
|
*
|
|
555
|
-
* @returns {boolean} whether network-capable tracer side channels must stay disabled
|
|
556
533
|
*/
|
|
557
534
|
function isOfflineTestOptimizationValidation () {
|
|
558
535
|
return isTrue(getEnvironmentVariable(VALIDATION_MODE_ENV)) &&
|
|
@@ -564,7 +541,6 @@ function isOfflineTestOptimizationValidation () {
|
|
|
564
541
|
* Checks whether initialization selected a filesystem-only Test Optimization exporter.
|
|
565
542
|
*
|
|
566
543
|
* @param {import('../../../index').TracerOptions} [options] tracer initialization options
|
|
567
|
-
* @returns {boolean} whether the selected exporter is safe for offline validation
|
|
568
544
|
*/
|
|
569
545
|
function isOfflineValidationExporter (options) {
|
|
570
546
|
return OFFLINE_VALIDATION_EXPORTERS.has(options?.experimental?.exporter)
|
|
@@ -17,9 +17,6 @@ class RandomSampler {
|
|
|
17
17
|
this._rate = rate
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* @returns {number}
|
|
22
|
-
*/
|
|
23
20
|
rate () {
|
|
24
21
|
return this._rate
|
|
25
22
|
}
|
|
@@ -30,7 +27,6 @@ class RandomSampler {
|
|
|
30
27
|
* Returns `true` if the sampling decision passes (i.e., the operation should be sampled).
|
|
31
28
|
* This happens if the sampling rate is `1` (i.e., always sample) or if a random value falls below the rate.
|
|
32
29
|
*
|
|
33
|
-
* @returns {boolean} `true` if the operation should be sampled, otherwise `false`.
|
|
34
30
|
*/
|
|
35
31
|
isSampled () {
|
|
36
32
|
return this._rate === 1 || Math.random() < this._rate
|
|
@@ -21,7 +21,6 @@ class RateLimiter {
|
|
|
21
21
|
* Attempts to consume a token and reports whether it was allowed.
|
|
22
22
|
* Updates internal counters used for effective rate computation.
|
|
23
23
|
*
|
|
24
|
-
* @returns {boolean}
|
|
25
24
|
*/
|
|
26
25
|
isAllowed () {
|
|
27
26
|
const curIntervalStart = this._limiter.curIntervalStart
|
|
@@ -43,7 +42,6 @@ class RateLimiter {
|
|
|
43
42
|
* Returns the fraction of allowed requests over requested ones in the
|
|
44
43
|
* current and previous intervals combined.
|
|
45
44
|
*
|
|
46
|
-
* @returns {number}
|
|
47
45
|
*/
|
|
48
46
|
effectiveRate () {
|
|
49
47
|
if (this._rateLimit < 0) return 1
|
|
@@ -58,7 +56,6 @@ class RateLimiter {
|
|
|
58
56
|
|
|
59
57
|
/**
|
|
60
58
|
* Internal token consumption without counter side-effects.
|
|
61
|
-
* @returns {boolean}
|
|
62
59
|
*/
|
|
63
60
|
_isAllowed () {
|
|
64
61
|
if (this._rateLimit < 0) return true
|
|
@@ -69,7 +66,6 @@ class RateLimiter {
|
|
|
69
66
|
|
|
70
67
|
/**
|
|
71
68
|
* Effective rate within the current interval only.
|
|
72
|
-
* @returns {number}
|
|
73
69
|
*/
|
|
74
70
|
_currentWindowRate () {
|
|
75
71
|
if (this._rateLimit < 0) return 1
|
|
@@ -12,33 +12,25 @@ module.exports = {
|
|
|
12
12
|
ASM_CUSTOM_BLOCKING_RESPONSE: 1n << 9n,
|
|
13
13
|
ASM_TRUSTED_IPS: 1n << 10n,
|
|
14
14
|
ASM_API_SECURITY_SAMPLE_RATE: 1n << 11n, // deprecated
|
|
15
|
-
APM_TRACING_SAMPLE_RATE: 1n << 12n,
|
|
16
|
-
APM_TRACING_LOGS_INJECTION: 1n << 13n,
|
|
17
|
-
APM_TRACING_HTTP_HEADER_TAGS: 1n << 14n,
|
|
18
|
-
APM_TRACING_CUSTOM_TAGS: 1n << 15n,
|
|
19
15
|
ASM_PROCESSOR_OVERRIDES: 1n << 16n,
|
|
20
16
|
ASM_CUSTOM_DATA_SCANNERS: 1n << 17n,
|
|
21
17
|
ASM_EXCLUSION_DATA: 1n << 18n,
|
|
22
|
-
APM_TRACING_ENABLED: 1n << 19n,
|
|
23
18
|
ASM_RASP_SQLI: 1n << 21n,
|
|
24
19
|
ASM_RASP_LFI: 1n << 22n,
|
|
25
20
|
ASM_RASP_SSRF: 1n << 23n,
|
|
26
21
|
ASM_RASP_SHI: 1n << 24n,
|
|
27
|
-
APM_TRACING_SAMPLE_RULES: 1n << 29n,
|
|
28
22
|
ASM_AUTO_USER_INSTRUM_MODE: 1n << 31n,
|
|
29
23
|
ASM_ENDPOINT_FINGERPRINT: 1n << 32n,
|
|
30
24
|
ASM_SESSION_FINGERPRINT: 1n << 33n,
|
|
31
25
|
ASM_NETWORK_FINGERPRINT: 1n << 34n,
|
|
32
26
|
ASM_HEADER_FINGERPRINT: 1n << 35n,
|
|
33
27
|
ASM_RASP_CMDI: 1n << 37n,
|
|
34
|
-
APM_TRACING_ENABLE_DYNAMIC_INSTRUMENTATION: 1n << 38n,
|
|
35
|
-
APM_TRACING_ENABLE_CODE_ORIGIN: 1n << 40n,
|
|
36
|
-
APM_TRACING_ENABLE_LIVE_DEBUGGING: 1n << 41n,
|
|
37
28
|
ASM_DD_MULTICONFIG: 1n << 42n,
|
|
38
29
|
ASM_TRACE_TAGGING_RULES: 1n << 43n,
|
|
39
30
|
ASM_EXTENDED_DATA_COLLECTION: 1n << 44n,
|
|
40
31
|
APM_TRACING_MULTICONFIG: 1n << 45n,
|
|
41
32
|
FFE_FLAG_CONFIGURATION_RULES: 1n << 46n,
|
|
33
|
+
SDK_CONFIGURATION: 1n << 49n,
|
|
42
34
|
/*
|
|
43
35
|
DO NOT ADD ARBITRARY CAPABILITIES IN YOUR CODE
|
|
44
36
|
UNLESS THEY ARE ALREADY DEFINED IN THE BACKEND SOURCE OF TRUTH
|
|
@@ -28,9 +28,6 @@ class Sampler {
|
|
|
28
28
|
this.#threshold = BigInt(Math.floor(rate * MAX_TRACE_ID))
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* @returns {number}
|
|
33
|
-
*/
|
|
34
31
|
rate () {
|
|
35
32
|
return this._rate
|
|
36
33
|
}
|
|
@@ -43,7 +40,6 @@ class Sampler {
|
|
|
43
40
|
* Determines whether a trace/span should be sampled based on the configured sampling rate.
|
|
44
41
|
*
|
|
45
42
|
* @param {import("../../..").Span|import("../../..").SpanContext} span - The span or span context to evaluate.
|
|
46
|
-
* @returns {boolean} `true` if the trace/span should be sampled, otherwise `false`.
|
|
47
43
|
*/
|
|
48
44
|
isSampled (span) {
|
|
49
45
|
if (this._rate === 1) {
|
|
@@ -27,7 +27,6 @@ const Sampler = require('./sampler')
|
|
|
27
27
|
class AlwaysMatcher {
|
|
28
28
|
/**
|
|
29
29
|
* @param {DatadogSpan} span
|
|
30
|
-
* @returns {boolean}
|
|
31
30
|
*/
|
|
32
31
|
match (span) {
|
|
33
32
|
return true
|
|
@@ -42,7 +41,6 @@ class AlwaysMatcher {
|
|
|
42
41
|
class NeverMatcher {
|
|
43
42
|
/**
|
|
44
43
|
* @param {DatadogSpan} span
|
|
45
|
-
* @returns {boolean}
|
|
46
44
|
*/
|
|
47
45
|
match (span) {
|
|
48
46
|
return false
|
|
@@ -64,7 +62,6 @@ class GlobMatcher {
|
|
|
64
62
|
|
|
65
63
|
/**
|
|
66
64
|
* @param {DatadogSpan} span
|
|
67
|
-
* @returns {boolean}
|
|
68
65
|
*/
|
|
69
66
|
match (span) {
|
|
70
67
|
const subject = this.locator(span)
|
|
@@ -91,7 +88,6 @@ class RegExpMatcher {
|
|
|
91
88
|
|
|
92
89
|
/**
|
|
93
90
|
* @param {DatadogSpan} span
|
|
94
|
-
* @returns {boolean}
|
|
95
91
|
*/
|
|
96
92
|
match (span) {
|
|
97
93
|
const subject = this.locator(span)
|
|
@@ -235,7 +231,6 @@ class SamplingRule {
|
|
|
235
231
|
|
|
236
232
|
/**
|
|
237
233
|
* Deterministic sampling rate in [0, 1].
|
|
238
|
-
* @returns {number}
|
|
239
234
|
*/
|
|
240
235
|
get sampleRate () {
|
|
241
236
|
return this._sampler.rate()
|
|
@@ -261,7 +256,6 @@ class SamplingRule {
|
|
|
261
256
|
* Checks whether the provided span matches all configured criteria.
|
|
262
257
|
*
|
|
263
258
|
* @param {DatadogSpan} span
|
|
264
|
-
* @returns {boolean}
|
|
265
259
|
*/
|
|
266
260
|
match (span) {
|
|
267
261
|
for (const matcher of this.matchers) {
|
|
@@ -280,7 +274,6 @@ class SamplingRule {
|
|
|
280
274
|
* Determines whether a span should be sampled based on the configured sampling rule.
|
|
281
275
|
*
|
|
282
276
|
* @param {DatadogSpan|DatadogSpanContext} span - The span or span context to evaluate.
|
|
283
|
-
* @returns {boolean} `true` if the span should be sampled, otherwise `false`.
|
|
284
277
|
*/
|
|
285
278
|
sample (span) {
|
|
286
279
|
if (!this._sampler.isSampled(span)) {
|
|
@@ -69,7 +69,6 @@ function getServerlessPlatform () {
|
|
|
69
69
|
* Whether the current platform can retain an invocation for telemetry delivery.
|
|
70
70
|
*
|
|
71
71
|
* Add future serverless platforms here as they gain an equivalent retention hook.
|
|
72
|
-
* @returns {boolean}
|
|
73
72
|
*/
|
|
74
73
|
function supportsServerlessTelemetryRetention () {
|
|
75
74
|
return isVercelAtStartup
|
|
@@ -37,7 +37,6 @@ function optionServiceSource ({ pluginConfig }) {
|
|
|
37
37
|
* @param {{ service?: string | ((params?: object) => unknown) }} [pluginConfig]
|
|
38
38
|
* @param {object} [params]
|
|
39
39
|
* @param {string} defaultService
|
|
40
|
-
* @returns {string}
|
|
41
40
|
*/
|
|
42
41
|
function configServiceName (pluginConfig, params, defaultService) {
|
|
43
42
|
const service = pluginConfig?.service
|
|
@@ -156,6 +156,13 @@ const storage = {
|
|
|
156
156
|
return optionServiceSource({ tracerService, pluginConfig, connectionName, integration: 'pg' })
|
|
157
157
|
},
|
|
158
158
|
},
|
|
159
|
+
postgres: {
|
|
160
|
+
opName: () => 'postgres.query',
|
|
161
|
+
serviceName: withSuffixFunction('postgres'),
|
|
162
|
+
serviceSource: ({ tracerService, pluginConfig, connectionName }) => {
|
|
163
|
+
return optionServiceSource({ tracerService, pluginConfig, connectionName, integration: 'postgres' })
|
|
164
|
+
},
|
|
165
|
+
},
|
|
159
166
|
prisma: {
|
|
160
167
|
opName: ({ operation }) => `prisma.${operation}`,
|
|
161
168
|
serviceName: withSuffixFunction('prisma'),
|
|
@@ -86,6 +86,11 @@ const storage = {
|
|
|
86
86
|
serviceName: withFunction,
|
|
87
87
|
serviceSource: optionServiceSource,
|
|
88
88
|
},
|
|
89
|
+
postgres: {
|
|
90
|
+
opName: () => 'postgresql.query',
|
|
91
|
+
serviceName: configWithFallback,
|
|
92
|
+
serviceSource: optionServiceSource,
|
|
93
|
+
},
|
|
89
94
|
prisma: {
|
|
90
95
|
opName: ({ operation }) => `prisma.${operation}`,
|
|
91
96
|
serviceName: configWithFallback,
|
|
@@ -19,7 +19,8 @@ class SpanProcessor {
|
|
|
19
19
|
this._config = config
|
|
20
20
|
this._killAll = false
|
|
21
21
|
|
|
22
|
-
if (config.stats?.DD_TRACE_STATS_COMPUTATION_ENABLED &&
|
|
22
|
+
if (config.stats?.DD_TRACE_STATS_COMPUTATION_ENABLED &&
|
|
23
|
+
!config.appsec?.DD_EXPERIMENTAL_APPSEC_STANDALONE_ENABLED) {
|
|
23
24
|
const { SpanStatsProcessor } = require('./span_stats')
|
|
24
25
|
this._stats = new SpanStatsProcessor(config, otlpStatsExporter)
|
|
25
26
|
}
|
|
@@ -45,7 +46,6 @@ class SpanProcessor {
|
|
|
45
46
|
* `PrioritySampler.keepTrace()`), so `discard` only applies while the priority is still a reject.
|
|
46
47
|
*
|
|
47
48
|
* @param {import('./opentracing/span_context')} spanContext
|
|
48
|
-
* @returns {boolean}
|
|
49
49
|
*/
|
|
50
50
|
#isDiscarded (spanContext) {
|
|
51
51
|
return spanContext._sampling.discard && spanContext._sampling.priority <= AUTO_REJECT
|
|
@@ -6,11 +6,11 @@ const RateLimiter = require('../rate_limiter')
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns a rate limiter tuned for the provided product configuration.
|
|
8
8
|
*
|
|
9
|
-
* @param {{ appsec?: {
|
|
9
|
+
* @param {{ appsec?: { DD_APPSEC_ENABLED?: boolean }, iast?: { DD_IAST_ENABLED?: boolean } } | undefined} config
|
|
10
10
|
* @returns {import('../rate_limiter')}
|
|
11
11
|
*/
|
|
12
12
|
function getProductRateLimiter (config) {
|
|
13
|
-
if (config?.appsec?.
|
|
13
|
+
if (config?.appsec?.DD_APPSEC_ENABLED || config?.iast?.DD_IAST_ENABLED) {
|
|
14
14
|
return new RateLimiter(1, 'minute') // onePerMinute
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -24,7 +24,6 @@ function addTraceSourceTag (tags, product) {
|
|
|
24
24
|
* Returns true when the trace source propagation tag exists on the given tags object.
|
|
25
25
|
*
|
|
26
26
|
* @param {Record<string, unknown>} tags
|
|
27
|
-
* @returns {boolean}
|
|
28
27
|
*/
|
|
29
28
|
function hasTraceSourcePropagationTag (tags) {
|
|
30
29
|
return Object.hasOwn(tags, TRACE_SOURCE_PROPAGATION_KEY)
|
|
@@ -105,7 +105,7 @@ function configInfo () {
|
|
|
105
105
|
log_injection_enabled: !!config.logInjection,
|
|
106
106
|
runtime_metrics_enabled: !!config.runtimeMetrics,
|
|
107
107
|
profiling_enabled: profilingEnabled === 'true' || profilingEnabled === 'auto',
|
|
108
|
-
appsec_enabled: config.appsec.
|
|
108
|
+
appsec_enabled: config.appsec.DD_APPSEC_ENABLED,
|
|
109
109
|
data_streams_enabled: !!config.dsmEnabled,
|
|
110
110
|
otlp_traces_export_enabled: config.OTEL_TRACES_EXPORTER === 'otlp' && !config.isCiVisibility,
|
|
111
111
|
otlp_metrics_export_enabled: !!config.DD_METRICS_OTEL_ENABLED,
|
|
@@ -52,15 +52,11 @@ let isFirstPayload = true
|
|
|
52
52
|
/**
|
|
53
53
|
* @param {string} method
|
|
54
54
|
* @param {string} path
|
|
55
|
-
* @returns {string}
|
|
56
55
|
*/
|
|
57
56
|
function endpointKey (method, path) {
|
|
58
57
|
return `${method.toUpperCase()} ${path}`
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
/**
|
|
62
|
-
* @returns {void}
|
|
63
|
-
*/
|
|
64
60
|
function scheduleFlush () {
|
|
65
61
|
if (flushScheduled) return
|
|
66
62
|
flushScheduled = true
|
|
@@ -73,7 +69,6 @@ function scheduleFlush () {
|
|
|
73
69
|
* @param {string} method
|
|
74
70
|
* @param {string} path
|
|
75
71
|
* @param {string} operationName
|
|
76
|
-
* @returns {void}
|
|
77
72
|
*/
|
|
78
73
|
function recordEndpoint (method, path, operationName) {
|
|
79
74
|
const key = endpointKey(method, path)
|
|
@@ -134,9 +129,6 @@ function buildEndpointObjects (endpoints) {
|
|
|
134
129
|
})
|
|
135
130
|
}
|
|
136
131
|
|
|
137
|
-
/**
|
|
138
|
-
* @returns {void}
|
|
139
|
-
*/
|
|
140
132
|
function flushAndSend () {
|
|
141
133
|
flushScheduled = false
|
|
142
134
|
if (pendingEndpoints.size === 0) return
|
|
@@ -5,7 +5,7 @@ const { sendData } = require('../send-data')
|
|
|
5
5
|
const logCollector = require('./log-collector')
|
|
6
6
|
|
|
7
7
|
const telemetryLog = dc.channel('datadog:telemetry:log')
|
|
8
|
-
const errorLog = dc.channel('datadog:log:error')
|
|
8
|
+
const errorLog = dc.channel('datadog:log:error:record')
|
|
9
9
|
|
|
10
10
|
let enabled = false
|
|
11
11
|
|
|
@@ -15,7 +15,6 @@ let enabled = false
|
|
|
15
15
|
* - DEBUG level will be possible to activate with an env var or telemetry config property
|
|
16
16
|
*
|
|
17
17
|
* @param {string | undefined} level
|
|
18
|
-
* @returns {boolean}
|
|
19
18
|
*/
|
|
20
19
|
function isLevelEnabled (level) {
|
|
21
20
|
return isValidLevel(level)
|
|
@@ -46,17 +45,29 @@ function onErrorLog (msg) {
|
|
|
46
45
|
count: 1,
|
|
47
46
|
|
|
48
47
|
// existing log.error(err) without message will be reported as 'Generic Error'
|
|
49
|
-
message: message
|
|
48
|
+
message: message || 'Generic Error',
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
if (cause) {
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
try {
|
|
53
|
+
telLog.stack_trace = cause.stack
|
|
54
|
+
} catch {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
telLog.errorType = getErrorType(cause)
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
onLog(telLog)
|
|
58
61
|
}
|
|
59
62
|
|
|
63
|
+
function getErrorType (cause) {
|
|
64
|
+
try {
|
|
65
|
+
return cause.constructor?.name || 'Error'
|
|
66
|
+
} catch {
|
|
67
|
+
return 'Error'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
60
71
|
function start (config) {
|
|
61
72
|
if (!config.telemetry.DD_TELEMETRY_LOG_COLLECTION_ENABLED || enabled) return
|
|
62
73
|
|