dd-trace 5.116.0 → 5.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ci/diagnose.js +162 -21
- package/ci/init.js +0 -1
- package/ci/runbook.md +187 -180
- package/ci/test-optimization-validation/approval-artifacts.js +3 -1
- package/ci/test-optimization-validation/approval.js +52 -15
- package/ci/test-optimization-validation/ci-command-candidate.js +26 -32
- package/ci/test-optimization-validation/ci-discovery.js +1 -1
- package/ci/test-optimization-validation/ci-package-scripts.js +141 -0
- package/ci/test-optimization-validation/ci-remediation.js +112 -39
- package/ci/test-optimization-validation/cli.js +516 -681
- package/ci/test-optimization-validation/command-blocker.js +188 -33
- package/ci/test-optimization-validation/command-output-policy.js +3 -26
- package/ci/test-optimization-validation/command-runner.js +189 -245
- package/ci/test-optimization-validation/environment.js +90 -0
- package/ci/test-optimization-validation/executable.js +159 -388
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +119 -0
- package/ci/test-optimization-validation/framework-adapters/cypress.js +107 -0
- package/ci/test-optimization-validation/framework-adapters/playwright.js +181 -0
- package/ci/test-optimization-validation/generated-files.js +75 -13
- package/ci/test-optimization-validation/generated-test-contract.js +283 -0
- package/ci/test-optimization-validation/generated-verifier.js +49 -16
- package/ci/test-optimization-validation/literal-environment.js +57 -0
- package/ci/test-optimization-validation/manifest-loader.js +2 -22
- package/ci/test-optimization-validation/manifest-scaffold.js +816 -515
- package/ci/test-optimization-validation/manifest-schema.js +494 -702
- package/ci/test-optimization-validation/offline-fixtures.js +4 -1
- package/ci/test-optimization-validation/plan-writer.js +243 -984
- package/ci/test-optimization-validation/preflight-runner.js +49 -55
- package/ci/test-optimization-validation/redaction.js +2 -1
- package/ci/test-optimization-validation/report-writer.js +391 -1357
- package/ci/test-optimization-validation/result-semantics.js +86 -0
- package/ci/test-optimization-validation/runner-command.js +249 -0
- package/ci/test-optimization-validation/runner-contract.js +664 -0
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +29 -3
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +240 -543
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +450 -670
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +4 -3
- package/ci/test-optimization-validation/scenarios/helpers.js +67 -9
- package/ci/test-optimization-validation/scenarios/test-management.js +4 -3
- package/ci/test-optimization-validation/source-text.js +87 -0
- package/ci/test-optimization-validation/test-output.js +12 -22
- package/ext/tags.d.ts +1 -0
- package/index.d.ts +7 -0
- package/package.json +3 -3
- package/packages/datadog-instrumentations/src/cucumber.js +11 -12
- package/packages/datadog-instrumentations/src/helpers/channel.js +74 -0
- package/packages/datadog-instrumentations/src/helpers/hooks.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents.js +31 -0
- package/packages/datadog-instrumentations/src/jest.js +18 -17
- package/packages/datadog-instrumentations/src/mocha/main.js +79 -30
- package/packages/datadog-instrumentations/src/openai-agents.js +159 -0
- package/packages/datadog-instrumentations/src/playwright.js +3 -24
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +1 -1
- package/packages/datadog-instrumentations/src/vitest-main.js +14 -26
- package/packages/datadog-instrumentations/src/vitest-util.js +0 -7
- package/packages/datadog-instrumentations/src/vitest-worker.js +5 -8
- package/packages/datadog-plugin-cucumber/src/index.js +2 -1
- package/packages/datadog-plugin-mocha/src/index.js +2 -1
- package/packages/datadog-plugin-openai-agents/src/index.js +74 -0
- package/packages/datadog-plugin-openai-agents/src/integration.js +503 -0
- package/packages/datadog-plugin-openai-agents/src/processor.js +108 -0
- package/packages/datadog-plugin-openai-agents/src/util.js +60 -0
- package/packages/datadog-plugin-playwright/src/index.js +4 -1
- package/packages/datadog-plugin-vitest/src/index.js +5 -5
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +48 -49
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +161 -33
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +6 -4
- package/packages/dd-trace/src/config/generated-config-types.d.ts +2 -0
- package/packages/dd-trace/src/config/supported-configurations.json +7 -0
- package/packages/dd-trace/src/encode/span-stats.js +7 -1
- package/packages/dd-trace/src/exporter.js +16 -9
- package/packages/dd-trace/src/llmobs/index.js +9 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +104 -22
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +5 -9
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +20 -0
- package/packages/dd-trace/src/llmobs/plugins/openai-agents/utils.js +321 -0
- package/packages/dd-trace/src/llmobs/sdk.js +2 -1
- package/packages/dd-trace/src/llmobs/span_processor.js +7 -2
- package/packages/dd-trace/src/llmobs/tagger.js +23 -3
- package/packages/dd-trace/src/llmobs/util.js +56 -3
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +3 -6
- package/packages/dd-trace/src/openfeature/configuration_source.js +5 -8
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +5 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +9 -3
- package/packages/dd-trace/src/plugins/index.js +1 -0
- package/packages/dd-trace/src/plugins/outbound.js +4 -1
- package/packages/dd-trace/src/profiling/profilers/space.js +1 -1
- package/packages/dd-trace/src/profiling/profilers/wall.js +1 -0
- package/packages/dd-trace/src/span_processor.js +1 -1
- package/packages/dd-trace/src/span_stats.js +22 -4
- package/ci/test-optimization-validation/command-suitability.js +0 -471
- package/ci/test-optimization-validation/init-probe-preload.js +0 -163
- package/ci/test-optimization-validation/init-probe.js +0 -246
- package/ci/test-optimization-validation/late-initialization.js +0 -63
- package/ci/test-optimization-validation/local-command.js +0 -163
- package/ci/test-optimization-validation/setup-runner.js +0 -97
- package/ci/test-optimization-validation-manifest.schema.json +0 -1
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
const { getCommandBlocker } = require('./command-blocker')
|
|
4
4
|
const { runCommand, serializeDisplayCommand } = require('./command-runner')
|
|
5
|
-
const {
|
|
6
|
-
const {
|
|
7
|
-
const { frameworkOutDir } = require('./scenarios/helpers')
|
|
5
|
+
const { getBasicCommand } = require('./runner-command')
|
|
6
|
+
const { summarizeTestOutput } = require('./scenarios/basic-reporting')
|
|
7
|
+
const { findInterestingLines, frameworkOutDir } = require('./scenarios/helpers')
|
|
8
8
|
const { getObservedTestCount } = require('./test-output')
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Runs
|
|
11
|
+
* Runs one direct representative test without Datadog initialization.
|
|
12
12
|
*
|
|
13
13
|
* @param {object} input preflight inputs
|
|
14
|
-
* @param {object} input.framework manifest
|
|
14
|
+
* @param {object} input.framework framework manifest entry
|
|
15
15
|
* @param {string} input.out validation output directory
|
|
16
16
|
* @param {object} input.options validator options
|
|
17
17
|
* @returns {Promise<{ok: boolean, failure?: object, preflight: object}>} preflight outcome
|
|
18
18
|
*/
|
|
19
19
|
async function runFrameworkPreflight ({ framework, out, options }) {
|
|
20
|
-
const
|
|
21
|
-
const command = getDatadogCleanCommand(getBasicReportingCommand(framework))
|
|
20
|
+
const command = getBasicCommand(framework)
|
|
22
21
|
const outDir = frameworkOutDir(out, framework, 'preflight')
|
|
23
22
|
const result = await runCommand(command, {
|
|
24
23
|
artifactRoot: out,
|
|
@@ -30,49 +29,52 @@ async function runFrameworkPreflight ({ framework, out, options }) {
|
|
|
30
29
|
verbose: options.verbose,
|
|
31
30
|
})
|
|
32
31
|
const observedTestCount = getObservedTestCount(framework.framework, result.stdout, result.stderr)
|
|
32
|
+
const commandFailure = getCommandBlocker(result, {
|
|
33
|
+
browserRequired: framework.browserRequired,
|
|
34
|
+
framework: framework.framework,
|
|
35
|
+
testsRan: Number.isInteger(observedTestCount) && observedTestCount > 0,
|
|
36
|
+
})
|
|
33
37
|
const preflight = {
|
|
34
|
-
ran: true,
|
|
35
|
-
source: 'validator',
|
|
36
|
-
maxTestCount,
|
|
37
38
|
command: serializeDisplayCommand(command),
|
|
38
|
-
|
|
39
|
+
diagnosticSummary: findInterestingLines(`${result.stdout}\n${result.stderr}`, [
|
|
40
|
+
/\b(?:Abort trap|Cannot find|Error|ERR_[A-Z_]+|Failed to|Received signal|SIGABRT)\b/i,
|
|
41
|
+
], 4),
|
|
39
42
|
durationMs: result.durationMs,
|
|
43
|
+
exitCode: result.exitCode,
|
|
40
44
|
observedTestCount,
|
|
41
|
-
|
|
45
|
+
ran: true,
|
|
46
|
+
selectorVerification: framework.validation.selectorScope === 'instrumented_event_identity'
|
|
47
|
+
? 'requires_instrumented_event_identity'
|
|
48
|
+
: 'bounded_direct_runner',
|
|
49
|
+
source: 'validator',
|
|
42
50
|
stderrSummary: summarizeTestOutput('', result.stderr).join('\n'),
|
|
51
|
+
stdoutSummary: summarizeTestOutput(result.stdout).join('\n'),
|
|
52
|
+
timedOut: result.timedOut,
|
|
53
|
+
...(commandFailure ? { commandFailure } : {}),
|
|
43
54
|
}
|
|
44
55
|
framework.preflight = preflight
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
const scopeMatched = testCountKnown && observedTestCount >= 1 && observedTestCount <= maxTestCount
|
|
48
|
-
preflight.scopeMatched = scopeMatched
|
|
49
|
-
|
|
50
|
-
if (!result.timedOut && scopeMatched && (result.exitCode === 0 || observedTestCount > 0)) {
|
|
57
|
+
if (!result.timedOut && result.exitCode === 0 && observedTestCount !== 0) {
|
|
51
58
|
return { ok: true, preflight }
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
testCountKnown,
|
|
60
|
-
})
|
|
61
|
-
|
|
61
|
+
const domain = commandFailure?.blockedByExecutionEnvironment
|
|
62
|
+
? 'execution_environment'
|
|
63
|
+
: commandFailure?.localRuntimeBlocked
|
|
64
|
+
? 'local_runtime'
|
|
65
|
+
: 'project_setup'
|
|
62
66
|
return {
|
|
63
67
|
ok: false,
|
|
64
68
|
preflight,
|
|
65
69
|
failure: {
|
|
66
70
|
frameworkId: framework.id,
|
|
67
71
|
scenario: 'basic-reporting',
|
|
68
|
-
status:
|
|
69
|
-
diagnosis,
|
|
72
|
+
status: 'blocked',
|
|
73
|
+
diagnosis: getFailureDiagnosis(result, observedTestCount, commandFailure),
|
|
70
74
|
evidence: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
...(commandFailure ? { commandFailure } : {}),
|
|
75
|
-
preflight,
|
|
75
|
+
commandFailure,
|
|
76
|
+
domain,
|
|
77
|
+
validationIncomplete: true,
|
|
76
78
|
},
|
|
77
79
|
artifacts: Object.values(result.artifacts),
|
|
78
80
|
},
|
|
@@ -80,35 +82,27 @@ async function runFrameworkPreflight ({ framework, out, options }) {
|
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
/**
|
|
83
|
-
*
|
|
85
|
+
* Explains why direct Basic Reporting could not start reliably.
|
|
84
86
|
*
|
|
85
|
-
* @param {object}
|
|
86
|
-
* @param {number}
|
|
87
|
-
* @param {
|
|
88
|
-
* @param {object} input.result command result
|
|
89
|
-
* @param {boolean} input.testCountKnown whether the test count was parsed
|
|
87
|
+
* @param {object} result command result
|
|
88
|
+
* @param {number|null} observedTestCount parsed test count
|
|
89
|
+
* @param {object|undefined} commandFailure classified blocker
|
|
90
90
|
* @returns {string} customer-facing diagnosis
|
|
91
91
|
*/
|
|
92
|
-
function
|
|
93
|
-
if (
|
|
94
|
-
return
|
|
95
|
-
'Optimization conclusion was reached.'
|
|
92
|
+
function getFailureDiagnosis (result, observedTestCount, commandFailure) {
|
|
93
|
+
if (commandFailure?.summary) {
|
|
94
|
+
return `${commandFailure.summary} Basic Reporting could not be tested reliably.`
|
|
96
95
|
}
|
|
97
|
-
if (
|
|
98
|
-
return 'The
|
|
99
|
-
|
|
100
|
-
'reports the test count before validating Test Optimization.'
|
|
101
|
-
}
|
|
102
|
-
if (observedTestCount > maxTestCount) {
|
|
103
|
-
return `The selected command ran ${observedTestCount} tests, exceeding the approved representative scope ` +
|
|
104
|
-
`of at most ${maxTestCount}. Select a narrower test command before validating Test Optimization.`
|
|
96
|
+
if (result.timedOut) {
|
|
97
|
+
return 'The direct representative test exceeded its approved timeout. Basic Reporting could not be tested ' +
|
|
98
|
+
'reliably; rerun the test normally and confirm its prerequisites before trying again.'
|
|
105
99
|
}
|
|
106
|
-
if (observedTestCount
|
|
107
|
-
return 'The
|
|
108
|
-
'
|
|
100
|
+
if (observedTestCount === 0) {
|
|
101
|
+
return 'The direct runner completed without reporting a test. The selected file may require project wrapper or ' +
|
|
102
|
+
'configuration semantics, so Basic Reporting remains incomplete.'
|
|
109
103
|
}
|
|
110
|
-
return
|
|
111
|
-
'
|
|
104
|
+
return `The direct representative test exited ${result.exitCode} without Datadog initialization. Fix or prepare ` +
|
|
105
|
+
'that test normally, then create a fresh validation plan.'
|
|
112
106
|
}
|
|
113
107
|
|
|
114
108
|
module.exports = { runFrameworkPreflight }
|
|
@@ -276,7 +276,8 @@ function sanitizeValue (value, seen, key, depth) {
|
|
|
276
276
|
|
|
277
277
|
const sanitized = {}
|
|
278
278
|
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
279
|
-
if (isSensitiveName(entryKey) && !SECRET_NAME_ONLY_KEYS.has(entryKey)
|
|
279
|
+
if (isSensitiveName(entryKey) && !SECRET_NAME_ONLY_KEYS.has(entryKey) &&
|
|
280
|
+
typeof entryValue !== 'boolean') {
|
|
280
281
|
sanitized[entryKey] = REDACTED
|
|
281
282
|
continue
|
|
282
283
|
}
|