dd-trace 5.123.0 → 6.11.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 +0 -5
- package/index.d.ts +25 -240
- package/package.json +18 -19
- package/packages/datadog-instrumentations/src/cucumber.js +4 -4
- package/packages/datadog-instrumentations/src/mocha/utils.js +2 -5
- package/packages/datadog-instrumentations/src/playwright-reporter.js +1 -149
- package/packages/datadog-instrumentations/src/playwright.js +33 -33
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +8 -6
- package/packages/datadog-plugin-playwright/src/index.js +0 -4
- package/packages/dd-trace/src/appsec/reporter.js +0 -2
- package/packages/dd-trace/src/appsec/telemetry/index.js +0 -13
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +0 -16
- package/packages/dd-trace/src/appsec/telemetry/waf.js +0 -24
- package/packages/dd-trace/src/carrier.js +48 -107
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +5 -5
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +0 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +3 -5
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -4
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +4 -6
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +3 -5
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -4
- package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +2 -4
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +2 -4
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +5 -5
- package/packages/dd-trace/src/debugger/constants.js +0 -1
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +10 -3
- package/packages/dd-trace/src/debugger/index.js +2 -4
- package/packages/dd-trace/src/exporters/common/request.js +2 -5
- package/packages/dd-trace/src/llmobs/experiments/client.js +2 -6
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +11 -249
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -23
- package/packages/dd-trace/src/llmobs/experiments/index.js +6 -18
- package/packages/dd-trace/src/llmobs/experiments/noop.js +4 -64
- package/packages/dd-trace/src/llmobs/experiments/util.js +4 -60
- package/packages/dd-trace/src/openfeature/constants/constants.js +18 -0
- package/packages/dd-trace/src/openfeature/index.js +4 -7
- package/packages/dd-trace/src/openfeature/writers/base.js +11 -153
- package/packages/dd-trace/src/openfeature/writers/exposures.js +14 -62
- package/packages/dd-trace/src/openfeature/writers/util.js +15 -97
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +13 -22
- package/packages/dd-trace/src/telemetry/metrics.js +8 -62
- package/packages/dd-trace/src/telemetry/send-data.js +0 -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/dd-trace/src/debugger/inspect-segment.js +0 -154
- package/packages/dd-trace/src/evp_proxy/constants.js +0 -8
- package/packages/dd-trace/src/evp_proxy/direct.js +0 -64
- package/packages/dd-trace/src/evp_proxy/discovery.js +0 -133
- package/packages/dd-trace/src/evp_proxy/path.js +0 -22
- package/vendor/dist/https-proxy-agent/LICENSE +0 -22
- package/vendor/dist/https-proxy-agent/index.js +0 -4
- package/vendor/dist/proxy-from-env/LICENSE +0 -20
- package/vendor/dist/proxy-from-env/index.js +0 -1
|
@@ -299,9 +299,6 @@ function retryTest (test, numRetries, tags, retryPolicy) {
|
|
|
299
299
|
clonedTest[tag] = true
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
if (clonedTest._ddIsQuarantined && !clonedTest._ddIsAttemptToFix) {
|
|
303
|
-
testsQuarantined.add(clonedTest)
|
|
304
|
-
}
|
|
305
302
|
}
|
|
306
303
|
}
|
|
307
304
|
|
|
@@ -1149,7 +1146,7 @@ function getRunTestsWrapper (runTests, config) {
|
|
|
1149
1146
|
retryTest(
|
|
1150
1147
|
test,
|
|
1151
1148
|
config.earlyFlakeDetectionRetryPolicy.schedulingRetryCount,
|
|
1152
|
-
['_ddIsModified', '_ddIsEfdRetry'
|
|
1149
|
+
['_ddIsModified', '_ddIsEfdRetry'],
|
|
1153
1150
|
config.earlyFlakeDetectionRetryPolicy
|
|
1154
1151
|
)
|
|
1155
1152
|
}
|
|
@@ -1168,7 +1165,7 @@ function getRunTestsWrapper (runTests, config) {
|
|
|
1168
1165
|
retryTest(
|
|
1169
1166
|
test,
|
|
1170
1167
|
config.earlyFlakeDetectionRetryPolicy.schedulingRetryCount,
|
|
1171
|
-
['_ddIsNew', '_ddIsEfdRetry'
|
|
1168
|
+
['_ddIsNew', '_ddIsEfdRetry'],
|
|
1172
1169
|
config.earlyFlakeDetectionRetryPolicy
|
|
1173
1170
|
)
|
|
1174
1171
|
}
|
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
const { channel } = require('dc-polyfill')
|
|
4
4
|
|
|
5
5
|
const reporterErrorCh = channel('ci:playwright:reporter:error')
|
|
6
|
-
const reporterRunSummaryCh = channel('ci:playwright:reporter:run-summary')
|
|
7
|
-
const reporterSuiteHookErrorCh = channel('ci:playwright:reporter:suite-hook-error')
|
|
8
|
-
const suitesWithHookErrors = new Set()
|
|
9
6
|
const PLAYWRIGHT_REPORTER_ERROR_MESSAGE = 'Error in reporter'
|
|
10
7
|
const PLAYWRIGHT_REPORTER_ERROR_CALLER_RE =
|
|
11
8
|
/^\s*at wrapAsync .*?[\\/]playwright[\\/]lib[\\/]runner[\\/]index\.js:\d+:\d+\)?$/
|
|
@@ -30,53 +27,7 @@ function isPlaywrightReporterError (message) {
|
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
/**
|
|
34
|
-
* Returns whether a finalized Playwright result contains a failed suite hook.
|
|
35
|
-
*
|
|
36
|
-
* @param {Array<object>} steps
|
|
37
|
-
* @returns {boolean}
|
|
38
|
-
*/
|
|
39
|
-
function hasFailedSuiteHook (steps) {
|
|
40
|
-
if (!steps) return false
|
|
41
|
-
|
|
42
|
-
for (const step of steps) {
|
|
43
|
-
if (step.error && (step.title === 'beforeAll hook' || step.title === 'afterAll hook')) return true
|
|
44
|
-
if (hasFailedSuiteHook(step.steps)) return true
|
|
45
|
-
}
|
|
46
|
-
return false
|
|
47
|
-
}
|
|
48
|
-
|
|
49
30
|
class DatadogPlaywrightReporter {
|
|
50
|
-
/**
|
|
51
|
-
* Creates a reporter that observes the finalized Playwright result independently of user reporters.
|
|
52
|
-
*
|
|
53
|
-
* @param {object} [options]
|
|
54
|
-
* @param {boolean} [options.captureReporterErrors]
|
|
55
|
-
*/
|
|
56
|
-
constructor ({ captureReporterErrors = true } = {}) {
|
|
57
|
-
this.captureReporterErrors = captureReporterErrors
|
|
58
|
-
this.fatalErrorCount = 0
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Identifies this reporter as implementing Playwright's reporter v2 contract.
|
|
63
|
-
*
|
|
64
|
-
* @returns {'v2'}
|
|
65
|
-
*/
|
|
66
|
-
version () {
|
|
67
|
-
return 'v2'
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
72
|
-
*
|
|
73
|
-
* @param {object} config
|
|
74
|
-
* @returns {void}
|
|
75
|
-
*/
|
|
76
|
-
onConfigure (config) {
|
|
77
|
-
this.failOnFlakyTests = config.failOnFlakyTests
|
|
78
|
-
}
|
|
79
|
-
|
|
80
31
|
/**
|
|
81
32
|
* Restores console error after Playwright completes the reporter lifecycle.
|
|
82
33
|
*
|
|
@@ -94,96 +45,12 @@ class DatadogPlaywrightReporter {
|
|
|
94
45
|
DatadogPlaywrightReporter.originalConsoleError = undefined
|
|
95
46
|
}
|
|
96
47
|
|
|
97
|
-
/**
|
|
98
|
-
* Records the suite so finalized test outcomes can be counted in onEnd.
|
|
99
|
-
*
|
|
100
|
-
* @param {object} configOrSuite
|
|
101
|
-
* @param {object} [suite]
|
|
102
|
-
* @returns {void}
|
|
103
|
-
*/
|
|
104
|
-
onBegin (configOrSuite, suite) {
|
|
105
|
-
this.suite = suite || configOrSuite
|
|
106
|
-
if (suite) this.failOnFlakyTests = configOrSuite.failOnFlakyTests
|
|
107
|
-
suitesWithHookErrors.clear()
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
112
|
-
*
|
|
113
|
-
* @returns {void}
|
|
114
|
-
*/
|
|
115
|
-
onTestBegin () {}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
119
|
-
*
|
|
120
|
-
* @returns {void}
|
|
121
|
-
*/
|
|
122
|
-
onStdOut () {}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
126
|
-
*
|
|
127
|
-
* @returns {void}
|
|
128
|
-
*/
|
|
129
|
-
onStdErr () {}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
133
|
-
*
|
|
134
|
-
* @returns {void}
|
|
135
|
-
*/
|
|
136
|
-
onTestEnd () {}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
140
|
-
*
|
|
141
|
-
* @returns {void}
|
|
142
|
-
*/
|
|
143
|
-
onStepBegin () {}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
147
|
-
*
|
|
148
|
-
* @returns {void}
|
|
149
|
-
*/
|
|
150
|
-
onStepEnd () {}
|
|
151
|
-
|
|
152
48
|
/**
|
|
153
49
|
* Marks the beginning of reporter finalization so later reporter errors can be identified.
|
|
154
50
|
*
|
|
155
51
|
* @returns {void}
|
|
156
52
|
*/
|
|
157
53
|
onEnd () {
|
|
158
|
-
let failureCount = this.fatalErrorCount
|
|
159
|
-
let quarantinedFailureCount = 0
|
|
160
|
-
let hasIncompleteTests = suitesWithHookErrors.size > 0
|
|
161
|
-
const tests = this.suite?.allTests?.()
|
|
162
|
-
if (tests) {
|
|
163
|
-
for (const test of tests) {
|
|
164
|
-
const outcome = test.outcome()
|
|
165
|
-
const finalResult = test.results.at(-1)
|
|
166
|
-
hasIncompleteTests ||= hasFailedSuiteHook(finalResult?.steps)
|
|
167
|
-
if (outcome === 'unexpected' || (outcome === 'flaky' && this.failOnFlakyTests)) {
|
|
168
|
-
failureCount += 1
|
|
169
|
-
const finalResultStatus = finalResult?.status
|
|
170
|
-
const hasFailed = finalResultStatus === 'failed' || finalResultStatus === 'timedOut'
|
|
171
|
-
if (outcome === 'unexpected' && hasFailed && test._ddIsQuarantined && !test._ddIsAttemptToFix) {
|
|
172
|
-
quarantinedFailureCount += 1
|
|
173
|
-
}
|
|
174
|
-
} else if (outcome === 'skipped' && !test._ddShouldSkipEfdRetry &&
|
|
175
|
-
(!test._ddIsDisabled || test._ddIsAttemptToFix)) {
|
|
176
|
-
const { results } = test
|
|
177
|
-
hasIncompleteTests ||= results.some(result => result.status === 'interrupted') ||
|
|
178
|
-
!results.length || test.expectedStatus !== 'skipped'
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
reporterRunSummaryCh.publish({ failureCount, quarantinedFailureCount, hasIncompleteTests })
|
|
183
|
-
suitesWithHookErrors.clear()
|
|
184
|
-
|
|
185
|
-
if (!this.captureReporterErrors) return
|
|
186
|
-
|
|
187
54
|
this.isFinalizing = true
|
|
188
55
|
// Playwright 1.60 and 1.61 only expose reporter errors through this exact console call.
|
|
189
56
|
// eslint-disable-next-line no-console
|
|
@@ -209,13 +76,6 @@ class DatadogPlaywrightReporter {
|
|
|
209
76
|
DatadogPlaywrightReporter.consoleError = consoleError
|
|
210
77
|
}
|
|
211
78
|
|
|
212
|
-
/**
|
|
213
|
-
* Implements the reporter v2 lifecycle hook required by older Playwright versions.
|
|
214
|
-
*
|
|
215
|
-
* @returns {void}
|
|
216
|
-
*/
|
|
217
|
-
onExit () {}
|
|
218
|
-
|
|
219
79
|
/**
|
|
220
80
|
* Reports errors emitted by Playwright while later reporters are finalizing.
|
|
221
81
|
*
|
|
@@ -223,11 +83,7 @@ class DatadogPlaywrightReporter {
|
|
|
223
83
|
* @returns {void}
|
|
224
84
|
*/
|
|
225
85
|
onError (error) {
|
|
226
|
-
if (this.isFinalizing)
|
|
227
|
-
reporterErrorCh.publish(error)
|
|
228
|
-
} else {
|
|
229
|
-
this.fatalErrorCount += 1
|
|
230
|
-
}
|
|
86
|
+
if (this.isFinalizing) reporterErrorCh.publish(error)
|
|
231
87
|
}
|
|
232
88
|
|
|
233
89
|
/**
|
|
@@ -240,8 +96,4 @@ class DatadogPlaywrightReporter {
|
|
|
240
96
|
}
|
|
241
97
|
}
|
|
242
98
|
|
|
243
|
-
reporterSuiteHookErrorCh.subscribe((testSuiteAbsolutePath) => {
|
|
244
|
-
suitesWithHookErrors.add(testSuiteAbsolutePath)
|
|
245
|
-
})
|
|
246
|
-
|
|
247
99
|
module.exports = DatadogPlaywrightReporter
|
|
@@ -46,8 +46,6 @@ const testSessionStartCh = channel('ci:playwright:session:start')
|
|
|
46
46
|
const testSessionConfigurationCh = channel('ci:playwright:session:configuration')
|
|
47
47
|
const testSessionFinishCh = channel('ci:playwright:session:finish')
|
|
48
48
|
const reporterErrorCh = channel('ci:playwright:reporter:error')
|
|
49
|
-
const reporterRunSummaryCh = channel('ci:playwright:reporter:run-summary')
|
|
50
|
-
const reporterSuiteHookErrorCh = channel('ci:playwright:reporter:suite-hook-error')
|
|
51
49
|
|
|
52
50
|
const libraryConfigurationCh = channel('ci:playwright:library-configuration')
|
|
53
51
|
const knownTestsCh = channel('ci:playwright:known-tests')
|
|
@@ -113,7 +111,7 @@ let testManagementAttemptToFixRetries = 0
|
|
|
113
111
|
let testManagementTests = {}
|
|
114
112
|
let isImpactedTestsEnabled = false
|
|
115
113
|
let modifiedFiles = {}
|
|
116
|
-
let
|
|
114
|
+
let quarantinedButNotAttemptToFixFqns = new Set()
|
|
117
115
|
let recordedTestOptimizationExecutions = new Set()
|
|
118
116
|
let testsReportedInGenerateSummary = new Set()
|
|
119
117
|
const newTestsWithDynamicNames = new Set()
|
|
@@ -787,7 +785,6 @@ function finishTestSuiteIfDone (testSuiteAbsolutePath, projects) {
|
|
|
787
785
|
testSourceLine: test.location.line,
|
|
788
786
|
browserName,
|
|
789
787
|
isNew: test._ddIsNew,
|
|
790
|
-
isAttemptToFix: test._ddIsAttemptToFix,
|
|
791
788
|
isDisabled: test._ddIsDisabled,
|
|
792
789
|
isModified: test._ddIsModified,
|
|
793
790
|
isQuarantined: test._ddIsQuarantined,
|
|
@@ -835,7 +832,6 @@ function testEndHandler ({
|
|
|
835
832
|
|
|
836
833
|
if (hookError) {
|
|
837
834
|
addErrorToTestSuite(testSuiteAbsolutePath, hookError)
|
|
838
|
-
reporterSuiteHookErrorCh.publish(testSuiteAbsolutePath)
|
|
839
835
|
}
|
|
840
836
|
return
|
|
841
837
|
}
|
|
@@ -921,7 +917,9 @@ function testEndHandler ({
|
|
|
921
917
|
|
|
922
918
|
// Check if all EFD retries failed
|
|
923
919
|
const efdRetryCount = getEfdRetryCountForTest(test)
|
|
924
|
-
if (
|
|
920
|
+
if (efdRetryCount > 0 && testStatuses.length === efdRetryCount + 1 &&
|
|
921
|
+
(test._ddIsNew || test._ddIsModified) &&
|
|
922
|
+
isEarlyFlakeDetectionEnabled &&
|
|
925
923
|
testStatuses.every(status => status === 'fail')) {
|
|
926
924
|
test._ddHasFailedAllRetries = true
|
|
927
925
|
}
|
|
@@ -1261,7 +1259,6 @@ function runAllTestsWrapper (runAllTests, playwrightVersion) {
|
|
|
1261
1259
|
return async function (config) {
|
|
1262
1260
|
reporterError = undefined
|
|
1263
1261
|
hasReporterError = false
|
|
1264
|
-
playwrightRunSummary = undefined
|
|
1265
1262
|
let restoreReporterConsoleError
|
|
1266
1263
|
if (satisfies(playwrightVersion, '>=1.60.0') && config?.config) {
|
|
1267
1264
|
const DatadogPlaywrightReporter = require('./playwright-reporter')
|
|
@@ -1436,8 +1433,23 @@ function runAllTestsWrapper (runAllTests, playwrightVersion) {
|
|
|
1436
1433
|
const sessionStatus = runAllTestsReturn.status || runAllTestsReturn
|
|
1437
1434
|
|
|
1438
1435
|
if (isTestManagementTestsEnabled && sessionStatus === 'failed') {
|
|
1439
|
-
|
|
1440
|
-
|
|
1436
|
+
let totalFailedTestCount = 0
|
|
1437
|
+
let totalPureQuarantinedFailedTestCount = 0
|
|
1438
|
+
|
|
1439
|
+
for (const [fqn, testStatuses] of testsToTestStatuses) {
|
|
1440
|
+
// Only count as failed if the final status (after retries) is 'fail'
|
|
1441
|
+
const lastStatus = testStatuses.at(-1)
|
|
1442
|
+
if (lastStatus === 'fail') {
|
|
1443
|
+
totalFailedTestCount += 1
|
|
1444
|
+
if (quarantinedButNotAttemptToFixFqns.has(fqn)) {
|
|
1445
|
+
totalPureQuarantinedFailedTestCount += 1
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
const totalIgnorableFailures = totalPureQuarantinedFailedTestCount
|
|
1451
|
+
|
|
1452
|
+
if (totalFailedTestCount > 0 && totalFailedTestCount === totalIgnorableFailures) {
|
|
1441
1453
|
runAllTestsReturn = 'passed'
|
|
1442
1454
|
preventedToFail = true
|
|
1443
1455
|
}
|
|
@@ -1464,7 +1476,7 @@ function runAllTestsWrapper (runAllTests, playwrightVersion) {
|
|
|
1464
1476
|
|
|
1465
1477
|
startedSuites = []
|
|
1466
1478
|
remainingTestsByFile = {}
|
|
1467
|
-
|
|
1479
|
+
quarantinedButNotAttemptToFixFqns = new Set()
|
|
1468
1480
|
recordedTestOptimizationExecutions = new Set()
|
|
1469
1481
|
testsReportedInGenerateSummary = new Set()
|
|
1470
1482
|
efdManagedTestKeys.clear()
|
|
@@ -1495,8 +1507,6 @@ function runAllTestsWrapper (runAllTests, playwrightVersion) {
|
|
|
1495
1507
|
function reportersHook (reportersPackage) {
|
|
1496
1508
|
return shimmer.wrap(reportersPackage, 'createReporters', createReporters => async function () {
|
|
1497
1509
|
const reporters = await createReporters.apply(this, arguments)
|
|
1498
|
-
const DatadogPlaywrightReporter = require('./playwright-reporter')
|
|
1499
|
-
reporters.unshift(new DatadogPlaywrightReporter({ captureReporterErrors: false }))
|
|
1500
1510
|
for (const reporter of reporters) {
|
|
1501
1511
|
if (instrumentedPlaywrightReporters.has(reporter)) continue
|
|
1502
1512
|
|
|
@@ -1653,10 +1663,6 @@ reporterErrorCh.subscribe((error) => {
|
|
|
1653
1663
|
recordReporterError(error)
|
|
1654
1664
|
})
|
|
1655
1665
|
|
|
1656
|
-
reporterRunSummaryCh.subscribe((runSummary) => {
|
|
1657
|
-
playwrightRunSummary = runSummary
|
|
1658
|
-
})
|
|
1659
|
-
|
|
1660
1666
|
/**
|
|
1661
1667
|
* Records a reporter failure even when the reporter throws a falsy value.
|
|
1662
1668
|
*
|
|
@@ -1888,6 +1894,11 @@ function processRootSuite (createRootSuiteReturnValue) {
|
|
|
1888
1894
|
}
|
|
1889
1895
|
if (testProperties.quarantined) {
|
|
1890
1896
|
test._ddIsQuarantined = true
|
|
1897
|
+
if (!testProperties.attemptToFix) {
|
|
1898
|
+
// Do not skip quarantined tests, let them run and overwrite results post-run if they fail
|
|
1899
|
+
const testFqn = getTestFullyQualifiedName(test)
|
|
1900
|
+
quarantinedButNotAttemptToFixFqns.add(testFqn)
|
|
1901
|
+
}
|
|
1891
1902
|
}
|
|
1892
1903
|
if (testProperties.attemptToFix) {
|
|
1893
1904
|
test._ddIsAttemptToFix = true
|
|
@@ -1927,10 +1938,7 @@ function processRootSuite (createRootSuiteReturnValue) {
|
|
|
1927
1938
|
const fileSuitesWithImpactedTestsToProjects = new Map()
|
|
1928
1939
|
for (const impactedTest of impactedTests) {
|
|
1929
1940
|
impactedTest._ddIsModified = true
|
|
1930
|
-
if (shouldRunEarlyFlakeDetection() && impactedTest.expectedStatus !== 'skipped'
|
|
1931
|
-
!impactedTest._ddIsAttemptToFix) {
|
|
1932
|
-
// Prevent ATR or `--retries` from retrying tests that EFD manages.
|
|
1933
|
-
impactedTest.retries = 0
|
|
1941
|
+
if (shouldRunEarlyFlakeDetection() && impactedTest.expectedStatus !== 'skipped') {
|
|
1934
1942
|
markEfdManagedTest(impactedTest)
|
|
1935
1943
|
const fileSuite = getSuiteType(impactedTest, 'file')
|
|
1936
1944
|
if (!fileSuitesWithImpactedTestsToProjects.has(fileSuite)) {
|
|
@@ -1938,15 +1946,14 @@ function processRootSuite (createRootSuiteReturnValue) {
|
|
|
1938
1946
|
}
|
|
1939
1947
|
}
|
|
1940
1948
|
}
|
|
1941
|
-
// If something
|
|
1949
|
+
// If something change in the file, all tests in the file are impacted, hence the () => true filter
|
|
1942
1950
|
applyRetriesToTests(
|
|
1943
1951
|
fileSuitesWithImpactedTestsToProjects,
|
|
1944
|
-
(
|
|
1952
|
+
() => true,
|
|
1945
1953
|
[
|
|
1946
1954
|
'_ddIsModified',
|
|
1947
1955
|
'_ddIsEfdRetry',
|
|
1948
1956
|
(test) => (isKnownTestsEnabled && isNewTest(test) ? '_ddIsNew' : null),
|
|
1949
|
-
(test) => test._ddIsQuarantined && '_ddIsQuarantined',
|
|
1950
1957
|
],
|
|
1951
1958
|
earlyFlakeDetectionRetryPolicy.schedulingRetryCount,
|
|
1952
1959
|
(copiedTest, originalTest, retryIndex) => {
|
|
@@ -1974,8 +1981,7 @@ function processRootSuite (createRootSuiteReturnValue) {
|
|
|
1974
1981
|
const fileSuitesWithNewTestsToProjects = new Map()
|
|
1975
1982
|
for (const newTest of newTests) {
|
|
1976
1983
|
newTest._ddIsNew = true
|
|
1977
|
-
if (shouldRunEarlyFlakeDetection() && newTest.expectedStatus !== 'skipped' &&
|
|
1978
|
-
!newTest._ddIsModified && !newTest._ddIsAttemptToFix) {
|
|
1984
|
+
if (shouldRunEarlyFlakeDetection() && newTest.expectedStatus !== 'skipped' && !newTest._ddIsModified) {
|
|
1979
1985
|
// Prevent ATR or `--retries` from retrying tests that EFD manages.
|
|
1980
1986
|
newTest.retries = 0
|
|
1981
1987
|
markEfdManagedTest(newTest)
|
|
@@ -1988,12 +1994,8 @@ function processRootSuite (createRootSuiteReturnValue) {
|
|
|
1988
1994
|
|
|
1989
1995
|
applyRetriesToTests(
|
|
1990
1996
|
fileSuitesWithNewTestsToProjects,
|
|
1991
|
-
|
|
1992
|
-
[
|
|
1993
|
-
'_ddIsNew',
|
|
1994
|
-
'_ddIsEfdRetry',
|
|
1995
|
-
(test) => test._ddIsQuarantined && '_ddIsQuarantined',
|
|
1996
|
-
],
|
|
1997
|
+
isNewTest,
|
|
1998
|
+
['_ddIsNew', '_ddIsEfdRetry'],
|
|
1997
1999
|
earlyFlakeDetectionRetryPolicy.schedulingRetryCount,
|
|
1998
2000
|
(copiedTest, originalTest, retryIndex) => {
|
|
1999
2001
|
markEfdRetryTest(copiedTest, retryIndex, originalTest)
|
|
@@ -2445,7 +2447,6 @@ function generateSummaryWrapper (generateSummary) {
|
|
|
2445
2447
|
line: testSourceLine,
|
|
2446
2448
|
},
|
|
2447
2449
|
_ddIsNew: isNew,
|
|
2448
|
-
_ddIsAttemptToFix: isAttemptToFix,
|
|
2449
2450
|
_ddIsDisabled: isDisabled,
|
|
2450
2451
|
_ddIsModified: isModified,
|
|
2451
2452
|
_ddIsQuarantined: isQuarantined,
|
|
@@ -2460,7 +2461,6 @@ function generateSummaryWrapper (generateSummary) {
|
|
|
2460
2461
|
testSourceLine,
|
|
2461
2462
|
browserName,
|
|
2462
2463
|
isNew,
|
|
2463
|
-
isAttemptToFix,
|
|
2464
2464
|
isDisabled,
|
|
2465
2465
|
isModified,
|
|
2466
2466
|
isQuarantined,
|
|
@@ -1058,7 +1058,7 @@ function getRepeatedTestReport (task, testName, testSuiteAbsolutePath, testPrope
|
|
|
1058
1058
|
const errors = browserEnvironment
|
|
1059
1059
|
? normalizeVitestBrowserErrors(result?.errors)
|
|
1060
1060
|
: result?.errors || []
|
|
1061
|
-
const finalAttemptStatus = finalStatus(statuses
|
|
1061
|
+
const finalAttemptStatus = finalStatus(statuses)
|
|
1062
1062
|
const hasFailure = finalAttemptStatus === 'fail'
|
|
1063
1063
|
const attempts = []
|
|
1064
1064
|
const attemptCount = getRepeatedAttemptCount(task, statuses)
|
|
@@ -1095,7 +1095,8 @@ function getRepeatedTestReport (task, testName, testSuiteAbsolutePath, testPrope
|
|
|
1095
1095
|
testProperties,
|
|
1096
1096
|
type,
|
|
1097
1097
|
statuses,
|
|
1098
|
-
isFinalAttempt
|
|
1098
|
+
isFinalAttempt,
|
|
1099
|
+
hasFailure
|
|
1099
1100
|
),
|
|
1100
1101
|
isRetry: index > 0,
|
|
1101
1102
|
status: attemptStatus,
|
|
@@ -1135,10 +1136,11 @@ function getRepeatedTestReport (task, testName, testSuiteAbsolutePath, testPrope
|
|
|
1135
1136
|
* @param {'attempt_to_fix'|'early_flake_detection'|'external'} type
|
|
1136
1137
|
* @param {string[]} statuses
|
|
1137
1138
|
* @param {boolean} isFinalAttempt
|
|
1139
|
+
* @param {boolean} hasFailure
|
|
1138
1140
|
* @returns {boolean}
|
|
1139
1141
|
*/
|
|
1140
|
-
function hasFailedAllManagedRetries (task, testProperties, type, statuses, isFinalAttempt) {
|
|
1141
|
-
if (!isFinalAttempt || statuses.length === 0 || !statuses.every(status => status === 'fail')) {
|
|
1142
|
+
function hasFailedAllManagedRetries (task, testProperties, type, statuses, isFinalAttempt, hasFailure) {
|
|
1143
|
+
if (!isFinalAttempt || !hasFailure || statuses.length === 0 || !statuses.every(status => status === 'fail')) {
|
|
1142
1144
|
return false
|
|
1143
1145
|
}
|
|
1144
1146
|
|
|
@@ -1163,8 +1165,7 @@ function getAttemptToFixFinalStatus (statuses) {
|
|
|
1163
1165
|
return statuses.includes('fail') ? 'fail' : 'pass'
|
|
1164
1166
|
}
|
|
1165
1167
|
|
|
1166
|
-
function getEarlyFlakeDetectionFinalStatus (statuses
|
|
1167
|
-
if (testProperties.isDisabled || testProperties.isQuarantined) return 'skip'
|
|
1168
|
+
function getEarlyFlakeDetectionFinalStatus (statuses) {
|
|
1168
1169
|
return statuses.includes('pass') ? 'pass' : 'fail'
|
|
1169
1170
|
}
|
|
1170
1171
|
|
|
@@ -1273,6 +1274,7 @@ function reportFinalTestAttempt (testReport) {
|
|
|
1273
1274
|
testProperties,
|
|
1274
1275
|
'external',
|
|
1275
1276
|
['fail'],
|
|
1277
|
+
true,
|
|
1276
1278
|
true
|
|
1277
1279
|
),
|
|
1278
1280
|
isRetry: (result?.retryCount || 0) > 0 || (result?.repeatCount || 0) > 0,
|
|
@@ -534,7 +534,6 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
534
534
|
testSourceLine,
|
|
535
535
|
browserName,
|
|
536
536
|
isNew,
|
|
537
|
-
isAttemptToFix,
|
|
538
537
|
isDisabled,
|
|
539
538
|
isModified,
|
|
540
539
|
isQuarantined,
|
|
@@ -560,9 +559,6 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
560
559
|
if (isNew) {
|
|
561
560
|
span.setTag(TEST_IS_NEW, 'true')
|
|
562
561
|
}
|
|
563
|
-
if (isAttemptToFix) {
|
|
564
|
-
span.setTag(TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX, 'true')
|
|
565
|
-
}
|
|
566
562
|
if (isDisabled) {
|
|
567
563
|
span.setTag(TEST_MANAGEMENT_IS_DISABLED, 'true')
|
|
568
564
|
}
|
|
@@ -15,7 +15,6 @@ const {
|
|
|
15
15
|
incrementWafUpdatesMetric,
|
|
16
16
|
incrementWafConfigErrorsMetric,
|
|
17
17
|
incrementWafRequestsMetric,
|
|
18
|
-
incrementRequestDurationMetrics,
|
|
19
18
|
updateWafRequestsMetricTags,
|
|
20
19
|
updateRaspRequestsMetricTags,
|
|
21
20
|
updateRaspRuleSkippedMetricTags,
|
|
@@ -609,7 +608,6 @@ function finishRequest (req, res, storedResponseHeaders, requestBody, rootSpan)
|
|
|
609
608
|
|
|
610
609
|
if (!req) return
|
|
611
610
|
|
|
612
|
-
incrementRequestDurationMetrics(req)
|
|
613
611
|
incrementWafRequestsMetric(req)
|
|
614
612
|
|
|
615
613
|
const tags = rootSpan.context().getTags()
|
|
@@ -12,7 +12,6 @@ const {
|
|
|
12
12
|
trackRaspMetrics,
|
|
13
13
|
trackRaspRuleMatch,
|
|
14
14
|
trackRaspRuleSkipped,
|
|
15
|
-
incrementRaspDurationMetrics,
|
|
16
15
|
} = require('./rasp')
|
|
17
16
|
const {
|
|
18
17
|
addWafRequestMetrics,
|
|
@@ -21,7 +20,6 @@ const {
|
|
|
21
20
|
incrementWafUpdates,
|
|
22
21
|
incrementWafConfigErrors,
|
|
23
22
|
incrementWafRequests,
|
|
24
|
-
incrementWafDurationMetrics,
|
|
25
23
|
} = require('./waf')
|
|
26
24
|
|
|
27
25
|
const metricsStoreMap = new WeakMap()
|
|
@@ -144,16 +142,6 @@ function incrementWafRequestsMetric (req) {
|
|
|
144
142
|
metricsStoreMap.delete(req)
|
|
145
143
|
}
|
|
146
144
|
|
|
147
|
-
function incrementRequestDurationMetrics (req) {
|
|
148
|
-
if (!req || !enabled) return
|
|
149
|
-
|
|
150
|
-
const store = getStore(req)
|
|
151
|
-
const requestMetrics = store[DD_TELEMETRY_REQUEST_METRICS]
|
|
152
|
-
|
|
153
|
-
incrementWafDurationMetrics(requestMetrics)
|
|
154
|
-
incrementRaspDurationMetrics(requestMetrics)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
145
|
function incrementMissingUserLoginMetric (framework, eventType) {
|
|
158
146
|
if (!enabled) return
|
|
159
147
|
|
|
@@ -211,7 +199,6 @@ module.exports = {
|
|
|
211
199
|
incrementWafUpdatesMetric,
|
|
212
200
|
incrementWafConfigErrorsMetric,
|
|
213
201
|
incrementWafRequestsMetric,
|
|
214
|
-
incrementRequestDurationMetrics,
|
|
215
202
|
incrementMissingUserLoginMetric,
|
|
216
203
|
incrementMissingUserIdMetric,
|
|
217
204
|
incrementSdkEventMetric,
|
|
@@ -77,21 +77,6 @@ function trackRaspRuleMatch (store, raspRule, blockTriggered, blocked) {
|
|
|
77
77
|
appsecMetrics.count('rasp.rule.match', tags).inc(1)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function incrementRaspDurationMetrics (requestMetrics) {
|
|
81
|
-
const { raspDuration, raspDurationExt, wafVersion, rulesVersion } = requestMetrics
|
|
82
|
-
if (!raspDuration && !raspDurationExt) return
|
|
83
|
-
|
|
84
|
-
const versionsTags = getVersionsTags(wafVersion, rulesVersion)
|
|
85
|
-
|
|
86
|
-
if (raspDuration) {
|
|
87
|
-
appsecMetrics.distribution('rasp.duration', versionsTags).track(raspDuration)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (raspDurationExt) {
|
|
91
|
-
appsecMetrics.distribution('rasp.duration_ext', versionsTags).track(raspDurationExt)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
80
|
function trackRaspRuleSkipped (raspRule, reason) {
|
|
96
81
|
const tags = { reason, rule_type: raspRule.type }
|
|
97
82
|
|
|
@@ -115,5 +100,4 @@ module.exports = {
|
|
|
115
100
|
trackRaspMetrics,
|
|
116
101
|
trackRaspRuleMatch,
|
|
117
102
|
trackRaspRuleSkipped,
|
|
118
|
-
incrementRaspDurationMetrics,
|
|
119
103
|
}
|
|
@@ -34,14 +34,6 @@ function addWafRequestMetrics (store, { duration, durationExt, wafTimeout, error
|
|
|
34
34
|
function trackWafMetrics (store, metrics) {
|
|
35
35
|
const versionsTags = getVersionsTags(metrics.wafVersion, metrics.rulesVersion)
|
|
36
36
|
|
|
37
|
-
const requestMetrics = store[DD_TELEMETRY_REQUEST_METRICS]
|
|
38
|
-
if (metrics.wafVersion) {
|
|
39
|
-
requestMetrics.wafVersion = metrics.wafVersion
|
|
40
|
-
}
|
|
41
|
-
if (metrics.rulesVersion) {
|
|
42
|
-
requestMetrics.rulesVersion = metrics.rulesVersion
|
|
43
|
-
}
|
|
44
|
-
|
|
45
37
|
const metricTags = getOrCreateMetricTags(store, versionsTags)
|
|
46
38
|
|
|
47
39
|
if (metrics.blockFailed) {
|
|
@@ -126,21 +118,6 @@ function incrementWafRequests (store) {
|
|
|
126
118
|
}
|
|
127
119
|
}
|
|
128
120
|
|
|
129
|
-
function incrementWafDurationMetrics (requestMetrics) {
|
|
130
|
-
const { duration, durationExt, wafVersion, rulesVersion } = requestMetrics
|
|
131
|
-
if (!duration && !durationExt) return
|
|
132
|
-
|
|
133
|
-
const versionsTags = getVersionsTags(wafVersion, rulesVersion)
|
|
134
|
-
|
|
135
|
-
if (duration) {
|
|
136
|
-
appsecMetrics.distribution('waf.duration', versionsTags).track(duration)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (durationExt) {
|
|
140
|
-
appsecMetrics.distribution('waf.duration_ext', versionsTags).track(durationExt)
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
121
|
function incrementTruncatedMetrics (metrics, truncationReason) {
|
|
145
122
|
const truncationTags = { truncation_reason: truncationReason }
|
|
146
123
|
appsecMetrics.count('waf.input_truncated', truncationTags).inc(1)
|
|
@@ -163,5 +140,4 @@ module.exports = {
|
|
|
163
140
|
incrementWafUpdates,
|
|
164
141
|
incrementWafConfigErrors,
|
|
165
142
|
incrementWafRequests,
|
|
166
|
-
incrementWafDurationMetrics,
|
|
167
143
|
}
|