dd-trace 6.12.0 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-3rdparty.csv +3 -1
- package/ci/init.js +8 -3
- package/ci/test-optimization-validation/ci-package-scripts.js +2 -2
- package/ci/test-optimization-validation/ci-remediation.js +6 -6
- package/ci/test-optimization-validation/command-blocker.js +7 -5
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +1 -1
- package/ci/test-optimization-validation/framework-adapters/cypress.js +9 -11
- package/ci/test-optimization-validation/framework-adapters/vitest.js +3 -3
- package/ci/test-optimization-validation/package-check.js +1 -1
- package/ci/test-optimization-validation/report-writer.js +7 -5
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +5 -4
- package/ci/vitest-no-worker-init-runner-setup.mjs +8 -0
- package/ci/vitest-no-worker-init-setup.mjs +13 -13
- package/ci/vitest-no-worker-init-v5-setup.mjs +4 -0
- package/index.d.ts +127 -26
- package/package.json +22 -19
- package/packages/datadog-esbuild/index.js +3 -1
- package/packages/datadog-instrumentations/src/bunyan.js +4 -2
- package/packages/datadog-instrumentations/src/cypress-config.js +19 -17
- package/packages/datadog-instrumentations/src/fs.js +24 -20
- package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +2 -2
- package/packages/datadog-instrumentations/src/graphql.js +16 -16
- package/packages/datadog-instrumentations/src/helpers/bunyan.js +12 -3
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +504 -0
- package/packages/datadog-instrumentations/src/helpers/hooks.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +266 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +1 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +95 -30
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +0 -25
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql-jit.js +83 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +85 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/mercurius.js +30 -12
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +13 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +279 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +12 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +562 -27
- package/packages/datadog-instrumentations/src/jest.js +165 -38
- package/packages/datadog-instrumentations/src/knex.js +76 -0
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +1597 -0
- package/packages/datadog-instrumentations/src/mariadb.js +13 -0
- package/packages/datadog-instrumentations/src/mocha/common.js +59 -2
- package/packages/datadog-instrumentations/src/mocha/main.js +25 -15
- package/packages/datadog-instrumentations/src/mocha/utils.js +2 -1
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +98 -0
- package/packages/datadog-instrumentations/src/mocha/worker.js +12 -8
- package/packages/datadog-instrumentations/src/net.js +14 -17
- package/packages/datadog-instrumentations/src/next.js +212 -62
- package/packages/datadog-instrumentations/src/openai.js +42 -40
- package/packages/datadog-instrumentations/src/pg.js +15 -0
- package/packages/datadog-instrumentations/src/pino.js +15 -4
- package/packages/datadog-instrumentations/src/playwright.js +137 -27
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +40 -0
- package/packages/datadog-instrumentations/src/sequelize.js +94 -2
- package/packages/datadog-instrumentations/src/undici.js +53 -4
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +44 -7
- package/packages/datadog-instrumentations/src/vitest-main.js +92 -9
- package/packages/datadog-instrumentations/src/vitest-worker.js +82 -14
- package/packages/datadog-instrumentations/src/webdriverio.js +986 -1
- package/packages/datadog-instrumentations/src/winston.js +6 -3
- package/packages/datadog-plugin-amqp10/src/consumer.js +3 -1
- package/packages/datadog-plugin-amqp10/src/producer.js +3 -1
- package/packages/datadog-plugin-amqp10/src/util.js +2 -1
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +6 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +16 -5
- package/packages/datadog-plugin-cassandra-driver/src/index.js +8 -3
- package/packages/datadog-plugin-cucumber/src/index.js +0 -2
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +262 -48
- package/packages/datadog-plugin-cypress/src/support.js +1 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +4 -1
- package/packages/datadog-plugin-graphql/src/execute.js +998 -196
- package/packages/datadog-plugin-graphql/src/index.js +27 -7
- package/packages/datadog-plugin-graphql/src/jit.js +136 -0
- package/packages/datadog-plugin-graphql/src/request.js +18 -27
- package/packages/datadog-plugin-graphql/src/resolve-error.js +108 -0
- package/packages/datadog-plugin-graphql/src/tools/signature.js +1 -2
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +45 -3
- package/packages/datadog-plugin-graphql/src/utils.js +208 -120
- package/packages/datadog-plugin-graphql/src/validate.js +10 -23
- package/packages/datadog-plugin-http/src/client.js +2 -15
- package/packages/datadog-plugin-http2/src/client.js +2 -15
- package/packages/datadog-plugin-jest/src/index.js +0 -6
- package/packages/datadog-plugin-langchain/src/tracing.js +7 -0
- package/packages/datadog-plugin-mocha/src/index.js +403 -75
- package/packages/datadog-plugin-mongodb-core/src/query.js +6 -0
- package/packages/datadog-plugin-mysql/src/index.js +41 -15
- package/packages/datadog-plugin-net/src/tcp.js +3 -1
- package/packages/datadog-plugin-next/src/index.js +63 -29
- package/packages/datadog-plugin-openai-agents/src/integration.js +15 -11
- package/packages/datadog-plugin-playwright/src/index.js +176 -28
- package/packages/datadog-plugin-undici/src/index.js +29 -56
- package/packages/datadog-plugin-vitest/src/index.js +6 -12
- package/packages/dd-trace/src/aiguard/evaluation.js +96 -21
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +2 -3
- package/packages/dd-trace/src/aiguard/messages/anthropic.js +29 -10
- package/packages/dd-trace/src/aiguard/messages/openai.js +8 -1
- package/packages/dd-trace/src/aiguard/messages/vercel-ai.js +20 -6
- package/packages/dd-trace/src/aiguard/noop.js +9 -1
- package/packages/dd-trace/src/aiguard/redaction.js +183 -0
- package/packages/dd-trace/src/aiguard/sdk.js +7 -2
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/api_security/index.js +23 -6
- package/packages/dd-trace/src/appsec/api_security/sampler.js +99 -40
- package/packages/dd-trace/src/appsec/graphql.js +6 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +3 -3
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -1
- package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +8 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +11 -36
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +10 -9
- package/packages/dd-trace/src/appsec/lambda.js +44 -26
- package/packages/dd-trace/src/appsec/rule_manager.js +2 -0
- package/packages/dd-trace/src/ci-visibility/encode/json-encoder.js +32 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +8 -8
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +6 -4
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +20 -4
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/request-tracker.js +7 -150
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +7 -6
- package/packages/dd-trace/src/ci-visibility/exporters/agents.js +54 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +1 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +397 -234
- package/packages/dd-trace/src/ci-visibility/exporters/limits.js +9 -0
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +323 -31
- package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +42 -0
- package/packages/dd-trace/src/ci-visibility/final-flush.js +21 -0
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +57 -18
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +0 -3
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +164 -71
- package/packages/dd-trace/src/ci-visibility/requests/video-request.js +176 -0
- package/packages/dd-trace/src/ci-visibility/telemetry.js +10 -7
- package/packages/dd-trace/src/ci-visibility/test-video.js +61 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +10 -0
- package/packages/dd-trace/src/config/index.js +75 -14
- package/packages/dd-trace/src/config/parsers.js +11 -1
- package/packages/dd-trace/src/config/stable.js +3 -3
- package/packages/dd-trace/src/config/supported-configurations.json +47 -2
- package/packages/dd-trace/src/crashtracking/crashtracker.js +82 -18
- package/packages/dd-trace/src/debugger/config.js +12 -1
- package/packages/dd-trace/src/debugger/constants.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +2 -1
- package/packages/dd-trace/src/debugger/devtools_client/request-options.js +33 -0
- package/packages/dd-trace/src/debugger/devtools_client/send.js +7 -39
- package/packages/dd-trace/src/debugger/devtools_client/status.js +11 -6
- package/packages/dd-trace/src/debugger/devtools_client/tags.js +41 -0
- package/packages/dd-trace/src/debugger/index.js +23 -3
- package/packages/dd-trace/src/dogstatsd.js +532 -71
- package/packages/dd-trace/src/encode/0.4-cross-payload.js +170 -0
- package/packages/dd-trace/src/encode/0.4.js +5 -5
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +9 -8
- package/packages/dd-trace/src/evp_proxy/direct.js +27 -23
- package/packages/dd-trace/src/exporters/agent/index.js +24 -3
- package/packages/dd-trace/src/exporters/agent/writer.js +28 -11
- package/packages/dd-trace/src/exporters/agentless/index.js +7 -9
- package/packages/dd-trace/src/exporters/agentless/writer.js +100 -118
- package/packages/dd-trace/src/exporters/common/agents.js +28 -6
- package/packages/dd-trace/src/exporters/common/buffering-exporter.js +2 -2
- package/packages/dd-trace/src/exporters/common/final-flush-request-tracker.js +191 -0
- package/packages/dd-trace/src/exporters/common/request.js +31 -11
- package/packages/dd-trace/src/exporters/common/url.js +40 -1
- package/packages/dd-trace/src/exporters/common/writer.js +31 -7
- package/packages/dd-trace/src/exporters/span-stats/index.js +23 -4
- package/packages/dd-trace/src/external-logger/src/index.js +4 -3
- package/packages/dd-trace/src/flush.js +105 -0
- package/packages/dd-trace/src/id.js +14 -0
- package/packages/dd-trace/src/index.js +5 -2
- package/packages/dd-trace/src/llmobs/experiments/client.js +4 -0
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +52 -2
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +420 -105
- package/packages/dd-trace/src/llmobs/experiments/index.js +54 -42
- package/packages/dd-trace/src/llmobs/experiments/noop.js +39 -8
- package/packages/dd-trace/src/llmobs/experiments/result.js +1 -0
- package/packages/dd-trace/src/llmobs/experiments/util.js +21 -0
- package/packages/dd-trace/src/llmobs/index.js +111 -48
- package/packages/dd-trace/src/llmobs/noop.js +2 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/ddTelemetry.js +22 -71
- package/packages/dd-trace/src/llmobs/plugins/ai/vercelTelemetry.js +23 -13
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +8 -4
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +6 -3
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +7 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +13 -6
- package/packages/dd-trace/src/llmobs/plugins/openai-agents/utils.js +5 -7
- package/packages/dd-trace/src/llmobs/util.js +0 -33
- package/packages/dd-trace/src/llmobs/writers/base.js +106 -53
- package/packages/dd-trace/src/log/index.js +7 -1
- package/packages/dd-trace/src/log-submission/log-submission-plugin.js +249 -0
- package/packages/dd-trace/src/noop/span.js +5 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +14 -12
- package/packages/dd-trace/src/openfeature/writers/exposures.js +8 -1
- package/packages/dd-trace/src/openfeature/writers/util.js +1 -1
- package/packages/dd-trace/src/opentelemetry/logs/batch_log_processor.js +45 -3
- package/packages/dd-trace/src/opentelemetry/logs/index.js +9 -25
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +7 -4
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +14 -4
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +18 -23
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +8 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +18 -6
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +14 -2
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +25 -5
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +61 -25
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +19 -4
- package/packages/dd-trace/src/opentelemetry/resource-attributes.js +55 -0
- package/packages/dd-trace/src/opentelemetry/trace/index.js +6 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +10 -0
- package/packages/dd-trace/src/opentelemetry/tracer.js +26 -2
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +494 -351
- package/packages/dd-trace/src/opentracing/span.js +28 -0
- package/packages/dd-trace/src/otel-thread-ctx.js +23 -5
- package/packages/dd-trace/src/payload-tagging/index.js +2 -1
- package/packages/dd-trace/src/plugin_manager.js +2 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +1 -6
- package/packages/dd-trace/src/plugins/tracing.js +12 -10
- package/packages/dd-trace/src/plugins/util/ci.js +3 -1
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +16 -15
- package/packages/dd-trace/src/plugins/util/status-validator.js +98 -0
- package/packages/dd-trace/src/plugins/util/test.js +157 -41
- package/packages/dd-trace/src/plugins/util/url.js +2 -2
- package/packages/dd-trace/src/plugins/util/web.js +6 -74
- package/packages/dd-trace/src/profiling/config.js +1 -0
- package/packages/dd-trace/src/profiling/oom.js +11 -5
- package/packages/dd-trace/src/profiling/profiler.js +30 -13
- package/packages/dd-trace/src/profiling/profilers/events.js +3 -3
- package/packages/dd-trace/src/profiling/profilers/space.js +38 -11
- package/packages/dd-trace/src/profiling/profilers/wall.js +14 -14
- package/packages/dd-trace/src/profiling/webspan-utils.js +7 -4
- package/packages/dd-trace/src/proxy.js +108 -10
- package/packages/dd-trace/src/remote_config/index.js +319 -101
- package/packages/dd-trace/src/remote_config/scheduler.js +37 -12
- package/packages/dd-trace/src/runtime_metrics/client.js +37 -8
- package/packages/dd-trace/src/runtime_metrics/index.js +5 -0
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +10 -1
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +22 -7
- package/packages/dd-trace/src/sampling_rule.js +36 -9
- package/packages/dd-trace/src/serverless/telemetry-delivery-tracker.js +51 -0
- package/packages/dd-trace/src/serverless/vercel.js +155 -0
- package/packages/dd-trace/src/serverless.js +45 -21
- package/packages/dd-trace/src/service-naming/schemas/util.js +1 -1
- package/packages/dd-trace/src/span_stats.js +64 -31
- package/packages/dd-trace/src/startup-log.js +3 -2
- package/packages/dd-trace/src/telemetry/agentless-url.js +28 -0
- package/packages/dd-trace/src/telemetry/send-data.js +18 -16
- package/packages/dd-trace/src/telemetry/session-propagation.js +3 -2
- package/packages/dd-trace/src/tracer.js +26 -5
- package/packages/dd-trace/src/tracer_metadata.js +11 -3
- package/packages/dd-trace/src/web-tags-cache.js +67 -13
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/vendor/dist/@datadog/sketches-js/index.js +1 -1
- package/vendor/dist/protobufjs/index.js +1 -1
- package/vendor/dist/protobufjs/minimal/index.js +1 -1
- package/packages/datadog-instrumentations/src/playwright-browser-scripts.js +0 -27
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +0 -53
- package/packages/dd-trace/src/encode/agentless-json.js +0 -209
package/LICENSE-3rdparty.csv
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"component","origin","license","copyright"
|
|
2
2
|
"@apm-js-collab/code-transformer","https://github.com/nodejs/orchestrion-js","['Apache-2.0']","['nodejs']"
|
|
3
3
|
"@datadog/flagging-core","https://github.com/DataDog/openfeature-js-client","['Apache-2.0']","['DataDog']"
|
|
4
|
-
"@datadog/libdatadog","https://github.com/DataDog/libdatadog-nodejs","['Apache-2.0']","['
|
|
4
|
+
"@datadog/libdatadog","https://github.com/DataDog/libdatadog-nodejs","['Apache-2.0']","['DataDog']"
|
|
5
|
+
"@datadog/libdatadog-extras","https://github.com/DataDog/libdatadog-nodejs","['Apache-2.0']","['Datadog Inc.']"
|
|
6
|
+
"@datadog/libdatadog-wasm","https://github.com/DataDog/libdatadog-nodejs","['Apache-2.0']","['DataDog']"
|
|
5
7
|
"@datadog/native-appsec","https://github.com/DataDog/dd-native-appsec-js","['Apache-2.0']","['Datadog Inc.']"
|
|
6
8
|
"@datadog/native-iast-taint-tracking","https://github.com/DataDog/dd-native-iast-taint-tracking-js","['Apache-2.0']","['Datadog Inc.']"
|
|
7
9
|
"@datadog/native-metrics","https://github.com/DataDog/dd-native-metrics-js","['Apache-2.0']","['Datadog Inc.']"
|
package/ci/init.js
CHANGED
|
@@ -7,7 +7,7 @@ const { getEnvironmentVariable, getValueFromEnvSources } = require('../packages/
|
|
|
7
7
|
const { isFalse, isTrue } = require('../packages/dd-trace/src/util')
|
|
8
8
|
|
|
9
9
|
const PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm']
|
|
10
|
-
const DEFAULT_FLUSH_INTERVAL =
|
|
10
|
+
const DEFAULT_FLUSH_INTERVAL = 10_000
|
|
11
11
|
const JEST_FLUSH_INTERVAL = 0
|
|
12
12
|
const VITEST_NO_WORKER_INIT_ACTIVE_ENV = 'DD_TEST_OPT_VITEST_NO_WORKER_INIT_ACTIVE'
|
|
13
13
|
const VALIDATION_MODE_ENV = '_DD_TEST_OPTIMIZATION_VALIDATION_MODE'
|
|
@@ -63,7 +63,9 @@ if (isValidationModeRequested && !isValidationMode) {
|
|
|
63
63
|
let shouldInit = isValidationModeRequested
|
|
64
64
|
? isValidationMode && !isFalse(getEnvironmentVariable('DD_CIVISIBILITY_ENABLED'))
|
|
65
65
|
: getValueFromEnvSources('DD_CIVISIBILITY_ENABLED', true) !== false
|
|
66
|
-
const
|
|
66
|
+
const isGlobalAgentlessEnabled = getValueFromEnvSources('DD_AGENTLESS_ENABLED')
|
|
67
|
+
const isAgentlessEnabled = isGlobalAgentlessEnabled ||
|
|
68
|
+
getValueFromEnvSources('DD_CIVISIBILITY_AGENTLESS_ENABLED')
|
|
67
69
|
|
|
68
70
|
if (!isTestWorker && isPackageManager()) {
|
|
69
71
|
log.debug('dd-trace is not initialized in a package manager.')
|
|
@@ -85,8 +87,11 @@ if (isTestWorker) {
|
|
|
85
87
|
exporter: 'datadog',
|
|
86
88
|
}
|
|
87
89
|
} else {
|
|
90
|
+
const configurationName = isGlobalAgentlessEnabled
|
|
91
|
+
? 'DD_AGENTLESS_ENABLED'
|
|
92
|
+
: 'DD_CIVISIBILITY_AGENTLESS_ENABLED'
|
|
88
93
|
console.error(
|
|
89
|
-
|
|
94
|
+
`${configurationName} is set, but neither ` +
|
|
90
95
|
'DD_API_KEY nor DATADOG_API_KEY are set in your environment, so ' +
|
|
91
96
|
'dd-trace will not be initialized.'
|
|
92
97
|
)
|
|
@@ -146,7 +146,7 @@ function getPackageScriptInvocation (command) {
|
|
|
146
146
|
const literalPrefix = parseLiteralEnvironmentPrefix(command)
|
|
147
147
|
const source = command.slice(literalPrefix.length).trim()
|
|
148
148
|
.replace(/^(?:c8|nyc)(?:\.cmd)?\s+/, '')
|
|
149
|
-
const match = /^(bun|npm(?:\.cmd)?|pnpm(?:\.cmd)?|yarn(?:pkg)?(?:\.cmd)?)\s+(?:(run|run-script)\s+)?([\w:-]+)(?:\s+(
|
|
149
|
+
const match = /^(bun|npm(?:\.cmd)?|pnpm(?:\.cmd)?|yarn(?:pkg)?(?:\.cmd)?)\s+(?:(run|run-script)\s+)?([\w:-]+)(?:\s+(\S.*))?$/
|
|
150
150
|
.exec(source)
|
|
151
151
|
if (!match) return
|
|
152
152
|
|
|
@@ -155,7 +155,7 @@ function getPackageScriptInvocation (command) {
|
|
|
155
155
|
if (manager === 'bun' && match[2] !== 'run') return
|
|
156
156
|
if (!match[2] && RESERVED_PACKAGE_MANAGER_COMMANDS[manager]?.has(match[3])) return
|
|
157
157
|
const args = match[4]?.trim()
|
|
158
|
-
const separatedArguments = args ? /^--(?:\s+(
|
|
158
|
+
const separatedArguments = args ? /^--(?:\s+(\S.*))?$/.exec(args) : undefined
|
|
159
159
|
if (['npm', 'pnpm'].includes(manager) && args && !separatedArguments) return
|
|
160
160
|
const scriptArguments = ['npm', 'pnpm'].includes(manager) ? separatedArguments?.[1]?.trim() : args
|
|
161
161
|
if (scriptArguments && !splitLiteralAndChain(scriptArguments)) return
|
|
@@ -54,12 +54,12 @@ function getConfiguredTransport (framework) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function getCiLocation (ciWiring) {
|
|
57
|
-
|
|
58
|
-
if (ciWiring.configFile)
|
|
59
|
-
if (ciWiring.workflow)
|
|
60
|
-
if (ciWiring.job)
|
|
61
|
-
if (ciWiring.step)
|
|
62
|
-
return
|
|
57
|
+
let location = ''
|
|
58
|
+
if (ciWiring.configFile) location += `configuration ${formatPath(ciWiring.configFile)}`
|
|
59
|
+
if (ciWiring.workflow) location += `${location ? ', ' : ''}workflow ${JSON.stringify(String(ciWiring.workflow))}`
|
|
60
|
+
if (ciWiring.job) location += `${location ? ', ' : ''}job ${JSON.stringify(String(ciWiring.job))}`
|
|
61
|
+
if (ciWiring.step) location += `${location ? ', ' : ''}step ${JSON.stringify(String(ciWiring.step))}`
|
|
62
|
+
return location || 'the selected CI test step'
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function formatPath (filename) {
|
|
@@ -16,13 +16,15 @@ const MODULE_OR_TRANSFORM_PATTERN =
|
|
|
16
16
|
/\b(?:Cannot find (?:module|package)|ERR_MODULE_NOT_FOUND|MODULE_NOT_FOUND|ERR_PACKAGE_PATH_NOT_EXPORTED|Package subpath\b[\s\S]+\bnot defined by "exports"|Could not resolve|transform failed)\b/i
|
|
17
17
|
const BUILD_ARTIFACT_PATH_PATTERN = String.raw`(?:^|[\\/])(?:build|dist|generated)(?:[\\/]|['"])`
|
|
18
18
|
const MISSING_ARTIFACT_MESSAGE_PATTERN =
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
/Cannot find (?:module|package)|ERR_MODULE_NOT_FOUND|MODULE_NOT_FOUND|ENOENT|no such file or directory|is not found|does not exist|could not be found/
|
|
20
|
+
/* eslint-disable regexp/no-useless-non-capturing-group, regexp/prefer-character-class --
|
|
21
|
+
* The interpolated message fragment contains alternatives and must stay grouped on both sides of the path. */
|
|
21
22
|
const BUILD_ARTIFACT_MISSING_PATTERN = new RegExp(
|
|
22
|
-
String.raw`(?:${MISSING_ARTIFACT_MESSAGE_PATTERN}[^\r\n]{0,500}${BUILD_ARTIFACT_PATH_PATTERN}|` +
|
|
23
|
-
String.raw`${BUILD_ARTIFACT_PATH_PATTERN}[^\r\n]{0,500}
|
|
23
|
+
String.raw`(?:(?:${MISSING_ARTIFACT_MESSAGE_PATTERN.source})[^\r\n]{0,500}${BUILD_ARTIFACT_PATH_PATTERN}|` +
|
|
24
|
+
String.raw`${BUILD_ARTIFACT_PATH_PATTERN}[^\r\n]{0,500}(?:${MISSING_ARTIFACT_MESSAGE_PATTERN.source}))`,
|
|
24
25
|
'im'
|
|
25
26
|
)
|
|
27
|
+
/* eslint-enable regexp/no-useless-non-capturing-group, regexp/prefer-character-class */
|
|
26
28
|
const FILE_PATH_REFERENCE_PATTERN = /(?:^|[\s('"`])((?:\.{1,2}[\\/]|[\\/]|[A-Za-z]:[\\/])[^'"`\s),;]*)/g
|
|
27
29
|
const CUCUMBER_CONFIG_OPTION_UNSUPPORTED_PATTERN = /unknown option ['"]--config['"]/i
|
|
28
30
|
const CYPRESS_BINARY_PATTERN =
|
|
@@ -41,7 +43,7 @@ const PUPPETEER_BROWSER_PATTERN =
|
|
|
41
43
|
const PUPPETEER_BROWSER_ABORT_PATTERN =
|
|
42
44
|
/Failed to launch the browser process[\s\S]*?(?:signal=SIGABRT|Received signal 6|Abort trap: 6)/i
|
|
43
45
|
const CUCUMBER_BROWSER_FAILURE_PATTERN =
|
|
44
|
-
/(?:
|
|
46
|
+
/(?:browser|puppeteer|playwright|webdriver)[^\r\n]{1,160}\b(?:aborted|closed|crashed|failed|terminated|unavailable)\b|(?:Failed|Unable) to (?:connect to|launch|start) (?:the )?browser/i
|
|
45
47
|
const VITEST_BROWSER_PROVIDER_PATTERN =
|
|
46
48
|
/Cannot find (?:module|package).*@vitest\/browser|@vitest\/browser-[^\s'"].*(?:missing|not (?:found|installed))/i
|
|
47
49
|
const RUNNER_COMMAND_NOT_FOUND_PATTERN =
|
|
@@ -478,7 +478,7 @@ function getYamlStringProfileDefinitions (source) {
|
|
|
478
478
|
const definitions = new Map()
|
|
479
479
|
for (const line of source.split(/\r?\n/)) {
|
|
480
480
|
if (!line.trim() || /^\s*#/.test(line)) continue
|
|
481
|
-
const match = /^([A-Za-z0-9_-]+)
|
|
481
|
+
const match = /^([A-Za-z0-9_-]+):(.*)$/.exec(line)
|
|
482
482
|
const definition = match && !/^\s/.test(line) ? getYamlStringProfileDefinition(match[2]) : undefined
|
|
483
483
|
if (definition === undefined) {
|
|
484
484
|
throw new Error('YAML profiles must be literal one-line command strings')
|
|
@@ -40,20 +40,18 @@ function getTestExtension (filename) {
|
|
|
40
40
|
* @returns {string} canonical generated Cypress source
|
|
41
41
|
*/
|
|
42
42
|
function getGeneratedTestContent ({ scenarioId, testName }) {
|
|
43
|
-
|
|
43
|
+
let content = ''
|
|
44
44
|
if (scenarioId === 'atr-fail-once') {
|
|
45
|
-
|
|
45
|
+
content = 'let attempt = 0\n\n'
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
' })',
|
|
47
|
+
content += "describe('dd-test-optimization-validation', () => {\n" +
|
|
48
|
+
` it(${JSON.stringify(testName)}, () => {\n` +
|
|
49
|
+
(scenarioId === 'atr-fail-once'
|
|
50
|
+
? ' expect(attempt++).to.equal(1)\n'
|
|
51
|
+
: ' expect(true).to.equal(true)\n') +
|
|
52
|
+
' })\n' +
|
|
54
53
|
'})'
|
|
55
|
-
|
|
56
|
-
return lines.join('\n')
|
|
54
|
+
return content
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
/**
|
|
@@ -213,7 +213,7 @@ function getProjectObject (source, nameIndex, workspaceConfig) {
|
|
|
213
213
|
function isStandaloneProjectObject (source, range) {
|
|
214
214
|
const before = maskJavaScriptNonCode(source.slice(0, range.start))
|
|
215
215
|
const after = maskJavaScriptNonCode(source.slice(range.end + 1))
|
|
216
|
-
return PROJECT_CALL_PATTERN.test(before) && /^\s
|
|
216
|
+
return PROJECT_CALL_PATTERN.test(before) && /^\s*(?:,\s*)?\)[\s;]*$/.test(after)
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
/**
|
|
@@ -259,7 +259,7 @@ function isExportedConfigObject (source, range) {
|
|
|
259
259
|
const before = maskJavaScriptNonCode(source.slice(0, range.start))
|
|
260
260
|
const after = maskJavaScriptNonCode(source.slice(range.end + 1))
|
|
261
261
|
return (DIRECT_EXPORT_PATTERN.test(before) && /^[\s;]*$/.test(after)) ||
|
|
262
|
-
(CONFIG_CALL_PATTERN.test(before) && /^\s
|
|
262
|
+
(CONFIG_CALL_PATTERN.test(before) && /^\s*(?:,\s*)?\)[\s;]*$/.test(after))
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
/**
|
|
@@ -276,7 +276,7 @@ function isWorkspaceProjectEntry (source, range) {
|
|
|
276
276
|
const before = maskJavaScriptNonCode(source.slice(0, workspaceArray.start))
|
|
277
277
|
const after = maskJavaScriptNonCode(source.slice(workspaceArray.end + 1))
|
|
278
278
|
return (DIRECT_EXPORT_PATTERN.test(before) && /^[\s;]*$/.test(after)) ||
|
|
279
|
-
(WORKSPACE_ARRAY_CALL_PATTERN.test(before) && /^\s
|
|
279
|
+
(WORKSPACE_ARRAY_CALL_PATTERN.test(before) && /^\s*(?:,\s*)?\)[\s;]*$/.test(after))
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
/**
|
|
@@ -88,7 +88,7 @@ function getFailureDetail (result) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function sanitizeLine (value) {
|
|
91
|
-
return sanitizeString(String(value)).replaceAll(/\p{Cc}+/gu, ' ').trim().slice(0, 1000).replace(
|
|
91
|
+
return sanitizeString(String(value)).replaceAll(/\p{Cc}+/gu, ' ').trim().slice(0, 1000).replace(/\.+$/, '')
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
module.exports = { checkInstalledPackage, getInstalledPackageFailure }
|
|
@@ -273,11 +273,13 @@ function getCiVerdict (results) {
|
|
|
273
273
|
if (ci.evidence?.reasonCode === 'remote-ci-command-unavailable') {
|
|
274
274
|
return 'INCOMPLETE — test execution is delegated to unavailable remote CI code'
|
|
275
275
|
}
|
|
276
|
-
|
|
277
|
-
if (ci.evidence?.ciFacts?.initialization?.status === 'missing') facts
|
|
278
|
-
if (ci.evidence?.ciFacts?.transport?.status === 'missing') facts
|
|
279
|
-
if (ci.evidence?.ciFacts?.runnerInvocation?.status === 'unresolved')
|
|
280
|
-
|
|
276
|
+
let facts = ''
|
|
277
|
+
if (ci.evidence?.ciFacts?.initialization?.status === 'missing') facts = 'initialization not visible'
|
|
278
|
+
if (ci.evidence?.ciFacts?.transport?.status === 'missing') facts += `${facts ? '; ' : ''}transport not visible`
|
|
279
|
+
if (ci.evidence?.ciFacts?.runnerInvocation?.status === 'unresolved') {
|
|
280
|
+
facts += `${facts ? '; ' : ''}runner path unresolved`
|
|
281
|
+
}
|
|
282
|
+
return `INCOMPLETE${facts ? ` — ${facts}` : ''}`
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
function getPrerequisiteVerdict (results) {
|
|
@@ -184,12 +184,13 @@ function runCiWiring ({ manifest, framework, projectFileSources }) {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
if (resolution.status !== 'confirmed') {
|
|
187
|
-
|
|
187
|
+
let visibleFacts = ''
|
|
188
188
|
if (initialization.status === 'missing') {
|
|
189
|
-
visibleFacts
|
|
189
|
+
visibleFacts = 'The selected job has no visible dd-trace/ci/init preload.'
|
|
190
190
|
}
|
|
191
191
|
if (ciFacts.transport.status === 'missing') {
|
|
192
|
-
visibleFacts
|
|
192
|
+
if (visibleFacts) visibleFacts += ' '
|
|
193
|
+
visibleFacts += 'The recorded review found no visible Datadog Agent or agentless reporting transport.'
|
|
193
194
|
}
|
|
194
195
|
const recommendation = /working directory/i.test(resolution.reason)
|
|
195
196
|
? 'Keep the CI job\'s actual working directory. Resolve the repository-root wrapper to the selected test ' +
|
|
@@ -199,7 +200,7 @@ function runCiWiring ({ manifest, framework, projectFileSources }) {
|
|
|
199
200
|
return getIncomplete(
|
|
200
201
|
framework,
|
|
201
202
|
'The CI audit remains incomplete because the selected command could not be resolved to the ' +
|
|
202
|
-
`${framework.framework} runner: ${resolution.reason}. ${visibleFacts
|
|
203
|
+
`${framework.framework} runner: ${resolution.reason}. ${visibleFacts}`.trim(),
|
|
203
204
|
{
|
|
204
205
|
...evidence,
|
|
205
206
|
recommendation,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
try {
|
|
2
|
+
// Vitest does not expose setFn from its public setup API; keep this optional for strict installers.
|
|
3
|
+
const vitestRunner = await import('@vitest/runner')
|
|
4
|
+
globalThis[Symbol.for('dd-trace.vitest.set-fn')] = vitestRunner.setFn
|
|
5
|
+
} catch {}
|
|
6
|
+
globalThis[Symbol.for('dd-trace.vitest.browser-context-importer')] = () => import('@vitest/browser/context')
|
|
7
|
+
|
|
8
|
+
await import('./vitest-no-worker-init-setup.mjs')
|
|
@@ -23,14 +23,9 @@ const quarantinedTests = providedContext.quarantinedTests || {}
|
|
|
23
23
|
const isRumCorrelationEnabled = providedContext.isRumCorrelationEnabled !== false
|
|
24
24
|
const rumTestExecutionIdCookieName = providedContext.rumTestExecutionIdCookieName
|
|
25
25
|
const testPropertiesByFilepath = providedContext.testPropertiesByFilepath || {}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Vitest does not expose setFn from the public setup API; keep this optional for strict installers.
|
|
30
|
-
const vitestRunner = await import('@vitest/runner')
|
|
31
|
-
setVitestTaskFn = vitestRunner.setFn
|
|
32
|
-
} catch {}
|
|
33
|
-
}
|
|
26
|
+
const setVitestTaskFn = globalThis[Symbol.for('dd-trace.vitest.set-fn')]
|
|
27
|
+
const skipVitestTask = globalThis[Symbol.for('dd-trace.vitest.skip-task')]
|
|
28
|
+
const importVitestBrowserContext = globalThis[Symbol.for('dd-trace.vitest.browser-context-importer')]
|
|
34
29
|
const earlyFlakeDetectionRetriesByTask = new WeakMap()
|
|
35
30
|
const earlyFlakeDetectionSkippedResults = new WeakMap()
|
|
36
31
|
const earlyFlakeDetectionStartByTask = new WeakMap()
|
|
@@ -62,7 +57,7 @@ if (typeof globalThis.process?.uptime === 'function') {
|
|
|
62
57
|
async function requestBrowserEfdSuiteAdmission (testSuite, hasNewTest) {
|
|
63
58
|
try {
|
|
64
59
|
if (!browserCommands) {
|
|
65
|
-
const vitestBrowser = await
|
|
60
|
+
const vitestBrowser = await importVitestBrowserContext()
|
|
66
61
|
browserCommands = vitestBrowser.commands
|
|
67
62
|
}
|
|
68
63
|
return await browserCommands[efdSuiteAdmissionBrowserCommand](testSuite, hasNewTest) === true
|
|
@@ -100,7 +95,7 @@ if (isNoWorkerInitActive) {
|
|
|
100
95
|
} else if (isAttemptToFixTest && attemptIndex > 0) {
|
|
101
96
|
task.result.state = 'run'
|
|
102
97
|
} else if (isEarlyFlakeDetectionTestAttempt) {
|
|
103
|
-
const isSkippedRepeat = prepareEarlyFlakeDetectionAttempt(task, attemptIndex)
|
|
98
|
+
const isSkippedRepeat = prepareEarlyFlakeDetectionAttempt(task, attemptIndex, skip)
|
|
104
99
|
if (!isSkippedRepeat && attemptIndex > 0) {
|
|
105
100
|
task.result.state = 'run'
|
|
106
101
|
}
|
|
@@ -624,7 +619,7 @@ function getPreviousErrorCount (errorCounts, repeatCount) {
|
|
|
624
619
|
return 0
|
|
625
620
|
}
|
|
626
621
|
|
|
627
|
-
function prepareEarlyFlakeDetectionAttempt (task, attemptIndex) {
|
|
622
|
+
function prepareEarlyFlakeDetectionAttempt (task, attemptIndex, skip) {
|
|
628
623
|
if (attemptIndex === 0) {
|
|
629
624
|
earlyFlakeDetectionStartByTask.set(task, now())
|
|
630
625
|
return false
|
|
@@ -646,7 +641,8 @@ function prepareEarlyFlakeDetectionAttempt (task, attemptIndex) {
|
|
|
646
641
|
return false
|
|
647
642
|
}
|
|
648
643
|
|
|
649
|
-
|
|
644
|
+
const canReplaceTaskFn = canReplaceVitestTaskFn()
|
|
645
|
+
if (!canReplaceTaskFn && typeof skipVitestTask !== 'function') {
|
|
650
646
|
earlyFlakeDetectionStartByTask.set(task, now())
|
|
651
647
|
return false
|
|
652
648
|
}
|
|
@@ -658,7 +654,11 @@ function prepareEarlyFlakeDetectionAttempt (task, attemptIndex) {
|
|
|
658
654
|
})
|
|
659
655
|
}
|
|
660
656
|
task.meta.__ddTestOptEfdSkipCurrentAttempt = true
|
|
661
|
-
|
|
657
|
+
if (canReplaceTaskFn) {
|
|
658
|
+
replaceVitestTaskFn(task, noopTest)
|
|
659
|
+
} else {
|
|
660
|
+
skipVitestTask(skip)
|
|
661
|
+
}
|
|
662
662
|
return true
|
|
663
663
|
}
|
|
664
664
|
|
package/index.d.ts
CHANGED
|
@@ -356,6 +356,16 @@ declare namespace tracer {
|
|
|
356
356
|
links?: { context: SpanContext, attributes?: Object }[]
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
export interface Exception {
|
|
360
|
+
message: string;
|
|
361
|
+
name?: string;
|
|
362
|
+
stack?: string;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export type SpanEventAttributeValue =
|
|
366
|
+
string | number | boolean | Array<string> | Array<number> | Array<boolean>;
|
|
367
|
+
export type SpanEventAttributes = Record<string, SpanEventAttributeValue>;
|
|
368
|
+
|
|
359
369
|
/**
|
|
360
370
|
* Span represents a logical unit of work as part of a broader Trace.
|
|
361
371
|
* Examples of span might include remote procedure calls or a in-process
|
|
@@ -366,6 +376,14 @@ declare namespace tracer {
|
|
|
366
376
|
export interface Span extends opentracing.Span {
|
|
367
377
|
context (): SpanContext;
|
|
368
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Records an exception as a span event without marking the span as failed.
|
|
381
|
+
*
|
|
382
|
+
* @param exception The exception to record.
|
|
383
|
+
* @param attributes Additional attributes for the exception event.
|
|
384
|
+
*/
|
|
385
|
+
recordException (exception: Exception, attributes?: SpanEventAttributes): void;
|
|
386
|
+
|
|
369
387
|
/**
|
|
370
388
|
* Adds a single link to the span.
|
|
371
389
|
*
|
|
@@ -789,6 +807,13 @@ declare namespace tracer {
|
|
|
789
807
|
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
790
808
|
*/
|
|
791
809
|
maxMessagesLength?: number,
|
|
810
|
+
/**
|
|
811
|
+
* Whether AI Guard applies backend-provided sensitive-data redaction replacements.
|
|
812
|
+
* @default true
|
|
813
|
+
* @env DD_AI_GUARD_REDACTION_ENABLED
|
|
814
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
815
|
+
*/
|
|
816
|
+
redactionEnabled?: boolean,
|
|
792
817
|
/**
|
|
793
818
|
* Max size of the content property set in the meta-struct
|
|
794
819
|
* @env DD_AI_GUARD_MAX_CONTENT_SIZE
|
|
@@ -1706,6 +1731,25 @@ declare namespace tracer {
|
|
|
1706
1731
|
};
|
|
1707
1732
|
}
|
|
1708
1733
|
|
|
1734
|
+
/**
|
|
1735
|
+
* A structured content part in an AI Guard message.
|
|
1736
|
+
*/
|
|
1737
|
+
export interface ContentPart {
|
|
1738
|
+
type: string;
|
|
1739
|
+
text?: string;
|
|
1740
|
+
image_url?: { url: string };
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* A conversational message whose content is represented by structured parts.
|
|
1745
|
+
*/
|
|
1746
|
+
export interface ContentPartsMessage {
|
|
1747
|
+
role: string;
|
|
1748
|
+
content: ContentPart[];
|
|
1749
|
+
tool_call_id?: string;
|
|
1750
|
+
tool_calls?: ToolCall[];
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1709
1753
|
/**
|
|
1710
1754
|
* A standard conversational message exchanged with a Large Language Model (LLM).
|
|
1711
1755
|
*/
|
|
@@ -1777,10 +1821,25 @@ declare namespace tracer {
|
|
|
1777
1821
|
|
|
1778
1822
|
export type Message =
|
|
1779
1823
|
| TextMessage
|
|
1824
|
+
| ContentPartsMessage
|
|
1780
1825
|
| AssistantTextMessage
|
|
1781
1826
|
| AssistantToolCallMessage
|
|
1782
1827
|
| ToolMessage;
|
|
1783
1828
|
|
|
1829
|
+
/**
|
|
1830
|
+
* A sensitive data replacement the AI Guard service determined for the evaluated conversation.
|
|
1831
|
+
*/
|
|
1832
|
+
export interface RedactionReplacement {
|
|
1833
|
+
/**
|
|
1834
|
+
* Location of the replaced value within the evaluated conversation (e.g. `messages[0].content`).
|
|
1835
|
+
*/
|
|
1836
|
+
path: string;
|
|
1837
|
+
/**
|
|
1838
|
+
* The value that replaces the sensitive data found at `path`.
|
|
1839
|
+
*/
|
|
1840
|
+
replacement: string;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1784
1843
|
/**
|
|
1785
1844
|
* The result returned by AI Guard after evaluating a conversation.
|
|
1786
1845
|
*/
|
|
@@ -1808,6 +1867,16 @@ declare namespace tracer {
|
|
|
1808
1867
|
* Sensitive Data Scanner findings from the evaluation.
|
|
1809
1868
|
*/
|
|
1810
1869
|
sds: Object[];
|
|
1870
|
+
/**
|
|
1871
|
+
* The evaluated conversation, redacted when required by the AI Guard service.
|
|
1872
|
+
* This may contain sensitive data when redaction is disabled or no replacement was applied.
|
|
1873
|
+
*/
|
|
1874
|
+
messages: Message[];
|
|
1875
|
+
/**
|
|
1876
|
+
* The replacements the AI Guard service determined for the evaluated conversation, reported whether or not
|
|
1877
|
+
* the tracer applied them. Empty when the service determined no replacement.
|
|
1878
|
+
*/
|
|
1879
|
+
redactionReplacements: RedactionReplacement[];
|
|
1811
1880
|
}
|
|
1812
1881
|
|
|
1813
1882
|
/**
|
|
@@ -2189,7 +2258,7 @@ declare namespace tracer {
|
|
|
2189
2258
|
* This plugin automatically instruments the
|
|
2190
2259
|
* [Vercel AI SDK](https://ai-sdk.dev/docs/introduction) module.
|
|
2191
2260
|
*/
|
|
2192
|
-
interface ai extends Instrumentation {}
|
|
2261
|
+
interface ai extends Instrumentation, LLMObsIntegration {}
|
|
2193
2262
|
|
|
2194
2263
|
/**
|
|
2195
2264
|
* This plugin automatically instruments the
|
|
@@ -2207,13 +2276,13 @@ declare namespace tracer {
|
|
|
2207
2276
|
* This plugin automatically instruments the
|
|
2208
2277
|
* [anthropic](https://www.npmjs.com/package/@anthropic-ai/sdk) module.
|
|
2209
2278
|
*/
|
|
2210
|
-
interface anthropic extends Instrumentation {}
|
|
2279
|
+
interface anthropic extends Instrumentation, LLMObsIntegration {}
|
|
2211
2280
|
|
|
2212
2281
|
/**
|
|
2213
2282
|
* This plugin automatically instruments the
|
|
2214
2283
|
* [@anthropic-ai/claude-agent-sdk](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) module.
|
|
2215
2284
|
*/
|
|
2216
|
-
interface claude_agent_sdk extends Instrumentation {}
|
|
2285
|
+
interface claude_agent_sdk extends Instrumentation, LLMObsIntegration {}
|
|
2217
2286
|
|
|
2218
2287
|
/**
|
|
2219
2288
|
* Currently this plugin automatically instruments
|
|
@@ -2274,7 +2343,7 @@ declare namespace tracer {
|
|
|
2274
2343
|
* This plugin automatically instruments the
|
|
2275
2344
|
* [aws-sdk](https://github.com/aws/aws-sdk-js) module.
|
|
2276
2345
|
*/
|
|
2277
|
-
interface aws_sdk extends Instrumentation {
|
|
2346
|
+
interface aws_sdk extends Instrumentation, LLMObsIntegration {
|
|
2278
2347
|
/**
|
|
2279
2348
|
* The service name to be used for this plugin. When a function is used it is called with the AWS
|
|
2280
2349
|
* request parameters (e.g. `{ TableName }` for DynamoDB, `{ Bucket }` for S3) and its return value
|
|
@@ -2503,13 +2572,13 @@ declare namespace tracer {
|
|
|
2503
2572
|
* This plugin automatically instruments the
|
|
2504
2573
|
* [@google-cloud/vertexai](https://github.com/googleapis/nodejs-vertexai) module.
|
|
2505
2574
|
*/
|
|
2506
|
-
interface google_cloud_vertexai extends Integration {}
|
|
2575
|
+
interface google_cloud_vertexai extends Integration, LLMObsIntegration {}
|
|
2507
2576
|
|
|
2508
2577
|
/**
|
|
2509
2578
|
* This plugin automatically instruments the
|
|
2510
2579
|
* [@google-genai](https://github.com/googleapis/js-genai) module.
|
|
2511
2580
|
*/
|
|
2512
|
-
interface google_genai extends Integration {}
|
|
2581
|
+
interface google_genai extends Integration, LLMObsIntegration {}
|
|
2513
2582
|
|
|
2514
2583
|
/** @hidden */
|
|
2515
2584
|
interface ExecutionArgs {
|
|
@@ -2831,7 +2900,7 @@ declare namespace tracer {
|
|
|
2831
2900
|
* This plugin automatically instruments the
|
|
2832
2901
|
* [langgraph](https://github.com/npmjs/package/langgraph) library.
|
|
2833
2902
|
*/
|
|
2834
|
-
interface langgraph extends Instrumentation {}
|
|
2903
|
+
interface langgraph extends Instrumentation, LLMObsIntegration {}
|
|
2835
2904
|
|
|
2836
2905
|
/**
|
|
2837
2906
|
* This plugin automatically instruments the
|
|
@@ -2991,13 +3060,13 @@ declare namespace tracer {
|
|
|
2991
3060
|
* [DogStatsD](https://docs.datadoghq.com/developers/dogstatsd/?tab=hostagent#setup)
|
|
2992
3061
|
* in the agent.
|
|
2993
3062
|
*/
|
|
2994
|
-
interface openai extends Instrumentation {}
|
|
3063
|
+
interface openai extends Instrumentation, LLMObsIntegration {}
|
|
2995
3064
|
|
|
2996
3065
|
/**
|
|
2997
3066
|
* This plugin automatically instruments the
|
|
2998
3067
|
* [@openai/agents](https://www.npmjs.com/package/@openai/agents) library.
|
|
2999
3068
|
*/
|
|
3000
|
-
interface openai_agents extends Instrumentation {}
|
|
3069
|
+
interface openai_agents extends Instrumentation, LLMObsIntegration {}
|
|
3001
3070
|
|
|
3002
3071
|
/**
|
|
3003
3072
|
* This plugin automatically instruments the
|
|
@@ -3610,7 +3679,7 @@ declare namespace tracer {
|
|
|
3610
3679
|
*
|
|
3611
3680
|
* @deprecated Enabling LLM Observability via `llmobs.enable()` is deprecated and will be removed in dd-trace@7.0.0. Please instantiate LLM Observability via DD_LLMOBS_ENABLED or `tracer.init({ llmobs: ...options })`.
|
|
3612
3681
|
*/
|
|
3613
|
-
enable (options:
|
|
3682
|
+
enable (options: LLMObsRuntimeEnableOptions): void,
|
|
3614
3683
|
|
|
3615
3684
|
/**
|
|
3616
3685
|
* Disable LLM Observability tracing.
|
|
@@ -3798,21 +3867,35 @@ declare namespace tracer {
|
|
|
3798
3867
|
metadata?: Array<Record<string, any>>
|
|
3799
3868
|
) => any | Promise<any>
|
|
3800
3869
|
|
|
3870
|
+
interface DatasetRecord {
|
|
3871
|
+
id: string | null
|
|
3872
|
+
input: JSONType
|
|
3873
|
+
expectedOutput: JSONType
|
|
3874
|
+
metadata: Record<string, JSONType>
|
|
3875
|
+
tags: string[]
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
interface DatasetRecordNew {
|
|
3879
|
+
id?: string
|
|
3880
|
+
inputData: JSONType
|
|
3881
|
+
expectedOutput?: JSONType
|
|
3882
|
+
metadata?: Record<string, JSONType>
|
|
3883
|
+
tags?: string[]
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3801
3886
|
interface CreateDatasetOptions {
|
|
3887
|
+
/** Override the configured project for this dataset. */
|
|
3888
|
+
projectName?: string
|
|
3802
3889
|
description?: string
|
|
3803
|
-
records?:
|
|
3804
|
-
id?: string,
|
|
3805
|
-
inputData: JSONType,
|
|
3806
|
-
expectedOutput?: JSONType,
|
|
3807
|
-
metadata?: Record<string, JSONType>,
|
|
3808
|
-
tags?: string[]
|
|
3809
|
-
}>
|
|
3890
|
+
records?: DatasetRecordNew[]
|
|
3810
3891
|
}
|
|
3811
3892
|
|
|
3812
3893
|
interface ExperimentOptions {
|
|
3813
3894
|
name: string
|
|
3814
3895
|
dataset: Dataset
|
|
3815
3896
|
task: ExperimentTask
|
|
3897
|
+
/** Override the configured project for this experiment. */
|
|
3898
|
+
projectName?: string
|
|
3816
3899
|
/** Evaluators keyed by metric label, or named functions. */
|
|
3817
3900
|
evaluators?: Record<string, ExperimentEvaluator> | ExperimentEvaluator[]
|
|
3818
3901
|
/** Summary evaluators keyed by metric label, or named functions. */
|
|
@@ -3820,6 +3903,8 @@ declare namespace tracer {
|
|
|
3820
3903
|
description?: string
|
|
3821
3904
|
config?: Record<string, JSONType>
|
|
3822
3905
|
tags?: Record<string, string>
|
|
3906
|
+
/** Number of full experiment runs to execute. Default 1. */
|
|
3907
|
+
runs?: number
|
|
3823
3908
|
}
|
|
3824
3909
|
|
|
3825
3910
|
interface ExperimentRunOptions {
|
|
@@ -3829,9 +3914,13 @@ declare namespace tracer {
|
|
|
3829
3914
|
retryDelay?: (attempt: number) => number
|
|
3830
3915
|
/** Reject on the first task/evaluator error instead of capturing it. Default false. */
|
|
3831
3916
|
throwOnErrors?: boolean
|
|
3917
|
+
/** Maximum number of task/evaluator executions to process concurrently. Default 10. */
|
|
3918
|
+
concurrency?: number
|
|
3832
3919
|
}
|
|
3833
3920
|
|
|
3834
3921
|
interface PullDatasetOptions {
|
|
3922
|
+
/** Override the configured project for this dataset pull. */
|
|
3923
|
+
projectName?: string
|
|
3835
3924
|
/** Dataset version to pull. Defaults to latest. */
|
|
3836
3925
|
version?: number
|
|
3837
3926
|
/** Wait until at least this many records are readable (absorbs write lag). */
|
|
@@ -3860,17 +3949,21 @@ declare namespace tracer {
|
|
|
3860
3949
|
|
|
3861
3950
|
interface ExperimentRun {
|
|
3862
3951
|
runId: string
|
|
3952
|
+
/** 1-based run iteration. */
|
|
3863
3953
|
runIteration: number
|
|
3954
|
+
/** Whether this run had a task, row-evaluator, or summary-evaluator error. */
|
|
3955
|
+
hasError: boolean
|
|
3864
3956
|
rows: ExperimentResultRow[]
|
|
3865
3957
|
summaryEvaluations: Record<string, { value: any, error: string | null }>
|
|
3866
3958
|
}
|
|
3867
3959
|
|
|
3868
3960
|
interface ExperimentResult {
|
|
3869
3961
|
experimentId: string
|
|
3962
|
+
/** Rows from the first run, kept as a compatibility alias. */
|
|
3870
3963
|
rows: ExperimentResultRow[]
|
|
3871
|
-
/**
|
|
3964
|
+
/** Summary evaluator results from the first run, kept as a compatibility alias. */
|
|
3872
3965
|
summaryEvaluations: Record<string, { value: any, error: string | null }>
|
|
3873
|
-
/**
|
|
3966
|
+
/** All experiment runs. */
|
|
3874
3967
|
runs: ExperimentRun[]
|
|
3875
3968
|
/** Dashboard URL for the experiment. */
|
|
3876
3969
|
url: string
|
|
@@ -3963,6 +4056,8 @@ declare namespace tracer {
|
|
|
3963
4056
|
metadata?: Record<string, JSONType>,
|
|
3964
4057
|
tags?: string[]
|
|
3965
4058
|
): Dataset
|
|
4059
|
+
/** Add multiple records to the dataset. */
|
|
4060
|
+
addRecords (records: DatasetRecordNew[]): Dataset
|
|
3966
4061
|
/** Update fields on an existing dataset record. */
|
|
3967
4062
|
update (index: number, fields: {
|
|
3968
4063
|
input?: JSONType
|
|
@@ -3983,15 +4078,11 @@ declare namespace tracer {
|
|
|
3983
4078
|
description (): string
|
|
3984
4079
|
id (): string | null
|
|
3985
4080
|
projectId (): string | null
|
|
4081
|
+
/** Project associated with the client used to create or pull this dataset. */
|
|
4082
|
+
projectName (): string | null | undefined
|
|
3986
4083
|
version (): number | null
|
|
3987
4084
|
latestVersion (): number | null
|
|
3988
|
-
records ():
|
|
3989
|
-
id: string | null,
|
|
3990
|
-
input: JSONType,
|
|
3991
|
-
expectedOutput: JSONType,
|
|
3992
|
-
metadata: Record<string, JSONType>,
|
|
3993
|
-
tags: string[]
|
|
3994
|
-
}>
|
|
4085
|
+
records (): DatasetRecord[]
|
|
3995
4086
|
/** Return the tags used to filter this dataset. */
|
|
3996
4087
|
filterTags (): string[]
|
|
3997
4088
|
/** Dashboard URL for the dataset, or null until pushed. */
|
|
@@ -4507,6 +4598,13 @@ declare namespace tracer {
|
|
|
4507
4598
|
* Options for enabling LLM Observability tracing.
|
|
4508
4599
|
*/
|
|
4509
4600
|
interface LLMObsEnableOptions {
|
|
4601
|
+
/**
|
|
4602
|
+
* The name of the LLM Observability project used for experiments.
|
|
4603
|
+
* @env DD_LLMOBS_PROJECT_NAME
|
|
4604
|
+
* Programmatic configuration takes precedence over the environment variables listed above.
|
|
4605
|
+
*/
|
|
4606
|
+
projectName?: string,
|
|
4607
|
+
|
|
4510
4608
|
/**
|
|
4511
4609
|
* The name of your ML application.
|
|
4512
4610
|
* @env DD_LLMOBS_ML_APP
|
|
@@ -4531,6 +4629,9 @@ declare namespace tracer {
|
|
|
4531
4629
|
sampleRate?: number,
|
|
4532
4630
|
}
|
|
4533
4631
|
|
|
4632
|
+
/** Options accepted by the deprecated runtime `llmobs.enable()` method. */
|
|
4633
|
+
type LLMObsRuntimeEnableOptions = Omit<LLMObsEnableOptions, 'projectName'>
|
|
4634
|
+
|
|
4534
4635
|
/** @hidden */
|
|
4535
4636
|
type spanKind = 'agent' | 'workflow' | 'task' | 'tool' | 'retrieval' | 'embedding' | 'llm'
|
|
4536
4637
|
}
|