dd-trace 5.99.0 → 5.100.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 -1
- package/package.json +24 -5
- package/packages/datadog-instrumentations/src/cucumber.js +69 -5
- package/packages/datadog-instrumentations/src/express.js +3 -2
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
- package/packages/datadog-instrumentations/src/hono.js +15 -4
- package/packages/datadog-instrumentations/src/jest.js +89 -63
- package/packages/datadog-instrumentations/src/mocha/main.js +18 -22
- package/packages/datadog-instrumentations/src/mocha/utils.js +114 -96
- package/packages/datadog-instrumentations/src/mocha/worker.js +2 -2
- package/packages/datadog-instrumentations/src/path-to-regexp.js +44 -0
- package/packages/datadog-instrumentations/src/playwright.js +108 -18
- package/packages/datadog-instrumentations/src/router.js +53 -33
- package/packages/datadog-instrumentations/src/vitest.js +76 -30
- package/packages/datadog-plugin-aws-sdk/src/base.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +1 -1
- package/packages/datadog-plugin-bullmq/src/consumer.js +3 -2
- package/packages/datadog-plugin-bullmq/src/producer.js +25 -11
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +32 -9
- package/packages/datadog-plugin-cypress/src/support.js +22 -21
- package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -1
- package/packages/datadog-plugin-graphql/src/utils.js +2 -2
- package/packages/datadog-plugin-grpc/src/client.js +1 -1
- package/packages/datadog-plugin-grpc/src/server.js +1 -1
- package/packages/datadog-plugin-memcached/src/index.js +1 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +2 -3
- package/packages/datadog-plugin-playwright/src/index.js +6 -0
- package/packages/datadog-plugin-router/src/index.js +13 -0
- package/packages/dd-trace/index.js +4 -3
- package/packages/dd-trace/src/aiguard/sdk.js +2 -2
- package/packages/dd-trace/src/appsec/blocking.js +18 -6
- package/packages/dd-trace/src/appsec/graphql.js +1 -1
- package/packages/dd-trace/src/baggage.js +26 -13
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +1 -1
- package/packages/dd-trace/src/config/generated-config-types.d.ts +45 -69
- package/packages/dd-trace/src/config/index.js +13 -12
- package/packages/dd-trace/src/config/normalize-service.js +31 -0
- package/packages/dd-trace/src/config/supported-configurations.json +31 -76
- package/packages/dd-trace/src/debugger/config.js +1 -1
- package/packages/dd-trace/src/dogstatsd.js +5 -8
- package/packages/dd-trace/src/encode/0.4.js +1 -1
- package/packages/dd-trace/src/encode/tags-processors.js +3 -3
- package/packages/dd-trace/src/exporter.js +1 -1
- package/packages/dd-trace/src/git_metadata_tagger.js +1 -1
- package/packages/dd-trace/src/heap_snapshots.js +4 -4
- package/packages/dd-trace/src/llmobs/constants/tags.js +3 -0
- package/packages/dd-trace/src/llmobs/sdk.js +21 -1
- package/packages/dd-trace/src/llmobs/span_processor.js +14 -1
- package/packages/dd-trace/src/llmobs/writers/base.js +7 -1
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +2 -2
- package/packages/dd-trace/src/opentelemetry/context_manager.js +11 -8
- package/packages/dd-trace/src/opentelemetry/logs/index.js +5 -5
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +6 -6
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +170 -0
- package/packages/dd-trace/src/opentelemetry/span.js +14 -42
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/tracer.js +11 -36
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +44 -23
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +42 -12
- package/packages/dd-trace/src/opentracing/span.js +4 -3
- package/packages/dd-trace/src/plugin_manager.js +6 -6
- package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +119 -32
- package/packages/dd-trace/src/plugins/util/test.js +295 -29
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +2 -2
- package/packages/dd-trace/src/propagation-hash/index.js +1 -1
- package/packages/dd-trace/src/proxy.js +9 -9
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +1 -1
- package/packages/dd-trace/src/span_processor.js +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +7 -5
- package/packages/dd-trace/src/tracer_metadata.js +1 -1
- package/vendor/dist/path-to-regexp/LICENSE +0 -21
- package/vendor/dist/path-to-regexp/index.js +0 -1
|
@@ -217,6 +217,8 @@ const TEST_MANAGEMENT_IS_QUARANTINED = 'test.test_management.is_quarantined'
|
|
|
217
217
|
const TEST_MANAGEMENT_ENABLED = 'test.test_management.enabled'
|
|
218
218
|
const TEST_MANAGEMENT_ATTEMPT_TO_FIX_PASSED = 'test.test_management.attempt_to_fix_passed'
|
|
219
219
|
|
|
220
|
+
const MAX_TEST_OPTIMIZATION_SUMMARY_ITEMS = 10
|
|
221
|
+
|
|
220
222
|
// Impacted tests
|
|
221
223
|
const POSSIBLE_BASE_BRANCHES = ['main', 'master', 'preprod', 'prod', 'dev', 'development', 'trunk']
|
|
222
224
|
const BASE_LIKE_BRANCH_FILTER = /^(main|master|preprod|prod|dev|development|trunk|release\/.*|hotfix\/.*)$/
|
|
@@ -358,7 +360,14 @@ module.exports = {
|
|
|
358
360
|
GIT_REPOSITORY_URL,
|
|
359
361
|
DYNAMIC_NAME_RE,
|
|
360
362
|
collectDynamicNamesFromTraces,
|
|
363
|
+
collectTestOptimizationSummariesFromTraces,
|
|
361
364
|
logDynamicNamesWarning,
|
|
365
|
+
recordAttemptToFixExecution,
|
|
366
|
+
collectAttemptToFixExecutionsFromTraces,
|
|
367
|
+
formatAttemptToFixSummary,
|
|
368
|
+
logAttemptToFixTestExecution,
|
|
369
|
+
formatDynamicNamesSummary,
|
|
370
|
+
logTestOptimizationSummary,
|
|
362
371
|
}
|
|
363
372
|
|
|
364
373
|
// Returns pkg manager and its version, separated by '-', e.g. npm-8.15.0 or yarn-1.22.19
|
|
@@ -1055,8 +1064,8 @@ function getIsFaultyEarlyFlakeDetection (projectSuites, testsBySuiteName, faulty
|
|
|
1055
1064
|
}
|
|
1056
1065
|
|
|
1057
1066
|
function getTestSessionName (config, trimmedCommand, envTags) {
|
|
1058
|
-
if (config.
|
|
1059
|
-
return config.
|
|
1067
|
+
if (config.DD_TEST_SESSION_NAME) {
|
|
1068
|
+
return config.DD_TEST_SESSION_NAME
|
|
1060
1069
|
}
|
|
1061
1070
|
const lageTestSessionName = getLageTestSessionName()
|
|
1062
1071
|
if (lageTestSessionName) {
|
|
@@ -1327,23 +1336,149 @@ function getModifiedFilesFromDiff (diff) {
|
|
|
1327
1336
|
}
|
|
1328
1337
|
|
|
1329
1338
|
/**
|
|
1330
|
-
*
|
|
1331
|
-
*
|
|
1339
|
+
* @typedef {object} AttemptToFixExecutionResult
|
|
1340
|
+
* @property {string} name
|
|
1341
|
+
* @property {number} executions
|
|
1342
|
+
* @property {number} failedCount
|
|
1343
|
+
* @property {boolean} isDisabled
|
|
1344
|
+
* @property {boolean} isQuarantined
|
|
1345
|
+
*/
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* @typedef {Map<string, AttemptToFixExecutionResult>} AttemptToFixExecutions
|
|
1349
|
+
*/
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* Formats a test name for user-facing Test Optimization summaries.
|
|
1353
|
+
*
|
|
1354
|
+
* @param {string | undefined} testSuite
|
|
1355
|
+
* @param {string} testName
|
|
1356
|
+
* @returns {string}
|
|
1357
|
+
*/
|
|
1358
|
+
function formatTestOptimizationName (testSuite, testName) {
|
|
1359
|
+
return testSuite ? `${testSuite} › ${testName}` : testName
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* Renders a bounded bullet list for Test Optimization summaries.
|
|
1364
|
+
*
|
|
1365
|
+
* @param {Array<{ text: string, suffix?: string }>} items
|
|
1366
|
+
* @returns {string}
|
|
1367
|
+
*/
|
|
1368
|
+
function formatTestOptimizationList (items) {
|
|
1369
|
+
const shown = items.slice(0, MAX_TEST_OPTIMIZATION_SUMMARY_ITEMS)
|
|
1370
|
+
const more = items.length - shown.length
|
|
1371
|
+
const moreSuffix = more > 0 ? `\n ... and ${more} more` : ''
|
|
1372
|
+
|
|
1373
|
+
return shown.map(({ text, suffix }) => ` • ${text}${suffix ? ` (${suffix})` : ''}`).join('\n') + moreSuffix
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* Logs a compact message when an attempt-to-fix test execution starts.
|
|
1378
|
+
*
|
|
1379
|
+
* @param {string | undefined} testSuite
|
|
1380
|
+
* @param {string} testName
|
|
1381
|
+
* @param {Set<string>} [loggedAttemptToFixTests]
|
|
1382
|
+
*/
|
|
1383
|
+
function logAttemptToFixTestExecution (testSuite, testName, loggedAttemptToFixTests) {
|
|
1384
|
+
if (!testName) return
|
|
1385
|
+
|
|
1386
|
+
const name = formatTestOptimizationName(testSuite, testName)
|
|
1387
|
+
if (loggedAttemptToFixTests) {
|
|
1388
|
+
if (loggedAttemptToFixTests.has(name)) return
|
|
1389
|
+
|
|
1390
|
+
loggedAttemptToFixTests.add(name)
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// eslint-disable-next-line no-console -- Intentional user-facing attempt-to-fix progress report
|
|
1394
|
+
console.warn(`Datadog Test Optimization: attempting to fix ${name}`)
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
/**
|
|
1398
|
+
* Records a single attempt-to-fix execution for the end-of-session user summary.
|
|
1399
|
+
*
|
|
1400
|
+
* @param {AttemptToFixExecutions} attemptToFixExecutions
|
|
1401
|
+
* @param {{
|
|
1402
|
+
* testSuite?: string,
|
|
1403
|
+
* testName: string,
|
|
1404
|
+
* status: string,
|
|
1405
|
+
* isDisabled?: boolean,
|
|
1406
|
+
* isQuarantined?: boolean
|
|
1407
|
+
* }} execution
|
|
1408
|
+
*/
|
|
1409
|
+
function recordAttemptToFixExecution (attemptToFixExecutions, execution) {
|
|
1410
|
+
if (!execution?.testName) return
|
|
1411
|
+
|
|
1412
|
+
const { testSuite, testName, status, isDisabled, isQuarantined } = execution
|
|
1413
|
+
const name = formatTestOptimizationName(testSuite, testName)
|
|
1414
|
+
let result = attemptToFixExecutions.get(name)
|
|
1415
|
+
|
|
1416
|
+
if (!result) {
|
|
1417
|
+
result = {
|
|
1418
|
+
name,
|
|
1419
|
+
executions: 0,
|
|
1420
|
+
failedCount: 0,
|
|
1421
|
+
isDisabled: false,
|
|
1422
|
+
isQuarantined: false,
|
|
1423
|
+
}
|
|
1424
|
+
attemptToFixExecutions.set(name, result)
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
result.executions++
|
|
1428
|
+
result.isDisabled = result.isDisabled || !!isDisabled
|
|
1429
|
+
result.isQuarantined = result.isQuarantined || !!isQuarantined
|
|
1430
|
+
|
|
1431
|
+
if (status === 'fail') {
|
|
1432
|
+
result.failedCount++
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
function collectDynamicNameFromTraceSpan (span, newTestsWithDynamicNames) {
|
|
1437
|
+
const meta = span.meta
|
|
1438
|
+
if (meta?.[TEST_HAS_DYNAMIC_NAME] !== 'true') return
|
|
1439
|
+
|
|
1440
|
+
const suite = meta[TEST_SUITE]
|
|
1441
|
+
const name = meta[TEST_NAME]
|
|
1442
|
+
if (suite && name) {
|
|
1443
|
+
newTestsWithDynamicNames.add(`${suite} › ${name}`)
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
function collectAttemptToFixExecutionFromTraceSpan (span, attemptToFixExecutions) {
|
|
1448
|
+
const meta = span.meta
|
|
1449
|
+
if (meta?.[TEST_MANAGEMENT_IS_ATTEMPT_TO_FIX] !== 'true') return
|
|
1450
|
+
|
|
1451
|
+
recordAttemptToFixExecution(attemptToFixExecutions, {
|
|
1452
|
+
testSuite: meta[TEST_SUITE],
|
|
1453
|
+
testName: meta[TEST_NAME],
|
|
1454
|
+
status: meta[TEST_STATUS],
|
|
1455
|
+
isDisabled: meta[TEST_MANAGEMENT_IS_DISABLED] === 'true',
|
|
1456
|
+
isQuarantined: meta[TEST_MANAGEMENT_IS_QUARANTINED] === 'true',
|
|
1457
|
+
})
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Scans serialized worker trace payloads and populates Test Optimization summary data.
|
|
1462
|
+
* Silently ignores parse errors.
|
|
1332
1463
|
*
|
|
1333
1464
|
* @param {string} data - JSON-serialized traces from a worker
|
|
1334
|
-
* @param {
|
|
1465
|
+
* @param {{
|
|
1466
|
+
* newTestsWithDynamicNames?: Set<string>,
|
|
1467
|
+
* attemptToFixExecutions?: AttemptToFixExecutions
|
|
1468
|
+
* }} summaries
|
|
1335
1469
|
*/
|
|
1336
|
-
function
|
|
1470
|
+
function collectTestOptimizationSummariesFromTraces (data, summaries) {
|
|
1471
|
+
const { newTestsWithDynamicNames, attemptToFixExecutions } = summaries
|
|
1472
|
+
|
|
1337
1473
|
try {
|
|
1338
1474
|
const traces = JSON.parse(data)
|
|
1339
1475
|
for (const trace of traces) {
|
|
1340
1476
|
for (const span of trace) {
|
|
1341
|
-
if (
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1477
|
+
if (newTestsWithDynamicNames) {
|
|
1478
|
+
collectDynamicNameFromTraceSpan(span, newTestsWithDynamicNames)
|
|
1479
|
+
}
|
|
1480
|
+
if (attemptToFixExecutions) {
|
|
1481
|
+
collectAttemptToFixExecutionFromTraceSpan(span, attemptToFixExecutions)
|
|
1347
1482
|
}
|
|
1348
1483
|
}
|
|
1349
1484
|
}
|
|
@@ -1353,33 +1488,164 @@ function collectDynamicNamesFromTraces (data, newTestsWithDynamicNames) {
|
|
|
1353
1488
|
}
|
|
1354
1489
|
|
|
1355
1490
|
/**
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1491
|
+
* Scans serialized worker trace payloads for tests tagged with TEST_HAS_DYNAMIC_NAME
|
|
1492
|
+
* and populates the provided Set. Silently ignores parse errors.
|
|
1358
1493
|
*
|
|
1359
|
-
* @param {
|
|
1494
|
+
* @param {string} data - JSON-serialized traces from a worker
|
|
1495
|
+
* @param {Set<string>} newTestsWithDynamicNames - Set to populate with "suite › name" strings
|
|
1360
1496
|
*/
|
|
1361
|
-
function
|
|
1362
|
-
|
|
1497
|
+
function collectDynamicNamesFromTraces (data, newTestsWithDynamicNames) {
|
|
1498
|
+
collectTestOptimizationSummariesFromTraces(data, { newTestsWithDynamicNames })
|
|
1499
|
+
}
|
|
1363
1500
|
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1501
|
+
/**
|
|
1502
|
+
* Scans serialized worker trace payloads for attempt-to-fix test spans.
|
|
1503
|
+
*
|
|
1504
|
+
* @param {string} data - JSON-serialized traces from a worker
|
|
1505
|
+
* @param {AttemptToFixExecutions} attemptToFixExecutions
|
|
1506
|
+
*/
|
|
1507
|
+
function collectAttemptToFixExecutionsFromTraces (data, attemptToFixExecutions) {
|
|
1508
|
+
collectTestOptimizationSummariesFromTraces(data, { attemptToFixExecutions })
|
|
1509
|
+
}
|
|
1370
1510
|
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1511
|
+
function getAttemptToFixManagementNotes (result) {
|
|
1512
|
+
const notes = []
|
|
1513
|
+
|
|
1514
|
+
if (result.isDisabled) {
|
|
1515
|
+
notes.push('Test was marked as disabled but was run because it is attempt to fix.')
|
|
1516
|
+
}
|
|
1517
|
+
if (result.isQuarantined) {
|
|
1518
|
+
notes.push('Test was marked as quarantined but was not quarantined because it is attempt to fix.')
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
return notes
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
function hasAttemptToFixManagementNotes (result) {
|
|
1525
|
+
return result.isDisabled || result.isQuarantined
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
function addAttemptToFixResultLine (lines, result) {
|
|
1529
|
+
lines.push(` • ${result.name}`)
|
|
1530
|
+
|
|
1531
|
+
for (const note of getAttemptToFixManagementNotes(result)) {
|
|
1532
|
+
lines.push(` ${note}`)
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* Formats the attempt-to-fix end-of-session summary.
|
|
1538
|
+
*
|
|
1539
|
+
* @param {AttemptToFixExecutions} attemptToFixExecutions
|
|
1540
|
+
* @returns {string}
|
|
1541
|
+
*/
|
|
1542
|
+
function formatAttemptToFixSummary (attemptToFixExecutions) {
|
|
1543
|
+
if (attemptToFixExecutions.size === 0) return ''
|
|
1544
|
+
|
|
1545
|
+
const results = [...attemptToFixExecutions.values()]
|
|
1546
|
+
const failedResults = results.filter(result => result.failedCount > 0)
|
|
1547
|
+
const totalExecutions = results.reduce((total, result) => total + result.executions, 0)
|
|
1548
|
+
|
|
1549
|
+
if (failedResults.length === 0) {
|
|
1550
|
+
const lines = [
|
|
1551
|
+
`Attempt to fix passed: all ${totalExecutions} execution(s) passed for ${results.length} test(s).`,
|
|
1552
|
+
]
|
|
1553
|
+
|
|
1554
|
+
for (const result of results) {
|
|
1555
|
+
if (hasAttemptToFixManagementNotes(result)) {
|
|
1556
|
+
addAttemptToFixResultLine(lines, result)
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
return lines.join('\n')
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
const totalFailedExecutions = failedResults.reduce(
|
|
1564
|
+
(total, result) => total + result.failedCount,
|
|
1565
|
+
0
|
|
1566
|
+
)
|
|
1567
|
+
const lines = [
|
|
1568
|
+
`Attempt to fix failed: ${totalFailedExecutions} of ${totalExecutions} execution(s) failed ` +
|
|
1569
|
+
`across ${failedResults.length} of ${results.length} test(s).`,
|
|
1570
|
+
]
|
|
1571
|
+
|
|
1572
|
+
for (const result of failedResults) {
|
|
1573
|
+
addAttemptToFixResultLine(lines, result)
|
|
1574
|
+
}
|
|
1575
|
+
for (const result of results) {
|
|
1576
|
+
if (result.failedCount === 0 && hasAttemptToFixManagementNotes(result)) {
|
|
1577
|
+
addAttemptToFixResultLine(lines, result)
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
return lines.join('\n')
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* Formats the dynamic-name warning section of the Test Optimization summary.
|
|
1586
|
+
*
|
|
1587
|
+
* @param {Set<string>} newTestsWithDynamicNames
|
|
1588
|
+
* @returns {string}
|
|
1589
|
+
*/
|
|
1590
|
+
function formatDynamicNamesSummary (newTestsWithDynamicNames) {
|
|
1591
|
+
if (newTestsWithDynamicNames.size === 0) return ''
|
|
1592
|
+
|
|
1593
|
+
const items = [...newTestsWithDynamicNames].map(name => ({ text: name }))
|
|
1594
|
+
return (
|
|
1375
1595
|
`${newTestsWithDynamicNames.size} test(s) detected as new but their names contain ` +
|
|
1376
1596
|
'dynamic data (timestamps, UUIDs, etc.).\n' +
|
|
1377
1597
|
'Tests with changing names are always treated as new on every run, ' +
|
|
1378
1598
|
'causing unnecessary Early Flake Detection retries and preventing correct new test detection.\n' +
|
|
1379
1599
|
'Consider using stable, deterministic test names.\n\n' +
|
|
1380
|
-
|
|
1600
|
+
formatTestOptimizationList(items)
|
|
1381
1601
|
)
|
|
1382
|
-
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* Logs a single Test Optimization session summary.
|
|
1606
|
+
*
|
|
1607
|
+
* @param {{
|
|
1608
|
+
* attemptToFixExecutions?: AttemptToFixExecutions,
|
|
1609
|
+
* newTestsWithDynamicNames?: Set<string>,
|
|
1610
|
+
* extraSections?: string[]
|
|
1611
|
+
* }} summary
|
|
1612
|
+
*/
|
|
1613
|
+
function logTestOptimizationSummary (summary) {
|
|
1614
|
+
const { attemptToFixExecutions, newTestsWithDynamicNames, extraSections = [] } = summary
|
|
1615
|
+
const sections = []
|
|
1616
|
+
const attemptToFixSummary = attemptToFixExecutions
|
|
1617
|
+
? formatAttemptToFixSummary(attemptToFixExecutions)
|
|
1618
|
+
: ''
|
|
1619
|
+
const dynamicNamesSummary = newTestsWithDynamicNames
|
|
1620
|
+
? formatDynamicNamesSummary(newTestsWithDynamicNames)
|
|
1621
|
+
: ''
|
|
1622
|
+
|
|
1623
|
+
if (attemptToFixSummary) sections.push(attemptToFixSummary)
|
|
1624
|
+
sections.push(...extraSections.filter(Boolean))
|
|
1625
|
+
if (dynamicNamesSummary) sections.push(dynamicNamesSummary)
|
|
1626
|
+
|
|
1627
|
+
if (sections.length === 0) return
|
|
1628
|
+
|
|
1629
|
+
const line = '-'.repeat(50)
|
|
1630
|
+
// eslint-disable-next-line no-console -- Intentional user-facing session summary
|
|
1631
|
+
console.warn(`\n${line}\nDatadog Test Optimization\n${line}\n${sections.join('\n\n')}\n`)
|
|
1632
|
+
|
|
1633
|
+
if (attemptToFixExecutions) {
|
|
1634
|
+
attemptToFixExecutions.clear()
|
|
1635
|
+
}
|
|
1636
|
+
if (newTestsWithDynamicNames) {
|
|
1637
|
+
newTestsWithDynamicNames.clear()
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
/**
|
|
1642
|
+
* Logs a "Datadog Test Optimization" warning about new tests with dynamic names.
|
|
1643
|
+
* Clears the Set after logging. No-op if the Set is empty.
|
|
1644
|
+
*
|
|
1645
|
+
* @param {Set<string>} newTestsWithDynamicNames
|
|
1646
|
+
*/
|
|
1647
|
+
function logDynamicNamesWarning (newTestsWithDynamicNames) {
|
|
1648
|
+
logTestOptimizationSummary({ newTestsWithDynamicNames })
|
|
1383
1649
|
}
|
|
1384
1650
|
|
|
1385
1651
|
function isModifiedTest (testPath, testStartLine, testEndLine, modifiedFiles, testFramework) {
|
|
@@ -14,12 +14,12 @@ class SSIHeuristics {
|
|
|
14
14
|
* @param {import('../config/config-base')} config - Tracer configuration
|
|
15
15
|
*/
|
|
16
16
|
constructor (config) {
|
|
17
|
-
const longLivedThreshold = config.
|
|
17
|
+
const longLivedThreshold = config.DD_INTERNAL_PROFILING_LONG_LIVED_THRESHOLD || DEFAULT_LONG_LIVED_THRESHOLD
|
|
18
18
|
if (typeof longLivedThreshold !== 'number' || longLivedThreshold <= 0) {
|
|
19
19
|
this.longLivedThreshold = DEFAULT_LONG_LIVED_THRESHOLD
|
|
20
20
|
log.warn(
|
|
21
21
|
'Invalid SSIHeuristics.longLivedThreshold value: %s. Using default value:',
|
|
22
|
-
config.
|
|
22
|
+
config.DD_INTERNAL_PROFILING_LONG_LIVED_THRESHOLD,
|
|
23
23
|
DEFAULT_LONG_LIVED_THRESHOLD
|
|
24
24
|
)
|
|
25
25
|
} else {
|
|
@@ -113,11 +113,11 @@ class Tracer extends NoopProxy {
|
|
|
113
113
|
const propagationHash = require('./propagation-hash')
|
|
114
114
|
propagationHash.configure(config)
|
|
115
115
|
|
|
116
|
-
if (config.
|
|
116
|
+
if (config.DD_CRASHTRACKING_ENABLED) {
|
|
117
117
|
require('./crashtracking').start(config)
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
if (config.
|
|
120
|
+
if (config.DD_HEAP_SNAPSHOT_COUNT > 0) {
|
|
121
121
|
require('./heap_snapshots').start(config)
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -128,11 +128,11 @@ class Tracer extends NoopProxy {
|
|
|
128
128
|
lazyProxy(this, 'dogstatsd', () => require('./dogstatsd').CustomMetrics, config)
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
if (config.
|
|
131
|
+
if (config.DD_TRACE_SPAN_LEAK_DEBUG > 0) {
|
|
132
132
|
const spanleak = require('./spanleak')
|
|
133
|
-
if (config.
|
|
133
|
+
if (config.DD_TRACE_SPAN_LEAK_DEBUG === spanleak.MODES.LOG) {
|
|
134
134
|
spanleak.enableLogging()
|
|
135
|
-
} else if (config.
|
|
135
|
+
} else if (config.DD_TRACE_SPAN_LEAK_DEBUG === spanleak.MODES.GC_AND_LOG) {
|
|
136
136
|
spanleak.enableGarbageCollection()
|
|
137
137
|
}
|
|
138
138
|
spanleak.startScrubber()
|
|
@@ -203,7 +203,7 @@ class Tracer extends NoopProxy {
|
|
|
203
203
|
|
|
204
204
|
this._modules.rewriter.enable(config)
|
|
205
205
|
|
|
206
|
-
if (config.tracing && config.
|
|
206
|
+
if (config.tracing && config.DD_CIVISIBILITY_MANUAL_API_ENABLED) {
|
|
207
207
|
const TestApiManualPlugin = require('./ci-visibility/test-api-manual/test-api-manual-plugin')
|
|
208
208
|
this._testApiManualPlugin = new TestApiManualPlugin(this)
|
|
209
209
|
// `shouldGetEnvironmentData` is passed as false so that we only lazily calculate it
|
|
@@ -211,7 +211,7 @@ class Tracer extends NoopProxy {
|
|
|
211
211
|
// are lazily configured when the library is imported.
|
|
212
212
|
this._testApiManualPlugin.configure({ ...config, enabled: true }, false)
|
|
213
213
|
}
|
|
214
|
-
if (config.
|
|
214
|
+
if (config.DD_AGENTLESS_LOG_SUBMISSION_ENABLED) {
|
|
215
215
|
if (config.apiKey) {
|
|
216
216
|
const LogSubmissionPlugin = require('./ci-visibility/log-submission/log-submission-plugin')
|
|
217
217
|
const automaticLogPlugin = new LogSubmissionPlugin(this)
|
|
@@ -224,12 +224,12 @@ class Tracer extends NoopProxy {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
if (config.
|
|
227
|
+
if (config.DD_LOGS_OTEL_ENABLED) {
|
|
228
228
|
const { initializeOpenTelemetryLogs } = require('./opentelemetry/logs')
|
|
229
229
|
initializeOpenTelemetryLogs(config)
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
if (config.
|
|
232
|
+
if (config.DD_METRICS_OTEL_ENABLED) {
|
|
233
233
|
const { initializeOpenTelemetryMetrics } = require('./opentelemetry/metrics')
|
|
234
234
|
initializeOpenTelemetryMetrics(config)
|
|
235
235
|
}
|
|
@@ -42,7 +42,7 @@ module.exports = {
|
|
|
42
42
|
this.stop()
|
|
43
43
|
const clientConfig = DogStatsDClient.generateClientConfig(config)
|
|
44
44
|
|
|
45
|
-
if (config.
|
|
45
|
+
if (config.DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED) {
|
|
46
46
|
for (const tag of processTags.tagsArray) {
|
|
47
47
|
clientConfig.tags.push(tag)
|
|
48
48
|
}
|
|
@@ -25,7 +25,7 @@ class SpanProcessor {
|
|
|
25
25
|
this._spanSampler = new SpanSampler(config.sampler)
|
|
26
26
|
this._gitMetadataTagger = new GitMetadataTagger(config)
|
|
27
27
|
|
|
28
|
-
this._processTags = config.
|
|
28
|
+
this._processTags = config.DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED
|
|
29
29
|
? processTags.serialized
|
|
30
30
|
: false
|
|
31
31
|
}
|
|
@@ -163,12 +163,14 @@ function getProducts (config) {
|
|
|
163
163
|
* @param {import('../config/config-base')} config
|
|
164
164
|
*/
|
|
165
165
|
function getInstallSignature (config) {
|
|
166
|
-
const
|
|
167
|
-
|
|
166
|
+
const id = config.DD_INSTRUMENTATION_INSTALL_ID
|
|
167
|
+
const time = config.DD_INSTRUMENTATION_INSTALL_TIME
|
|
168
|
+
const type = config.DD_INSTRUMENTATION_INSTALL_TYPE
|
|
169
|
+
if (id || time || type) {
|
|
168
170
|
return {
|
|
169
|
-
install_id:
|
|
170
|
-
install_time:
|
|
171
|
-
install_type:
|
|
171
|
+
install_id: id,
|
|
172
|
+
install_time: time,
|
|
173
|
+
install_type: type,
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
}
|
|
@@ -14,7 +14,7 @@ function storeConfig (config) {
|
|
|
14
14
|
const { containerId } = require('./exporters/common/docker')
|
|
15
15
|
const processTags = require('./process-tags')
|
|
16
16
|
|
|
17
|
-
const processTagsSerialized = config.
|
|
17
|
+
const processTagsSerialized = config.DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED
|
|
18
18
|
? (processTags.serialized || null)
|
|
19
19
|
: null
|
|
20
20
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{var e={"./path-to-regexp/index.js"(e){e.exports=pathToRegexp;var r=/\\.|\((?:\?<(.*?)>)?(?!\?)/g;function pathToRegexp(e,t,n){t=t||[];var o,i=(n=n||{}).strict,p=!1!==n.end,a=n.sensitive?"":"i",s=!1!==n.lookahead,u=0,f=t.length,x=0,g=0,c=0,h="";if(e instanceof RegExp){for(;o=r.exec(e.source);)"\\"!==o[0][0]&&t.push({name:o[1]||g++,optional:!1,offset:o.index});return e}if(Array.isArray(e))return new RegExp((e=e.map(function(e){return pathToRegexp(e,t,n).source})).join("|"),a);if("string"!=typeof e)throw TypeError("path must be a string, array of strings, or regular expression");for(e=e.replace(/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,function(r,n,o,i,p,a,s,f){if("\\"===r[0])return h+=r,c+=2,r;if("."===r)return h+="\\.",u+=1,c+=1,"\\.";if(n||o?h="":h+=e.slice(c,f),c=f+r.length,"*"===r)return u+=3,"(.*)";if("/("===r)return h+="/",u+=2,"/(?:";n=n||"",o=o?"\\.":"",s=s||"",p=p?p.replace(/\\.|\*/,function(e){return"*"===e?"(.*)":e}):h?"((?:(?!/|"+h+").)+?)":"([^/"+o+"]+?)",t.push({name:i,optional:!!s,offset:f+u});var x="(?:"+o+n+p+(a?"((?:[/"+o+"].+?)?)":"")+")"+s;return u+=x.length-r.length,x});o=r.exec(e);)"\\"!==o[0][0]&&((f+x===t.length||t[f+x].offset>o.index)&&t.splice(f+x,0,{name:g++,optional:!1,offset:o.index}),x++);return e+=i?"":"/"===e[e.length-1]?"?":"/?",p?e+="$":"/"!==e[e.length-1]&&(e+=s?"(?=/|$)":"(?:/|$)"),RegExp("^"+e,a)}}},r={};function __webpack_require__(t){var n=r[t];if(void 0!==n)return n.exports;var o=r[t]={exports:{}};return e[t](o,o.exports,__webpack_require__),o.exports}var t=__webpack_require__("./path-to-regexp/index.js");module.exports=t})();
|