dd-trace 5.19.0 → 5.21.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/ext/formats.d.ts +1 -0
- package/ext/formats.js +2 -1
- package/index.d.ts +2 -1
- package/init.js +3 -15
- package/package.json +5 -4
- package/packages/datadog-instrumentations/src/body-parser.js +14 -2
- package/packages/datadog-instrumentations/src/cucumber.js +10 -0
- package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -2
- package/packages/datadog-instrumentations/src/helpers/register.js +21 -12
- package/packages/datadog-instrumentations/src/http/client.js +7 -1
- package/packages/datadog-instrumentations/src/http/server.js +50 -13
- package/packages/datadog-instrumentations/src/mocha/main.js +111 -78
- package/packages/datadog-instrumentations/src/nyc.js +23 -0
- package/packages/datadog-instrumentations/src/process.js +29 -0
- package/packages/datadog-instrumentations/src/vitest.js +65 -25
- package/packages/datadog-plugin-aws-sdk/src/base.js +15 -1
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +3 -3
- package/packages/datadog-plugin-cucumber/src/index.js +12 -2
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +53 -12
- package/packages/datadog-plugin-jest/src/index.js +17 -4
- package/packages/datadog-plugin-mocha/src/index.js +25 -6
- package/packages/datadog-plugin-nyc/src/index.js +35 -0
- package/packages/datadog-plugin-playwright/src/index.js +9 -4
- package/packages/datadog-plugin-vitest/src/index.js +32 -5
- package/packages/dd-trace/src/appsec/blocking.js +10 -1
- package/packages/dd-trace/src/appsec/channels.js +4 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +1 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/code-injection-analyzer.js +16 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +2 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/csi-methods.js +2 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +11 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/code-injection-sensitive-analyzer.js +25 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-regex.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +1 -0
- package/packages/dd-trace/src/appsec/index.js +12 -7
- package/packages/dd-trace/src/appsec/rasp.js +121 -7
- package/packages/dd-trace/src/appsec/recommended.json +220 -2
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +40 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -4
- 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 +8 -7
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -4
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -4
- package/packages/dd-trace/src/ci-visibility/telemetry.js +29 -2
- package/packages/dd-trace/src/config.js +158 -153
- package/packages/dd-trace/src/data_streams.js +44 -0
- package/packages/dd-trace/src/datastreams/pathway.js +4 -2
- package/packages/dd-trace/src/log/index.js +32 -0
- package/packages/dd-trace/src/opentelemetry/context_manager.js +22 -39
- package/packages/dd-trace/src/opentelemetry/span_context.js +2 -2
- package/packages/dd-trace/src/opentelemetry/tracer.js +23 -14
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +9 -1
- package/packages/dd-trace/src/opentracing/propagation/log.js +1 -1
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +60 -0
- package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +43 -0
- package/packages/dd-trace/src/opentracing/span_context.js +1 -0
- package/packages/dd-trace/src/opentracing/tracer.js +10 -6
- package/packages/dd-trace/src/plugins/ci_plugin.js +11 -4
- package/packages/dd-trace/src/plugins/index.js +1 -0
- package/packages/dd-trace/src/plugins/plugin.js +12 -1
- package/packages/dd-trace/src/plugins/util/git.js +14 -1
- package/packages/dd-trace/src/proxy.js +1 -0
- package/packages/dd-trace/src/telemetry/index.js +1 -1
- package/packages/dd-trace/src/tracer.js +2 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "2.2",
|
|
3
3
|
"metadata": {
|
|
4
|
-
"rules_version": "1.
|
|
4
|
+
"rules_version": "1.13.0"
|
|
5
5
|
},
|
|
6
6
|
"rules": [
|
|
7
7
|
{
|
|
@@ -6285,6 +6285,55 @@
|
|
|
6285
6285
|
"stack_trace"
|
|
6286
6286
|
]
|
|
6287
6287
|
},
|
|
6288
|
+
{
|
|
6289
|
+
"id": "rasp-932-100",
|
|
6290
|
+
"name": "Shell injection exploit",
|
|
6291
|
+
"enabled": false,
|
|
6292
|
+
"tags": {
|
|
6293
|
+
"type": "command_injection",
|
|
6294
|
+
"category": "vulnerability_trigger",
|
|
6295
|
+
"cwe": "77",
|
|
6296
|
+
"capec": "1000/152/248/88",
|
|
6297
|
+
"confidence": "0",
|
|
6298
|
+
"module": "rasp"
|
|
6299
|
+
},
|
|
6300
|
+
"conditions": [
|
|
6301
|
+
{
|
|
6302
|
+
"parameters": {
|
|
6303
|
+
"resource": [
|
|
6304
|
+
{
|
|
6305
|
+
"address": "server.sys.shell.cmd"
|
|
6306
|
+
}
|
|
6307
|
+
],
|
|
6308
|
+
"params": [
|
|
6309
|
+
{
|
|
6310
|
+
"address": "server.request.query"
|
|
6311
|
+
},
|
|
6312
|
+
{
|
|
6313
|
+
"address": "server.request.body"
|
|
6314
|
+
},
|
|
6315
|
+
{
|
|
6316
|
+
"address": "server.request.path_params"
|
|
6317
|
+
},
|
|
6318
|
+
{
|
|
6319
|
+
"address": "grpc.server.request.message"
|
|
6320
|
+
},
|
|
6321
|
+
{
|
|
6322
|
+
"address": "graphql.server.all_resolvers"
|
|
6323
|
+
},
|
|
6324
|
+
{
|
|
6325
|
+
"address": "graphql.server.resolver"
|
|
6326
|
+
}
|
|
6327
|
+
]
|
|
6328
|
+
},
|
|
6329
|
+
"operator": "shi_detector"
|
|
6330
|
+
}
|
|
6331
|
+
],
|
|
6332
|
+
"transformers": [],
|
|
6333
|
+
"on_match": [
|
|
6334
|
+
"stack_trace"
|
|
6335
|
+
]
|
|
6336
|
+
},
|
|
6288
6337
|
{
|
|
6289
6338
|
"id": "rasp-934-100",
|
|
6290
6339
|
"name": "Server-side request forgery exploit",
|
|
@@ -8388,6 +8437,57 @@
|
|
|
8388
8437
|
}
|
|
8389
8438
|
],
|
|
8390
8439
|
"processors": [
|
|
8440
|
+
{
|
|
8441
|
+
"id": "http-endpoint-fingerprint",
|
|
8442
|
+
"generator": "http_endpoint_fingerprint",
|
|
8443
|
+
"conditions": [
|
|
8444
|
+
{
|
|
8445
|
+
"operator": "exists",
|
|
8446
|
+
"parameters": {
|
|
8447
|
+
"inputs": [
|
|
8448
|
+
{
|
|
8449
|
+
"address": "waf.context.event"
|
|
8450
|
+
},
|
|
8451
|
+
{
|
|
8452
|
+
"address": "server.business_logic.users.login.failure"
|
|
8453
|
+
},
|
|
8454
|
+
{
|
|
8455
|
+
"address": "server.business_logic.users.login.success"
|
|
8456
|
+
}
|
|
8457
|
+
]
|
|
8458
|
+
}
|
|
8459
|
+
}
|
|
8460
|
+
],
|
|
8461
|
+
"parameters": {
|
|
8462
|
+
"mappings": [
|
|
8463
|
+
{
|
|
8464
|
+
"method": [
|
|
8465
|
+
{
|
|
8466
|
+
"address": "server.request.method"
|
|
8467
|
+
}
|
|
8468
|
+
],
|
|
8469
|
+
"uri_raw": [
|
|
8470
|
+
{
|
|
8471
|
+
"address": "server.request.uri.raw"
|
|
8472
|
+
}
|
|
8473
|
+
],
|
|
8474
|
+
"body": [
|
|
8475
|
+
{
|
|
8476
|
+
"address": "server.request.body"
|
|
8477
|
+
}
|
|
8478
|
+
],
|
|
8479
|
+
"query": [
|
|
8480
|
+
{
|
|
8481
|
+
"address": "server.request.query"
|
|
8482
|
+
}
|
|
8483
|
+
],
|
|
8484
|
+
"output": "_dd.appsec.fp.http.endpoint"
|
|
8485
|
+
}
|
|
8486
|
+
]
|
|
8487
|
+
},
|
|
8488
|
+
"evaluate": false,
|
|
8489
|
+
"output": true
|
|
8490
|
+
},
|
|
8391
8491
|
{
|
|
8392
8492
|
"id": "extract-content",
|
|
8393
8493
|
"generator": "extract_schema",
|
|
@@ -8537,6 +8637,124 @@
|
|
|
8537
8637
|
},
|
|
8538
8638
|
"evaluate": false,
|
|
8539
8639
|
"output": true
|
|
8640
|
+
},
|
|
8641
|
+
{
|
|
8642
|
+
"id": "http-header-fingerprint",
|
|
8643
|
+
"generator": "http_header_fingerprint",
|
|
8644
|
+
"conditions": [
|
|
8645
|
+
{
|
|
8646
|
+
"operator": "exists",
|
|
8647
|
+
"parameters": {
|
|
8648
|
+
"inputs": [
|
|
8649
|
+
{
|
|
8650
|
+
"address": "waf.context.event"
|
|
8651
|
+
},
|
|
8652
|
+
{
|
|
8653
|
+
"address": "server.business_logic.users.login.failure"
|
|
8654
|
+
},
|
|
8655
|
+
{
|
|
8656
|
+
"address": "server.business_logic.users.login.success"
|
|
8657
|
+
}
|
|
8658
|
+
]
|
|
8659
|
+
}
|
|
8660
|
+
}
|
|
8661
|
+
],
|
|
8662
|
+
"parameters": {
|
|
8663
|
+
"mappings": [
|
|
8664
|
+
{
|
|
8665
|
+
"headers": [
|
|
8666
|
+
{
|
|
8667
|
+
"address": "server.request.headers.no_cookies"
|
|
8668
|
+
}
|
|
8669
|
+
],
|
|
8670
|
+
"output": "_dd.appsec.fp.http.header"
|
|
8671
|
+
}
|
|
8672
|
+
]
|
|
8673
|
+
},
|
|
8674
|
+
"evaluate": false,
|
|
8675
|
+
"output": true
|
|
8676
|
+
},
|
|
8677
|
+
{
|
|
8678
|
+
"id": "http-network-fingerprint",
|
|
8679
|
+
"generator": "http_network_fingerprint",
|
|
8680
|
+
"conditions": [
|
|
8681
|
+
{
|
|
8682
|
+
"operator": "exists",
|
|
8683
|
+
"parameters": {
|
|
8684
|
+
"inputs": [
|
|
8685
|
+
{
|
|
8686
|
+
"address": "waf.context.event"
|
|
8687
|
+
},
|
|
8688
|
+
{
|
|
8689
|
+
"address": "server.business_logic.users.login.failure"
|
|
8690
|
+
},
|
|
8691
|
+
{
|
|
8692
|
+
"address": "server.business_logic.users.login.success"
|
|
8693
|
+
}
|
|
8694
|
+
]
|
|
8695
|
+
}
|
|
8696
|
+
}
|
|
8697
|
+
],
|
|
8698
|
+
"parameters": {
|
|
8699
|
+
"mappings": [
|
|
8700
|
+
{
|
|
8701
|
+
"headers": [
|
|
8702
|
+
{
|
|
8703
|
+
"address": "server.request.headers.no_cookies"
|
|
8704
|
+
}
|
|
8705
|
+
],
|
|
8706
|
+
"output": "_dd.appsec.fp.http.network"
|
|
8707
|
+
}
|
|
8708
|
+
]
|
|
8709
|
+
},
|
|
8710
|
+
"evaluate": false,
|
|
8711
|
+
"output": true
|
|
8712
|
+
},
|
|
8713
|
+
{
|
|
8714
|
+
"id": "session-fingerprint",
|
|
8715
|
+
"generator": "session_fingerprint",
|
|
8716
|
+
"conditions": [
|
|
8717
|
+
{
|
|
8718
|
+
"operator": "exists",
|
|
8719
|
+
"parameters": {
|
|
8720
|
+
"inputs": [
|
|
8721
|
+
{
|
|
8722
|
+
"address": "waf.context.event"
|
|
8723
|
+
},
|
|
8724
|
+
{
|
|
8725
|
+
"address": "server.business_logic.users.login.failure"
|
|
8726
|
+
},
|
|
8727
|
+
{
|
|
8728
|
+
"address": "server.business_logic.users.login.success"
|
|
8729
|
+
}
|
|
8730
|
+
]
|
|
8731
|
+
}
|
|
8732
|
+
}
|
|
8733
|
+
],
|
|
8734
|
+
"parameters": {
|
|
8735
|
+
"mappings": [
|
|
8736
|
+
{
|
|
8737
|
+
"cookies": [
|
|
8738
|
+
{
|
|
8739
|
+
"address": "server.request.cookies"
|
|
8740
|
+
}
|
|
8741
|
+
],
|
|
8742
|
+
"session_id": [
|
|
8743
|
+
{
|
|
8744
|
+
"address": "usr.session_id"
|
|
8745
|
+
}
|
|
8746
|
+
],
|
|
8747
|
+
"user_id": [
|
|
8748
|
+
{
|
|
8749
|
+
"address": "usr.id"
|
|
8750
|
+
}
|
|
8751
|
+
],
|
|
8752
|
+
"output": "_dd.appsec.fp.session"
|
|
8753
|
+
}
|
|
8754
|
+
]
|
|
8755
|
+
},
|
|
8756
|
+
"evaluate": false,
|
|
8757
|
+
"output": true
|
|
8540
8758
|
}
|
|
8541
8759
|
],
|
|
8542
8760
|
"scanners": [
|
|
@@ -9562,4 +9780,4 @@
|
|
|
9562
9780
|
}
|
|
9563
9781
|
}
|
|
9564
9782
|
]
|
|
9565
|
-
}
|
|
9783
|
+
}
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
const request = require('../../exporters/common/request')
|
|
2
2
|
const id = require('../../id')
|
|
3
|
+
const log = require('../../log')
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
incrementCountMetric,
|
|
7
|
+
distributionMetric,
|
|
8
|
+
TELEMETRY_KNOWN_TESTS,
|
|
9
|
+
TELEMETRY_KNOWN_TESTS_MS,
|
|
10
|
+
TELEMETRY_KNOWN_TESTS_ERRORS,
|
|
11
|
+
TELEMETRY_KNOWN_TESTS_RESPONSE_TESTS,
|
|
12
|
+
TELEMETRY_KNOWN_TESTS_RESPONSE_BYTES
|
|
13
|
+
} = require('../../ci-visibility/telemetry')
|
|
14
|
+
|
|
15
|
+
function getNumTests (knownTests) {
|
|
16
|
+
let totalNumTests = 0
|
|
17
|
+
|
|
18
|
+
for (const testModule of Object.values(knownTests)) {
|
|
19
|
+
for (const testSuite of Object.values(testModule)) {
|
|
20
|
+
for (const testList of Object.values(testSuite)) {
|
|
21
|
+
totalNumTests += testList.length
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return totalNumTests
|
|
27
|
+
}
|
|
3
28
|
|
|
4
29
|
function getKnownTests ({
|
|
5
30
|
url,
|
|
@@ -64,12 +89,26 @@ function getKnownTests ({
|
|
|
64
89
|
}
|
|
65
90
|
})
|
|
66
91
|
|
|
67
|
-
|
|
92
|
+
incrementCountMetric(TELEMETRY_KNOWN_TESTS)
|
|
93
|
+
|
|
94
|
+
const startTime = Date.now()
|
|
95
|
+
|
|
96
|
+
request(data, options, (err, res, statusCode) => {
|
|
97
|
+
distributionMetric(TELEMETRY_KNOWN_TESTS_MS, {}, Date.now() - startTime)
|
|
68
98
|
if (err) {
|
|
99
|
+
incrementCountMetric(TELEMETRY_KNOWN_TESTS_ERRORS, { statusCode })
|
|
69
100
|
done(err)
|
|
70
101
|
} else {
|
|
71
102
|
try {
|
|
72
103
|
const { data: { attributes: { tests: knownTests } } } = JSON.parse(res)
|
|
104
|
+
|
|
105
|
+
const numTests = getNumTests(knownTests)
|
|
106
|
+
|
|
107
|
+
incrementCountMetric(TELEMETRY_KNOWN_TESTS_RESPONSE_TESTS, {}, numTests)
|
|
108
|
+
distributionMetric(TELEMETRY_KNOWN_TESTS_RESPONSE_BYTES, {}, res.length)
|
|
109
|
+
|
|
110
|
+
log.debug(() => `Number of received known tests: ${numTests}`)
|
|
111
|
+
|
|
73
112
|
done(null, knownTests)
|
|
74
113
|
} catch (err) {
|
|
75
114
|
done(err)
|
|
@@ -12,8 +12,7 @@ const {
|
|
|
12
12
|
TELEMETRY_ENDPOINT_PAYLOAD_BYTES,
|
|
13
13
|
TELEMETRY_ENDPOINT_PAYLOAD_REQUESTS_MS,
|
|
14
14
|
TELEMETRY_ENDPOINT_PAYLOAD_REQUESTS_ERRORS,
|
|
15
|
-
TELEMETRY_ENDPOINT_PAYLOAD_DROPPED
|
|
16
|
-
getErrorTypeFromStatusCode
|
|
15
|
+
TELEMETRY_ENDPOINT_PAYLOAD_DROPPED
|
|
17
16
|
} = require('../../../ci-visibility/telemetry')
|
|
18
17
|
|
|
19
18
|
class Writer extends BaseWriter {
|
|
@@ -56,10 +55,9 @@ class Writer extends BaseWriter {
|
|
|
56
55
|
Date.now() - startRequestTime
|
|
57
56
|
)
|
|
58
57
|
if (err) {
|
|
59
|
-
const errorType = getErrorTypeFromStatusCode(statusCode)
|
|
60
58
|
incrementCountMetric(
|
|
61
59
|
TELEMETRY_ENDPOINT_PAYLOAD_REQUESTS_ERRORS,
|
|
62
|
-
{ endpoint: 'code_coverage',
|
|
60
|
+
{ endpoint: 'code_coverage', statusCode }
|
|
63
61
|
)
|
|
64
62
|
incrementCountMetric(
|
|
65
63
|
TELEMETRY_ENDPOINT_PAYLOAD_DROPPED,
|
|
@@ -12,8 +12,7 @@ const {
|
|
|
12
12
|
TELEMETRY_ENDPOINT_PAYLOAD_BYTES,
|
|
13
13
|
TELEMETRY_ENDPOINT_PAYLOAD_REQUESTS_MS,
|
|
14
14
|
TELEMETRY_ENDPOINT_PAYLOAD_REQUESTS_ERRORS,
|
|
15
|
-
TELEMETRY_ENDPOINT_PAYLOAD_DROPPED
|
|
16
|
-
getErrorTypeFromStatusCode
|
|
15
|
+
TELEMETRY_ENDPOINT_PAYLOAD_DROPPED
|
|
17
16
|
} = require('../../../ci-visibility/telemetry')
|
|
18
17
|
|
|
19
18
|
class Writer extends BaseWriter {
|
|
@@ -57,10 +56,9 @@ class Writer extends BaseWriter {
|
|
|
57
56
|
Date.now() - startRequestTime
|
|
58
57
|
)
|
|
59
58
|
if (err) {
|
|
60
|
-
const errorType = getErrorTypeFromStatusCode(statusCode)
|
|
61
59
|
incrementCountMetric(
|
|
62
60
|
TELEMETRY_ENDPOINT_PAYLOAD_REQUESTS_ERRORS,
|
|
63
|
-
{ endpoint: 'test_cycle',
|
|
61
|
+
{ endpoint: 'test_cycle', statusCode }
|
|
64
62
|
)
|
|
65
63
|
incrementCountMetric(
|
|
66
64
|
TELEMETRY_ENDPOINT_PAYLOAD_DROPPED,
|
|
@@ -11,7 +11,8 @@ const {
|
|
|
11
11
|
generatePackFilesForCommits,
|
|
12
12
|
getCommitsRevList,
|
|
13
13
|
isShallowRepository,
|
|
14
|
-
unshallowRepository
|
|
14
|
+
unshallowRepository,
|
|
15
|
+
isGitAvailable
|
|
15
16
|
} = require('../../../plugins/util/git')
|
|
16
17
|
|
|
17
18
|
const {
|
|
@@ -24,8 +25,7 @@ const {
|
|
|
24
25
|
TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES,
|
|
25
26
|
TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES_MS,
|
|
26
27
|
TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES_ERRORS,
|
|
27
|
-
TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES_BYTES
|
|
28
|
-
getErrorTypeFromStatusCode
|
|
28
|
+
TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES_BYTES
|
|
29
29
|
} = require('../../../ci-visibility/telemetry')
|
|
30
30
|
|
|
31
31
|
const isValidSha1 = (sha) => /^[0-9a-f]{40}$/.test(sha)
|
|
@@ -92,8 +92,7 @@ function getCommitsToUpload ({ url, repositoryUrl, latestCommits, isEvpProxy, ev
|
|
|
92
92
|
request(localCommitData, options, (err, response, statusCode) => {
|
|
93
93
|
distributionMetric(TELEMETRY_GIT_REQUESTS_SEARCH_COMMITS_MS, {}, Date.now() - startTime)
|
|
94
94
|
if (err) {
|
|
95
|
-
|
|
96
|
-
incrementCountMetric(TELEMETRY_GIT_REQUESTS_SEARCH_COMMITS_ERRORS, { errorType })
|
|
95
|
+
incrementCountMetric(TELEMETRY_GIT_REQUESTS_SEARCH_COMMITS_ERRORS, { statusCode })
|
|
97
96
|
const error = new Error(`Error fetching commits to exclude: ${err.message}`)
|
|
98
97
|
return callback(error)
|
|
99
98
|
}
|
|
@@ -178,8 +177,7 @@ function uploadPackFile ({ url, isEvpProxy, evpProxyPrefix, packFileToUpload, re
|
|
|
178
177
|
request(form, options, (err, _, statusCode) => {
|
|
179
178
|
distributionMetric(TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES_MS, {}, Date.now() - startTime)
|
|
180
179
|
if (err) {
|
|
181
|
-
|
|
182
|
-
incrementCountMetric(TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES_ERRORS, { errorType })
|
|
180
|
+
incrementCountMetric(TELEMETRY_GIT_REQUESTS_OBJECT_PACKFILES_ERRORS, { statusCode })
|
|
183
181
|
const error = new Error(`Could not upload packfiles: status code ${statusCode}: ${err.message}`)
|
|
184
182
|
return callback(error, uploadSize)
|
|
185
183
|
}
|
|
@@ -245,6 +243,9 @@ function generateAndUploadPackFiles ({
|
|
|
245
243
|
* This function uploads git metadata to CI Visibility's backend.
|
|
246
244
|
*/
|
|
247
245
|
function sendGitMetadata (url, { isEvpProxy, evpProxyPrefix }, configRepositoryUrl, callback) {
|
|
246
|
+
if (!isGitAvailable()) {
|
|
247
|
+
return callback(new Error('Git is not available'))
|
|
248
|
+
}
|
|
248
249
|
let repositoryUrl = configRepositoryUrl
|
|
249
250
|
if (!repositoryUrl) {
|
|
250
251
|
repositoryUrl = getRepositoryUrl()
|
|
@@ -8,8 +8,7 @@ const {
|
|
|
8
8
|
TELEMETRY_ITR_SKIPPABLE_TESTS_ERRORS,
|
|
9
9
|
TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_SUITES,
|
|
10
10
|
TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS,
|
|
11
|
-
TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES
|
|
12
|
-
getErrorTypeFromStatusCode
|
|
11
|
+
TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES
|
|
13
12
|
} = require('../../ci-visibility/telemetry')
|
|
14
13
|
|
|
15
14
|
function getSkippableSuites ({
|
|
@@ -83,8 +82,7 @@ function getSkippableSuites ({
|
|
|
83
82
|
request(data, options, (err, res, statusCode) => {
|
|
84
83
|
distributionMetric(TELEMETRY_ITR_SKIPPABLE_TESTS_MS, {}, Date.now() - startTime)
|
|
85
84
|
if (err) {
|
|
86
|
-
|
|
87
|
-
incrementCountMetric(TELEMETRY_ITR_SKIPPABLE_TESTS_ERRORS, { errorType })
|
|
85
|
+
incrementCountMetric(TELEMETRY_ITR_SKIPPABLE_TESTS_ERRORS, { statusCode })
|
|
88
86
|
done(err)
|
|
89
87
|
} else {
|
|
90
88
|
let skippableSuites = []
|
|
@@ -7,8 +7,7 @@ const {
|
|
|
7
7
|
TELEMETRY_GIT_REQUESTS_SETTINGS,
|
|
8
8
|
TELEMETRY_GIT_REQUESTS_SETTINGS_MS,
|
|
9
9
|
TELEMETRY_GIT_REQUESTS_SETTINGS_ERRORS,
|
|
10
|
-
TELEMETRY_GIT_REQUESTS_SETTINGS_RESPONSE
|
|
11
|
-
getErrorTypeFromStatusCode
|
|
10
|
+
TELEMETRY_GIT_REQUESTS_SETTINGS_RESPONSE
|
|
12
11
|
} = require('../telemetry')
|
|
13
12
|
|
|
14
13
|
const DEFAULT_EARLY_FLAKE_DETECTION_NUM_RETRIES = 2
|
|
@@ -81,8 +80,7 @@ function getLibraryConfiguration ({
|
|
|
81
80
|
request(data, options, (err, res, statusCode) => {
|
|
82
81
|
distributionMetric(TELEMETRY_GIT_REQUESTS_SETTINGS_MS, {}, Date.now() - startTime)
|
|
83
82
|
if (err) {
|
|
84
|
-
|
|
85
|
-
incrementCountMetric(TELEMETRY_GIT_REQUESTS_SETTINGS_ERRORS, { errorType })
|
|
83
|
+
incrementCountMetric(TELEMETRY_GIT_REQUESTS_SETTINGS_ERRORS, { statusCode })
|
|
86
84
|
done(err)
|
|
87
85
|
} else {
|
|
88
86
|
try {
|
|
@@ -10,13 +10,24 @@ const formattedTags = {
|
|
|
10
10
|
isCodeCoverageEnabled: 'coverage_enabled',
|
|
11
11
|
isSuitesSkippingEnabled: 'itrskip_enabled',
|
|
12
12
|
hasCodeOwners: 'has_code_owners',
|
|
13
|
-
isUnsupportedCIProvider: 'is_unsupported_ci'
|
|
13
|
+
isUnsupportedCIProvider: 'is_unsupported_ci',
|
|
14
|
+
isNew: 'is_new',
|
|
15
|
+
isRum: 'is_rum',
|
|
16
|
+
browserDriver: 'browser_driver'
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
// Transform tags dictionary to array of strings.
|
|
17
20
|
// If tag value is true, then only tag key is added to the array.
|
|
18
21
|
function formatMetricTags (tagsDictionary) {
|
|
19
22
|
return Object.keys(tagsDictionary).reduce((acc, tagKey) => {
|
|
23
|
+
if (tagKey === 'statusCode') {
|
|
24
|
+
const statusCode = tagsDictionary[tagKey]
|
|
25
|
+
if (isStatusCode400(statusCode)) {
|
|
26
|
+
acc.push(`status_code:${statusCode}`)
|
|
27
|
+
}
|
|
28
|
+
acc.push(`error_type:${getErrorTypeFromStatusCode(statusCode)}`)
|
|
29
|
+
return acc
|
|
30
|
+
}
|
|
20
31
|
const formattedTagKey = formattedTags[tagKey] || tagKey
|
|
21
32
|
if (tagsDictionary[tagKey] === true) {
|
|
22
33
|
acc.push(formattedTagKey)
|
|
@@ -36,6 +47,7 @@ function distributionMetric (name, tags, measure) {
|
|
|
36
47
|
}
|
|
37
48
|
|
|
38
49
|
// CI Visibility telemetry events
|
|
50
|
+
const TELEMETRY_TEST_SESSION = 'test_session'
|
|
39
51
|
const TELEMETRY_EVENT_CREATED = 'event_created'
|
|
40
52
|
const TELEMETRY_EVENT_FINISHED = 'event_finished'
|
|
41
53
|
const TELEMETRY_CODE_COVERAGE_STARTED = 'code_coverage_started'
|
|
@@ -74,6 +86,16 @@ const TELEMETRY_ITR_SKIPPABLE_TESTS_ERRORS = 'itr_skippable_tests.request_errors
|
|
|
74
86
|
const TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_SUITES = 'itr_skippable_tests.response_suites'
|
|
75
87
|
const TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS = 'itr_skippable_tests.response_tests'
|
|
76
88
|
const TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES = 'itr_skippable_tests.response_bytes'
|
|
89
|
+
// early flake detection
|
|
90
|
+
const TELEMETRY_KNOWN_TESTS = 'early_flake_detection.request'
|
|
91
|
+
const TELEMETRY_KNOWN_TESTS_MS = 'early_flake_detection.request_ms'
|
|
92
|
+
const TELEMETRY_KNOWN_TESTS_ERRORS = 'early_flake_detection.request_errors'
|
|
93
|
+
const TELEMETRY_KNOWN_TESTS_RESPONSE_TESTS = 'early_flake_detection.response_tests'
|
|
94
|
+
const TELEMETRY_KNOWN_TESTS_RESPONSE_BYTES = 'early_flake_detection.response_bytes'
|
|
95
|
+
|
|
96
|
+
function isStatusCode400 (statusCode) {
|
|
97
|
+
return statusCode >= 400 && statusCode < 500
|
|
98
|
+
}
|
|
77
99
|
|
|
78
100
|
function getErrorTypeFromStatusCode (statusCode) {
|
|
79
101
|
if (statusCode >= 400 && statusCode < 500) {
|
|
@@ -88,6 +110,7 @@ function getErrorTypeFromStatusCode (statusCode) {
|
|
|
88
110
|
module.exports = {
|
|
89
111
|
incrementCountMetric,
|
|
90
112
|
distributionMetric,
|
|
113
|
+
TELEMETRY_TEST_SESSION,
|
|
91
114
|
TELEMETRY_EVENT_CREATED,
|
|
92
115
|
TELEMETRY_EVENT_FINISHED,
|
|
93
116
|
TELEMETRY_CODE_COVERAGE_STARTED,
|
|
@@ -126,5 +149,9 @@ module.exports = {
|
|
|
126
149
|
TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_SUITES,
|
|
127
150
|
TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_TESTS,
|
|
128
151
|
TELEMETRY_ITR_SKIPPABLE_TESTS_RESPONSE_BYTES,
|
|
129
|
-
|
|
152
|
+
TELEMETRY_KNOWN_TESTS,
|
|
153
|
+
TELEMETRY_KNOWN_TESTS_MS,
|
|
154
|
+
TELEMETRY_KNOWN_TESTS_ERRORS,
|
|
155
|
+
TELEMETRY_KNOWN_TESTS_RESPONSE_TESTS,
|
|
156
|
+
TELEMETRY_KNOWN_TESTS_RESPONSE_BYTES
|
|
130
157
|
}
|