dd-trace 6.13.0 → 6.15.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/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/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 +8 -0
- package/package.json +13 -10
- package/packages/datadog-esbuild/index.js +3 -1
- 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/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 +265 -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 +14 -5
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +251 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +11 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +562 -27
- package/packages/datadog-instrumentations/src/jest.js +166 -45
- package/packages/datadog-instrumentations/src/knex.js +76 -0
- package/packages/datadog-instrumentations/src/mariadb.js +6 -0
- package/packages/datadog-instrumentations/src/mocha/common.js +59 -2
- package/packages/datadog-instrumentations/src/mocha/main.js +66 -20
- 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/playwright.js +113 -13
- 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 +37 -3
- package/packages/datadog-instrumentations/src/vitest-main.js +92 -9
- package/packages/datadog-instrumentations/src/vitest-worker.js +71 -14
- package/packages/datadog-instrumentations/src/webdriverio.js +965 -6
- 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-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-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-playwright/src/index.js +167 -27
- package/packages/datadog-plugin-undici/src/index.js +27 -41
- package/packages/datadog-plugin-vitest/src/index.js +6 -12
- package/packages/dd-trace/src/aiguard/evaluation.js +2 -1
- package/packages/dd-trace/src/aiguard/messages/anthropic.js +8 -1
- 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/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/command-sensitive-analyzer.js +3 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +531 -95
- 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/lambda.js +44 -26
- 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 +5 -173
- 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 +394 -225
- 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 +2 -1
- 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/request.js +11 -0
- 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 +180 -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 +4 -0
- package/packages/dd-trace/src/config/index.js +73 -13
- 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 +22 -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 +28 -0
- package/packages/dd-trace/src/debugger/devtools_client/send.js +7 -40
- 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 +510 -76
- 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 +3 -25
- package/packages/dd-trace/src/exporters/agent/index.js +2 -1
- package/packages/dd-trace/src/exporters/agent/writer.js +24 -7
- package/packages/dd-trace/src/exporters/agentless/index.js +7 -9
- package/packages/dd-trace/src/exporters/agentless/writer.js +103 -119
- 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/proxy.js +52 -0
- package/packages/dd-trace/src/exporters/common/request.js +42 -14
- package/packages/dd-trace/src/exporters/common/url.js +40 -1
- package/packages/dd-trace/src/exporters/common/writer.js +9 -7
- package/packages/dd-trace/src/flush.js +6 -3
- 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/dataset.js +2 -1
- package/packages/dd-trace/src/llmobs/index.js +32 -32
- 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/langchain/index.js +7 -0
- package/packages/dd-trace/src/llmobs/util.js +0 -33
- package/packages/dd-trace/src/llmobs/writers/base.js +49 -32
- package/packages/dd-trace/src/log/index.js +7 -1
- package/packages/dd-trace/src/{ci-visibility/log-submission → log-submission}/log-submission-plugin.js +48 -19
- package/packages/dd-trace/src/openfeature/writers/base.js +14 -12
- package/packages/dd-trace/src/openfeature/writers/util.js +1 -1
- package/packages/dd-trace/src/opentelemetry/logs/index.js +5 -24
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +14 -4
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +15 -22
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +14 -4
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +10 -0
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +5 -0
- 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/opentracing/propagation/text_map.js +101 -20
- package/packages/dd-trace/src/payload-tagging/index.js +2 -1
- 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/test.js +83 -20
- package/packages/dd-trace/src/plugins/util/url.js +2 -2
- package/packages/dd-trace/src/plugins/util/web.js +4 -9
- package/packages/dd-trace/src/priority_sampler.js +4 -0
- package/packages/dd-trace/src/profiling/config.js +1 -0
- package/packages/dd-trace/src/profiling/oom.js +7 -2
- package/packages/dd-trace/src/profiling/profiler.js +23 -13
- package/packages/dd-trace/src/profiling/profilers/space.js +38 -11
- package/packages/dd-trace/src/profiling/webspan-utils.js +7 -4
- package/packages/dd-trace/src/proxy.js +75 -5
- 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/otlp_runtime_metrics.js +5 -1
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +5 -1
- package/packages/dd-trace/src/sampling_rule.js +39 -10
- package/packages/dd-trace/src/serverless/telemetry-delivery-tracker.js +4 -8
- package/packages/dd-trace/src/serverless/vercel.js +53 -20
- package/packages/dd-trace/src/serverless.js +10 -3
- package/packages/dd-trace/src/service-naming/schemas/util.js +1 -1
- package/packages/dd-trace/src/span_processor.js +18 -3
- package/packages/dd-trace/src/span_stats.js +24 -28
- 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 +23 -20
- package/packages/dd-trace/src/telemetry/session-propagation.js +3 -2
- package/packages/dd-trace/src/tracer.js +4 -5
- package/packages/dd-trace/src/tracer_metadata.js +11 -3
- 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/encode/agentless-json.js +0 -210
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')
|
|
@@ -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) {
|
|
@@ -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
|
@@ -466,6 +466,13 @@ declare namespace tracer {
|
|
|
466
466
|
* Maximum number of traces matching this rule to sample per second.
|
|
467
467
|
*/
|
|
468
468
|
maxPerSecond?: number
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* When `true`, a trace chunk rejected by this rule is fully dropped:
|
|
472
|
+
* it is excluded from client-side stats and never sent to the Agent.
|
|
473
|
+
* @default false
|
|
474
|
+
*/
|
|
475
|
+
discard?: boolean
|
|
469
476
|
}
|
|
470
477
|
|
|
471
478
|
/**
|
|
@@ -650,6 +657,7 @@ declare namespace tracer {
|
|
|
650
657
|
* Sampling rules to apply to priority sampling. Each rule matches against a trace's
|
|
651
658
|
* `service`, `name`, `resource`, and `tags`, and applies the rule's `sampleRate`. Use a
|
|
652
659
|
* `sampleRate` of `0` to drop matching traces (for example to filter out unwanted resources).
|
|
660
|
+
* Specify `"discard": true` to fully drop it from stats as well.
|
|
653
661
|
* If not specified, will defer to global sampling rate for all spans.
|
|
654
662
|
* @default []
|
|
655
663
|
* @env DD_TRACE_SAMPLING_RULES
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.15.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"type:check": "tsc --noEmit -p tsconfig.dev.json",
|
|
23
23
|
"type:doc:build": "cd docs && yarn && yarn build",
|
|
24
24
|
"type:doc:test": "cd docs && yarn && yarn test",
|
|
25
|
-
"lint": "node scripts/check_licenses.js && node scripts/check-no-coverage-artifacts.js && node scripts/check-no-mcr-images.js && node scripts/check-docker-image-shas.js && eslint . --concurrency=auto --max-warnings 0 && npm run verify:carrier-fields && npm run lint:codeowners:ci && npm run verify-exercised-tests",
|
|
26
|
-
"lint:fix": "node scripts/check_licenses.js && node scripts/check-no-coverage-artifacts.js && node scripts/check-no-mcr-images.js && node scripts/check-docker-image-shas.js && eslint . --concurrency=auto --max-warnings 0 --fix",
|
|
25
|
+
"lint": "node scripts/check_licenses.js && node scripts/check-agents-md-size.js && node scripts/check-no-coverage-artifacts.js && node scripts/check-no-mcr-images.js && node scripts/check-docker-image-shas.js && eslint . --concurrency=auto --max-warnings 0 && npm run verify:carrier-fields && npm run lint:codeowners:ci && npm run verify-exercised-tests",
|
|
26
|
+
"lint:fix": "node scripts/check_licenses.js && node scripts/check-agents-md-size.js && node scripts/check-no-coverage-artifacts.js && node scripts/check-no-mcr-images.js && node scripts/check-docker-image-shas.js && eslint . --concurrency=auto --max-warnings 0 --fix",
|
|
27
27
|
"verify:carrier-fields": "node scripts/verify-carrier-fields.mjs",
|
|
28
28
|
"lint:inspect": "npx @eslint/config-inspector@latest",
|
|
29
29
|
"lint:codeowners": "codeowners-audit",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test:debugger": "mocha \"packages/dd-trace/test/debugger/**/*.spec.js\"",
|
|
42
42
|
"test:debugger:ci": "node scripts/c8-ci.js test:debugger",
|
|
43
43
|
"test:eslint-rules": "node scripts/run-eslint-rule-tests.mjs eslint-rules/*.test.mjs",
|
|
44
|
-
"test:trace:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/dd-trace/test/*.spec.js\" \"packages/dd-trace/test/{agent,ci-visibility,config,crashtracking,datastreams,encode,exporters,msgpack,opentelemetry,opentracing,payload-tagging,plugins,remote_config,service-naming,standalone,telemetry,external-logger}/**/*.spec.js\"",
|
|
44
|
+
"test:trace:core": "node scripts/mocha-parallel-files.js --expose-gc --timeout 30000 -- \"packages/dd-trace/test/*.spec.js\" \"packages/dd-trace/test/{agent,ci-visibility,config,crashtracking,datastreams,encode,exporters,log-submission,msgpack,opentelemetry,opentracing,payload-tagging,plugins,remote_config,service-naming,standalone,telemetry,external-logger}/**/*.spec.js\"",
|
|
45
45
|
"test:trace:core:ci": "node scripts/c8-ci.js test:trace:core",
|
|
46
46
|
"test:trace:guardrails": "mocha \"packages/dd-trace/test/guardrails/**/*.spec.js\"",
|
|
47
47
|
"test:trace:guardrails:ci": "node scripts/c8-ci.js test:trace:guardrails",
|
|
@@ -183,7 +183,8 @@
|
|
|
183
183
|
"opentracing": ">=0.14.7"
|
|
184
184
|
},
|
|
185
185
|
"optionalDependencies": {
|
|
186
|
-
"@datadog/libdatadog": "0.
|
|
186
|
+
"@datadog/libdatadog": "^0.21.0",
|
|
187
|
+
"@datadog/libdatadog-extras": "^0.21.0",
|
|
187
188
|
"@datadog/native-appsec": "11.0.2",
|
|
188
189
|
"@datadog/native-iast-taint-tracking": "4.2.1",
|
|
189
190
|
"@datadog/native-metrics": "4.0.0",
|
|
@@ -210,26 +211,28 @@
|
|
|
210
211
|
"@types/sinon": "^22.0.0",
|
|
211
212
|
"@vercel/nft": "^1.11.0",
|
|
212
213
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
213
|
-
"axios": "^1.
|
|
214
|
+
"axios": "^1.20.0",
|
|
214
215
|
"benchmark": "^2.1.4",
|
|
215
216
|
"body-parser": "^2.3.0",
|
|
216
217
|
"bun": "1.4.0",
|
|
217
218
|
"c8": "^12.0.0",
|
|
218
219
|
"codeowners-audit": "^2.9.0",
|
|
219
|
-
"eslint": "^10.
|
|
220
|
-
"eslint-plugin-cypress": "^7.0.
|
|
220
|
+
"eslint": "^10.9.1",
|
|
221
|
+
"eslint-plugin-cypress": "^7.0.1",
|
|
221
222
|
"eslint-plugin-import-x": "^4.16.2",
|
|
222
223
|
"eslint-plugin-jsdoc": "^64.2.1",
|
|
223
|
-
"eslint-plugin-mocha": "^
|
|
224
|
+
"eslint-plugin-mocha": "^12.0.2",
|
|
224
225
|
"eslint-plugin-n": "^18.3.0",
|
|
225
226
|
"eslint-plugin-promise": "^7.3.0",
|
|
227
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
226
228
|
"eslint-plugin-sonarjs": "^4.2.0",
|
|
227
|
-
"eslint-plugin-unicorn": "^
|
|
229
|
+
"eslint-plugin-unicorn": "^74.0.0",
|
|
228
230
|
"express": "^5.1.0",
|
|
229
231
|
"glob": "^10.4.5",
|
|
230
232
|
"globals": "^17.11.0",
|
|
231
233
|
"graphql": "*",
|
|
232
234
|
"husky": "^9.1.7",
|
|
235
|
+
"istanbul-lib-coverage": "^3.2.2",
|
|
233
236
|
"istanbul-lib-report": "^3.0.0",
|
|
234
237
|
"istanbul-reports": "^3.0.2",
|
|
235
238
|
"jsonc-parser": "^3.3.1",
|
|
@@ -370,7 +370,9 @@ register(${JSON.stringify(toRegister)}, _, set, get, ${JSON.stringify(data.raw)}
|
|
|
370
370
|
return {
|
|
371
371
|
contents,
|
|
372
372
|
loader: 'js',
|
|
373
|
-
resolveDir:
|
|
373
|
+
resolveDir: data.internal
|
|
374
|
+
? build.initialOptions.absWorkingDir ?? process.cwd()
|
|
375
|
+
: path.dirname(args.path),
|
|
374
376
|
}
|
|
375
377
|
}
|
|
376
378
|
if (DD_IAST_ENABLED && args.pluginData?.applicationFile) {
|
|
@@ -67,7 +67,13 @@ function formatFileSystemError (error, fallbackPath) {
|
|
|
67
67
|
* @returns {void}
|
|
68
68
|
*/
|
|
69
69
|
function warnFileCreationFailures (artifact, failures, consequence, customerVisible = false) {
|
|
70
|
-
|
|
70
|
+
let details = ''
|
|
71
|
+
let isFirstFailure = true
|
|
72
|
+
for (const { directory, error } of failures) {
|
|
73
|
+
if (!isFirstFailure) details += '; '
|
|
74
|
+
details += formatFileSystemError(error, directory)
|
|
75
|
+
isFirstFailure = false
|
|
76
|
+
}
|
|
71
77
|
const message = 'Datadog could not create %s. Attempts failed: %s. %s'
|
|
72
78
|
|
|
73
79
|
if (customerVisible) {
|
|
@@ -790,22 +796,18 @@ function createConfigWrapper (originalConfigFile, wrapperDirectory) {
|
|
|
790
796
|
// supported. Guards against ES-module-default shape so TS-authored
|
|
791
797
|
// configs using `export default` still work.
|
|
792
798
|
const body = isEsm
|
|
793
|
-
?
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
' : originalExports',
|
|
806
|
-
'module.exports = cypressConfig.wrapConfig(originalConfig)',
|
|
807
|
-
'',
|
|
808
|
-
].join('\n')
|
|
799
|
+
? `import originalConfig from ${JSON.stringify(pathToFileURL(originalConfigFile).href)}
|
|
800
|
+
import cypressConfig from ${JSON.stringify(pathToFileURL(cypressConfigPath).href)}
|
|
801
|
+
|
|
802
|
+
export default cypressConfig.wrapConfig(originalConfig)
|
|
803
|
+
`
|
|
804
|
+
: `const cypressConfig = require(${JSON.stringify(cypressConfigPath)})
|
|
805
|
+
const originalExports = require(${JSON.stringify(originalConfigFile)})
|
|
806
|
+
const originalConfig = originalExports && originalExports.__esModule
|
|
807
|
+
? originalExports.default
|
|
808
|
+
: originalExports
|
|
809
|
+
module.exports = cypressConfig.wrapConfig(originalConfig)
|
|
810
|
+
`
|
|
809
811
|
|
|
810
812
|
writeExclusiveFile(wrapperFile, body)
|
|
811
813
|
return wrapperFile
|
|
@@ -191,32 +191,36 @@ function wrapCreateStream (original) {
|
|
|
191
191
|
const ctx = getMessage(name, ['path', 'options'], arguments)
|
|
192
192
|
|
|
193
193
|
return startChannel.runStores(ctx, () => {
|
|
194
|
-
|
|
195
|
-
const stream = original.apply(this, arguments)
|
|
196
|
-
const onError = error => {
|
|
197
|
-
ctx.error = error
|
|
198
|
-
errorChannel.publish(ctx)
|
|
199
|
-
onFinish()
|
|
200
|
-
}
|
|
201
|
-
const onFinish = () => {
|
|
202
|
-
finishChannel.runStores(ctx, () => {})
|
|
203
|
-
stream.removeListener('close', onFinish)
|
|
204
|
-
stream.removeListener('end', onFinish)
|
|
205
|
-
stream.removeListener('finish', onFinish)
|
|
206
|
-
stream.removeListener(errorMonitor, onError)
|
|
207
|
-
}
|
|
194
|
+
let stream
|
|
208
195
|
|
|
209
|
-
|
|
210
|
-
stream.
|
|
211
|
-
stream.once('finish', onFinish)
|
|
212
|
-
stream.once(errorMonitor, onError)
|
|
213
|
-
|
|
214
|
-
return stream
|
|
196
|
+
try {
|
|
197
|
+
stream = original.apply(this, arguments)
|
|
215
198
|
} catch (error) {
|
|
216
199
|
ctx.error = error
|
|
217
200
|
errorChannel.publish(ctx)
|
|
218
201
|
finishChannel.runStores(ctx, () => {})
|
|
202
|
+
throw error
|
|
219
203
|
}
|
|
204
|
+
|
|
205
|
+
const onError = error => {
|
|
206
|
+
ctx.error = error
|
|
207
|
+
errorChannel.publish(ctx)
|
|
208
|
+
onFinish()
|
|
209
|
+
}
|
|
210
|
+
const onFinish = () => {
|
|
211
|
+
finishChannel.runStores(ctx, () => {})
|
|
212
|
+
stream.removeListener('close', onFinish)
|
|
213
|
+
stream.removeListener('end', onFinish)
|
|
214
|
+
stream.removeListener('finish', onFinish)
|
|
215
|
+
stream.removeListener(errorMonitor, onError)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
stream.once('close', onFinish)
|
|
219
|
+
stream.once('end', onFinish)
|
|
220
|
+
stream.once('finish', onFinish)
|
|
221
|
+
stream.once(errorMonitor, onError)
|
|
222
|
+
|
|
223
|
+
return stream
|
|
220
224
|
})
|
|
221
225
|
}
|
|
222
226
|
}
|
|
@@ -13,7 +13,7 @@ function wrapGenerate (generate) {
|
|
|
13
13
|
const ctx = {
|
|
14
14
|
request,
|
|
15
15
|
instance: this,
|
|
16
|
-
resource:
|
|
16
|
+
resource: `${this.constructor.name}.${generate.name}`,
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return vertexaiTracingChannel.tracePromise(generate, ctx, this, ...arguments)
|
|
@@ -29,7 +29,7 @@ function wrapGenerateStream (generateStream) {
|
|
|
29
29
|
const ctx = {
|
|
30
30
|
request,
|
|
31
31
|
instance: this,
|
|
32
|
-
resource:
|
|
32
|
+
resource: `${this.constructor.name}.${generateStream.name}`,
|
|
33
33
|
stream: true,
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -3,26 +3,26 @@
|
|
|
3
3
|
const { addHook, getHooks } = require('./helpers/instrument')
|
|
4
4
|
|
|
5
5
|
// Orchestrion rewriter handles wrapping of:
|
|
6
|
-
// - graphql: execute, parse, validate (CJS + ESM)
|
|
7
|
-
// - @graphql-tools/executor: execute, normalizedExecutor (CJS + ESM)
|
|
6
|
+
// - graphql: execute, locatedError, parse, validate (CJS + ESM)
|
|
7
|
+
// - @graphql-tools/executor: execute, handleFieldError, normalizedExecutor (CJS + ESM)
|
|
8
8
|
// See helpers/rewriter/instrumentations/graphql.js for the full config.
|
|
9
|
-
//
|
|
10
|
-
// The plugin (packages/datadog-plugin-graphql/src/execute.js) handles the
|
|
11
|
-
// `apm:graphql:execute:start` AppSec/WAF contract from inside its bindStart:
|
|
12
|
-
// publishing the channel synchronously runs subscribers, and an
|
|
13
|
-
// `abortController.abort()` from a subscriber is observed by replacing
|
|
14
|
-
// `ctx.arguments[0]` with an object whose getters throw AbortError. The
|
|
15
|
-
// orchestrion-emitted wrapper's `catch { ...; throw err }` block propagates
|
|
16
|
-
// that throw to the caller of graphql.execute. No outer wrap needed.
|
|
17
|
-
|
|
18
|
-
for (const hook of getHooks('graphql')) {
|
|
19
|
-
addHook(hook, exports => exports)
|
|
20
|
-
}
|
|
21
9
|
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} name
|
|
12
|
+
*/
|
|
13
|
+
function addRewriterHooks (name) {
|
|
14
|
+
const files = new Set()
|
|
15
|
+
for (const hook of getHooks(name)) {
|
|
16
|
+
if (files.has(hook.file)) continue
|
|
17
|
+
files.add(hook.file)
|
|
18
|
+
addHook(hook, exports => exports)
|
|
19
|
+
}
|
|
24
20
|
}
|
|
25
21
|
|
|
22
|
+
addRewriterHooks('graphql')
|
|
23
|
+
addRewriterHooks('@graphql-tools/executor')
|
|
24
|
+
addRewriterHooks('graphql-jit')
|
|
25
|
+
|
|
26
26
|
// Module-load hooks: capture references on ddGlobal for cross-plugin access
|
|
27
27
|
// (read lazily inside each callback so agent.load() between mocha suites can
|
|
28
28
|
// rebind globalThis[dd-trace] without us stashing a stale reference).
|