dd-trace 5.98.0 → 5.99.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/ext/tags.js +1 -0
- package/index.d.ts +9 -1
- package/package.json +48 -46
- package/packages/datadog-instrumentations/src/crypto.js +45 -0
- package/packages/datadog-instrumentations/src/cypress-config.js +122 -16
- package/packages/datadog-instrumentations/src/dns.js +24 -56
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +74 -0
- package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +4 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +10 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-sdk.js +59 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +11 -2
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +7 -0
- package/packages/datadog-instrumentations/src/pino.js +4 -28
- package/packages/datadog-instrumentations/src/playwright-browser-scripts.js +27 -0
- package/packages/datadog-instrumentations/src/playwright.js +5 -17
- package/packages/datadog-instrumentations/src/stripe.js +38 -24
- package/packages/datadog-instrumentations/src/vitest.js +32 -4
- package/packages/datadog-instrumentations/src/zlib.js +29 -0
- package/packages/datadog-plugin-aws-sdk/src/base.js +1 -2
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +8 -15
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +4 -9
- package/packages/datadog-plugin-cucumber/src/index.js +2 -2
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +5 -5
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +48 -1
- package/packages/datadog-plugin-http/src/server.js +11 -11
- package/packages/datadog-plugin-jest/src/index.js +2 -2
- package/packages/datadog-plugin-mocha/src/index.js +1 -2
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/index.js +24 -0
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +55 -0
- package/packages/datadog-plugin-mongodb-core/src/index.js +1 -6
- package/packages/datadog-plugin-playwright/src/index.js +2 -3
- package/packages/datadog-plugin-vitest/src/index.js +14 -6
- package/packages/datadog-plugin-ws/src/close.js +2 -0
- package/packages/datadog-plugin-ws/src/producer.js +2 -0
- package/packages/datadog-plugin-ws/src/receiver.js +1 -0
- package/packages/dd-trace/src/aiguard/channels.js +8 -0
- package/packages/dd-trace/src/aiguard/index.js +7 -3
- package/packages/dd-trace/src/aiguard/sdk.js +44 -0
- package/packages/dd-trace/src/aiguard/tags.js +1 -0
- package/packages/dd-trace/src/appsec/graphql.js +6 -6
- package/packages/dd-trace/src/appsec/index.js +9 -11
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -5
- package/packages/dd-trace/src/appsec/rasp/lfi.js +8 -4
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +5 -10
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +5 -6
- package/packages/dd-trace/src/appsec/recommended.json +2438 -13
- package/packages/dd-trace/src/appsec/reporter.js +6 -5
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +4 -8
- package/packages/dd-trace/src/appsec/store.js +50 -0
- package/packages/dd-trace/src/appsec/waf/index.js +3 -5
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -4
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +2 -2
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +4 -5
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +3 -4
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +6 -6
- package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +2 -2
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +2 -2
- package/packages/dd-trace/src/config/config-types.d.ts +0 -4
- package/packages/dd-trace/src/config/defaults.js +10 -10
- package/packages/dd-trace/src/config/generated-config-types.d.ts +13 -12
- package/packages/dd-trace/src/config/index.js +25 -35
- package/packages/dd-trace/src/config/parsers.js +26 -9
- package/packages/dd-trace/src/config/supported-configurations.json +32 -36
- package/packages/dd-trace/src/debugger/config.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/send.js +25 -5
- package/packages/dd-trace/src/encode/0.4.js +4 -5
- package/packages/dd-trace/src/exporters/agent/index.js +0 -1
- package/packages/dd-trace/src/exporters/agent/writer.js +1 -2
- package/packages/dd-trace/src/exporters/agentless/writer.js +3 -3
- package/packages/dd-trace/src/exporters/common/util.js +2 -2
- package/packages/dd-trace/src/id.js +2 -0
- package/packages/dd-trace/src/index.js +2 -5
- package/packages/dd-trace/src/lambda/handler.js +1 -3
- package/packages/dd-trace/src/llmobs/plugins/{anthropic.js → anthropic/index.js} +5 -63
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +106 -0
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +3 -2
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +3 -2
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +2 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +0 -49
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +2 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/messages.js +76 -0
- package/packages/dd-trace/src/llmobs/plugins/langgraph/index.js +1 -26
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +68 -0
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +57 -0
- package/packages/dd-trace/src/llmobs/sdk.js +2 -2
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +103 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +3 -0
- package/packages/dd-trace/src/opentelemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +3 -2
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +3 -2
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -66
- package/packages/dd-trace/src/opentelemetry/trace/index.js +11 -16
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +11 -3
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +51 -41
- package/packages/dd-trace/src/opentelemetry/tracer.js +9 -11
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +17 -10
- package/packages/dd-trace/src/opentracing/span.js +1 -1
- package/packages/dd-trace/src/opentracing/tracer.js +12 -5
- package/packages/dd-trace/src/plugins/index.js +1 -0
- package/packages/dd-trace/src/plugins/util/test.js +126 -5
- package/packages/dd-trace/src/plugins/util/url.js +2 -1
- package/packages/dd-trace/src/profiling/profilers/event_plugins/crypto.js +32 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/zlib.js +19 -0
- package/packages/dd-trace/src/profiling/profilers/events.js +35 -0
- package/packages/dd-trace/src/proxy.js +2 -8
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +2 -2
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +4 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +4 -0
- package/packages/dd-trace/src/span_processor.js +1 -2
- package/packages/dd-trace/src/tagger.js +2 -2
- package/packages/dd-trace/src/telemetry/send-data.js +5 -7
- package/packages/dd-trace/src/tracer.js +2 -2
- package/vendor/dist/ignore/LICENSE +0 -21
- package/vendor/dist/ignore/index.js +0 -1
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
const zlib = require('zlib')
|
|
4
4
|
const dc = require('dc-polyfill')
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const { NETWORK_CLIENT_IP } = require('../../../../ext/tags')
|
|
7
7
|
const web = require('../plugins/util/web')
|
|
8
8
|
const { ipHeaderList } = require('../plugins/util/ip_extractor')
|
|
9
9
|
const { keepTrace } = require('../priority_sampler')
|
|
10
10
|
const { ASM } = require('../standalone/product')
|
|
11
|
+
const { getActiveRequest } = require('./store')
|
|
11
12
|
const {
|
|
12
13
|
incrementWafInitMetric,
|
|
13
14
|
incrementWafUpdatesMetric,
|
|
@@ -302,7 +303,7 @@ function reportWafConfigUpdate (product, rcConfigId, diagnostics, wafVersion) {
|
|
|
302
303
|
|
|
303
304
|
function reportMetrics (metrics, raspRule, req) {
|
|
304
305
|
if (!req) {
|
|
305
|
-
req =
|
|
306
|
+
req = getActiveRequest()
|
|
306
307
|
}
|
|
307
308
|
const rootSpan = req && web.root(req)
|
|
308
309
|
|
|
@@ -337,7 +338,7 @@ function reportTruncationMetrics (rootSpan, metrics) {
|
|
|
337
338
|
|
|
338
339
|
function reportAttack ({ events: attackData, actions }, req) {
|
|
339
340
|
if (!req) {
|
|
340
|
-
req =
|
|
341
|
+
req = getActiveRequest()
|
|
341
342
|
}
|
|
342
343
|
|
|
343
344
|
const rootSpan = web.root(req)
|
|
@@ -363,7 +364,7 @@ function reportAttack ({ events: attackData, actions }, req) {
|
|
|
363
364
|
: '{"triggers":' + attackDataStr + '}'
|
|
364
365
|
|
|
365
366
|
if (req.socket) {
|
|
366
|
-
newTags[
|
|
367
|
+
newTags[NETWORK_CLIENT_IP] = req.socket.remoteAddress
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
rootSpan.addTags(newTags)
|
|
@@ -481,7 +482,7 @@ function reportAttributes (attributes, req) {
|
|
|
481
482
|
if (!attributes) return
|
|
482
483
|
|
|
483
484
|
if (!req) {
|
|
484
|
-
req =
|
|
485
|
+
req = getActiveRequest()
|
|
485
486
|
}
|
|
486
487
|
|
|
487
488
|
const rootSpan = web.root(req)
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
const { USER_ID } = require('../addresses')
|
|
4
4
|
const waf = require('../waf')
|
|
5
5
|
const { block, getBlockingAction } = require('../blocking')
|
|
6
|
-
const { storage } = require('../../../../datadog-core')
|
|
7
6
|
const log = require('../../log')
|
|
7
|
+
const web = require('../../plugins/util/web')
|
|
8
|
+
const { getActiveRequest } = require('../store')
|
|
8
9
|
const { setUserTags } = require('./set_user')
|
|
9
10
|
const { getRootSpan } = require('./utils')
|
|
10
11
|
|
|
@@ -32,13 +33,8 @@ function checkUserAndSetUser (tracer, user) {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
function blockRequest (tracer, req, res) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (store) {
|
|
38
|
-
req = req || store.req
|
|
39
|
-
res = res || store.res
|
|
40
|
-
}
|
|
41
|
-
}
|
|
36
|
+
req ||= getActiveRequest()
|
|
37
|
+
res ||= req && web.getContext(req)?.res
|
|
42
38
|
|
|
43
39
|
if (!req || !res) {
|
|
44
40
|
log.warn('[ASM] Requests or response object not available in blockRequest')
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { storage } = require('../../../datadog-core')
|
|
4
|
+
|
|
5
|
+
const legacyStorage = storage('legacy')
|
|
6
|
+
|
|
7
|
+
const kReq = Symbol('dd-trace.appsec.req')
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Return a new legacy-storage clone that weakly references `req`.
|
|
11
|
+
*
|
|
12
|
+
* The ref lives on an enumerable symbol key so it survives the
|
|
13
|
+
* `{ ...store, span }` spreads performed by plugin scope handling,
|
|
14
|
+
* while still allowing `req` (and therefore `res`) to be garbage
|
|
15
|
+
* collected once the request is done.
|
|
16
|
+
*
|
|
17
|
+
* @param {object|undefined} store
|
|
18
|
+
* @param {object} req
|
|
19
|
+
* @returns {object}
|
|
20
|
+
*/
|
|
21
|
+
function withRequest (store, req) {
|
|
22
|
+
return { ...store, [kReq]: new WeakRef(req) }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the inbound request attached to a specific legacy store.
|
|
27
|
+
* Prefer {@link getActiveRequest} unless you already have a store in hand.
|
|
28
|
+
*
|
|
29
|
+
* @param {object|undefined} store
|
|
30
|
+
* @returns {object|undefined}
|
|
31
|
+
*/
|
|
32
|
+
function getRequest (store) {
|
|
33
|
+
return store?.[kReq]?.deref()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the inbound request attached to the currently active legacy store.
|
|
38
|
+
* Shortcut for `getRequest(storage('legacy').getStore())`.
|
|
39
|
+
*
|
|
40
|
+
* @returns {object|undefined}
|
|
41
|
+
*/
|
|
42
|
+
function getActiveRequest () {
|
|
43
|
+
return legacyStorage.getStore()?.[kReq]?.deref()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
withRequest,
|
|
48
|
+
getRequest,
|
|
49
|
+
getActiveRequest,
|
|
50
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { storage } = require('../../../../datadog-core')
|
|
4
3
|
const log = require('../../log')
|
|
5
4
|
const Reporter = require('../reporter')
|
|
6
5
|
const Limiter = require('../../rate_limiter')
|
|
7
6
|
const { keepTrace } = require('../../priority_sampler')
|
|
8
7
|
const { ASM } = require('../../standalone/product')
|
|
9
8
|
const web = require('../../plugins/util/web')
|
|
9
|
+
const { getActiveRequest } = require('../store')
|
|
10
10
|
const { updateRateLimitedMetric } = require('../telemetry')
|
|
11
11
|
|
|
12
12
|
class WafUpdateError extends Error {
|
|
@@ -112,13 +112,11 @@ function removeConfig (configPath) {
|
|
|
112
112
|
|
|
113
113
|
function run (data, req, raspRule) {
|
|
114
114
|
if (!req) {
|
|
115
|
-
|
|
116
|
-
if (!
|
|
115
|
+
req = getActiveRequest()
|
|
116
|
+
if (!req) {
|
|
117
117
|
log.warn('[ASM] Request object not available in waf.run')
|
|
118
118
|
return
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
req = store.req
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
const wafContext = waf.wafManager.getWAFContext(req)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const getConfig = require('../../config')
|
|
3
4
|
const request = require('../requests/request')
|
|
4
5
|
const id = require('../../id')
|
|
5
6
|
const log = require('../../log')
|
|
6
|
-
const { getValueFromEnvSources } = require('../../config/helper')
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
incrementCountMetric,
|
|
@@ -151,7 +151,7 @@ function fetchFromApi ({
|
|
|
151
151
|
options.path = `${evpProxyPrefix}/api/v2/ci/libraries/tests`
|
|
152
152
|
options.headers['X-Datadog-EVP-Subdomain'] = 'api'
|
|
153
153
|
} else {
|
|
154
|
-
const apiKey =
|
|
154
|
+
const { apiKey } = getConfig()
|
|
155
155
|
if (!apiKey) {
|
|
156
156
|
return done(new Error('Known tests were not fetched because Datadog API key is not defined.'))
|
|
157
157
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
const getConfig = require('../../../config')
|
|
2
3
|
const request = require('../../../exporters/common/request')
|
|
3
4
|
const log = require('../../../log')
|
|
4
5
|
const { safeJSONStringify } = require('../../../exporters/common/util')
|
|
5
|
-
const { getValueFromEnvSources } = require('../../../config/helper')
|
|
6
6
|
|
|
7
7
|
const { CoverageCIVisibilityEncoder } = require('../../../encode/coverage-ci-visibility')
|
|
8
8
|
const BaseWriter = require('../../../exporters/common/writer')
|
|
@@ -29,7 +29,7 @@ class Writer extends BaseWriter {
|
|
|
29
29
|
path: '/api/v2/citestcov',
|
|
30
30
|
method: 'POST',
|
|
31
31
|
headers: {
|
|
32
|
-
'dd-api-key':
|
|
32
|
+
'dd-api-key': getConfig().apiKey,
|
|
33
33
|
...form.getHeaders(),
|
|
34
34
|
},
|
|
35
35
|
timeout: 15_000,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
const getConfig = require('../../../config')
|
|
2
3
|
const request = require('../../../exporters/common/request')
|
|
3
4
|
const log = require('../../../log')
|
|
4
5
|
const { safeJSONStringify } = require('../../../exporters/common/util')
|
|
5
6
|
const { JSONEncoder } = require('../../encode/json-encoder')
|
|
6
|
-
const { getValueFromEnvSources } = require('../../../config/helper')
|
|
7
7
|
const { DEBUGGER_INPUT_V1 } = require('../../../debugger/constants')
|
|
8
8
|
|
|
9
9
|
const BaseWriter = require('../../../exporters/common/writer')
|
|
@@ -26,7 +26,7 @@ class DynamicInstrumentationLogsWriter extends BaseWriter {
|
|
|
26
26
|
path: '/api/v2/logs',
|
|
27
27
|
method: 'POST',
|
|
28
28
|
headers: {
|
|
29
|
-
'dd-api-key':
|
|
29
|
+
'dd-api-key': getConfig().apiKey,
|
|
30
30
|
'Content-Type': 'application/json',
|
|
31
31
|
},
|
|
32
32
|
timeout: this.timeout,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
const getConfig = require('../../../config')
|
|
2
3
|
const request = require('../../../exporters/common/request')
|
|
3
4
|
const { safeJSONStringify } = require('../../../exporters/common/util')
|
|
4
5
|
const log = require('../../../log')
|
|
5
|
-
const { getValueFromEnvSources } = require('../../../config/helper')
|
|
6
6
|
|
|
7
7
|
const { AgentlessCiVisibilityEncoder } = require('../../../encode/agentless-ci-visibility')
|
|
8
8
|
const BaseWriter = require('../../../exporters/common/writer')
|
|
@@ -30,7 +30,7 @@ class Writer extends BaseWriter {
|
|
|
30
30
|
path: '/api/v2/citestcycle',
|
|
31
31
|
method: 'POST',
|
|
32
32
|
headers: {
|
|
33
|
-
'dd-api-key':
|
|
33
|
+
'dd-api-key': getConfig().apiKey,
|
|
34
34
|
'Content-Type': 'application/msgpack',
|
|
35
35
|
},
|
|
36
36
|
timeout: 15_000,
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
const fs = require('fs')
|
|
4
4
|
const path = require('path')
|
|
5
5
|
|
|
6
|
+
const getConfig = require('../../../config')
|
|
6
7
|
const FormData = require('../../../exporters/common/form-data')
|
|
7
8
|
const request = require('../../../exporters/common/request')
|
|
8
|
-
const { getValueFromEnvSources } = require('../../../config/helper')
|
|
9
9
|
|
|
10
10
|
const log = require('../../../log')
|
|
11
|
-
const { isFalse } = require('../../../util')
|
|
12
11
|
const {
|
|
13
12
|
getLatestCommits,
|
|
14
13
|
getRepositoryUrl,
|
|
@@ -51,7 +50,7 @@ function getCommonRequestOptions (url) {
|
|
|
51
50
|
return {
|
|
52
51
|
method: 'POST',
|
|
53
52
|
headers: {
|
|
54
|
-
'dd-api-key':
|
|
53
|
+
'dd-api-key': getConfig().apiKey,
|
|
55
54
|
},
|
|
56
55
|
timeout: 15_000,
|
|
57
56
|
url,
|
|
@@ -288,7 +287,7 @@ function sendGitMetadata (url, { isEvpProxy, evpProxyPrefix }, configRepositoryU
|
|
|
288
287
|
}
|
|
289
288
|
// Otherwise we unshallow and get commits to upload again
|
|
290
289
|
log.debug('It is shallow clone, unshallowing...')
|
|
291
|
-
if (
|
|
290
|
+
if (getConfig().DD_CIVISIBILITY_GIT_UNSHALLOW_ENABLED) {
|
|
292
291
|
unshallowRepository(false)
|
|
293
292
|
}
|
|
294
293
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const getConfig = require('../../config')
|
|
3
4
|
const request = require('../requests/request')
|
|
4
5
|
const log = require('../../log')
|
|
5
|
-
const { getValueFromEnvSources } = require('../../config/helper')
|
|
6
6
|
const {
|
|
7
7
|
incrementCountMetric,
|
|
8
8
|
distributionMetric,
|
|
@@ -120,7 +120,7 @@ function fetchFromApi ({
|
|
|
120
120
|
options.path = `${evpProxyPrefix}/api/v2/ci/tests/skippable`
|
|
121
121
|
options.headers['X-Datadog-EVP-Subdomain'] = 'api'
|
|
122
122
|
} else {
|
|
123
|
-
const apiKey =
|
|
123
|
+
const { apiKey } = getConfig()
|
|
124
124
|
if (!apiKey) {
|
|
125
125
|
return done(new Error('Skippable suites were not fetched because Datadog API key is not defined.'))
|
|
126
126
|
}
|
|
@@ -2,26 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
const Plugin = require('../../plugins/plugin')
|
|
4
4
|
const log = require('../../log')
|
|
5
|
-
const { getValueFromEnvSources } = require('../../config/helper')
|
|
6
5
|
|
|
7
6
|
function getWinstonLogSubmissionParameters (config) {
|
|
8
|
-
const { site, service } = config
|
|
7
|
+
const { site, service, apiKey, DD_AGENTLESS_LOG_SUBMISSION_URL } = config
|
|
9
8
|
|
|
10
9
|
const defaultParameters = {
|
|
11
10
|
host: `http-intake.logs.${site}`,
|
|
12
11
|
path: `/api/v2/logs?ddsource=winston&service=${service}`,
|
|
13
12
|
ssl: true,
|
|
14
13
|
headers: {
|
|
15
|
-
'DD-API-KEY':
|
|
14
|
+
'DD-API-KEY': apiKey,
|
|
16
15
|
},
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
if (!
|
|
18
|
+
if (!DD_AGENTLESS_LOG_SUBMISSION_URL) {
|
|
20
19
|
return defaultParameters
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
try {
|
|
24
|
-
const url = new URL(
|
|
23
|
+
const url = new URL(DD_AGENTLESS_LOG_SUBMISSION_URL)
|
|
25
24
|
return {
|
|
26
25
|
host: url.hostname,
|
|
27
26
|
port: url.port,
|
|
@@ -5,8 +5,8 @@ const path = require('node:path')
|
|
|
5
5
|
const { createHash } = require('node:crypto')
|
|
6
6
|
const { tmpdir } = require('node:os')
|
|
7
7
|
|
|
8
|
+
const getConfig = require('../../config')
|
|
8
9
|
const log = require('../../log')
|
|
9
|
-
const { getValueFromEnvSources } = require('../../config/helper')
|
|
10
10
|
|
|
11
11
|
const CACHE_TTL_MS = 30 * 60 * 1000 // 30 minutes
|
|
12
12
|
const CACHE_LOCK_POLL_MS = 500
|
|
@@ -14,13 +14,12 @@ const CACHE_LOCK_TIMEOUT_MS = 120_000 // 2 minutes
|
|
|
14
14
|
const CACHE_LOCK_HEARTBEAT_MS = 30_000 // 30 seconds
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Returns whether the filesystem cache is enabled via
|
|
17
|
+
* Returns whether the filesystem cache is enabled via config.
|
|
18
18
|
*
|
|
19
19
|
* @returns {boolean}
|
|
20
20
|
*/
|
|
21
21
|
function isCacheEnabled () {
|
|
22
|
-
|
|
23
|
-
return isTrue(getValueFromEnvSources('DD_EXPERIMENTAL_TEST_REQUESTS_FS_CACHE'))
|
|
22
|
+
return getConfig().DD_EXPERIMENTAL_TEST_REQUESTS_FS_CACHE
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const getConfig = require('../../config')
|
|
3
4
|
const id = require('../../id')
|
|
4
5
|
const log = require('../../log')
|
|
5
|
-
const { getValueFromEnvSources } = require('../../config/helper')
|
|
6
6
|
const {
|
|
7
7
|
incrementCountMetric,
|
|
8
8
|
distributionMetric,
|
|
@@ -36,6 +36,7 @@ function getLibraryConfiguration ({
|
|
|
36
36
|
custom,
|
|
37
37
|
tag,
|
|
38
38
|
}, done) {
|
|
39
|
+
const config = getConfig()
|
|
39
40
|
const options = {
|
|
40
41
|
path: '/api/v2/libraries/tests/services/setting',
|
|
41
42
|
method: 'POST',
|
|
@@ -50,11 +51,10 @@ function getLibraryConfiguration ({
|
|
|
50
51
|
options.path = `${evpProxyPrefix}/api/v2/libraries/tests/services/setting`
|
|
51
52
|
options.headers['X-Datadog-EVP-Subdomain'] = 'api'
|
|
52
53
|
} else {
|
|
53
|
-
|
|
54
|
-
if (!apiKey) {
|
|
54
|
+
if (!config.apiKey) {
|
|
55
55
|
return done(new Error('Request to settings endpoint was not done because Datadog API key is not defined.'))
|
|
56
56
|
}
|
|
57
|
-
options.headers['dd-api-key'] = apiKey
|
|
57
|
+
options.headers['dd-api-key'] = config.apiKey
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const data = JSON.stringify({
|
|
@@ -132,11 +132,11 @@ function getLibraryConfiguration ({
|
|
|
132
132
|
|
|
133
133
|
log.debug('Remote settings: %j', settings)
|
|
134
134
|
|
|
135
|
-
if (
|
|
135
|
+
if (config.DD_CIVISIBILITY_DANGEROUSLY_FORCE_COVERAGE) {
|
|
136
136
|
settings.isCodeCoverageEnabled = true
|
|
137
137
|
log.debug('Dangerously set code coverage to true')
|
|
138
138
|
}
|
|
139
|
-
if (
|
|
139
|
+
if (config.DD_CIVISIBILITY_DANGEROUSLY_FORCE_TEST_SKIPPING) {
|
|
140
140
|
settings.isSuitesSkippingEnabled = true
|
|
141
141
|
log.debug('Dangerously set test skipping to true')
|
|
142
142
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
const { readFileSync } = require('node:fs')
|
|
4
4
|
const { gzipSync } = require('node:zlib')
|
|
5
5
|
|
|
6
|
+
const getConfig = require('../../config')
|
|
6
7
|
const FormData = require('../../exporters/common/form-data')
|
|
7
8
|
const request = require('../../exporters/common/request')
|
|
8
9
|
const log = require('../../log')
|
|
9
|
-
const { getValueFromEnvSources } = require('../../config/helper')
|
|
10
10
|
const {
|
|
11
11
|
incrementCountMetric,
|
|
12
12
|
distributionMetric,
|
|
@@ -34,7 +34,7 @@ function uploadCoverageReport (
|
|
|
34
34
|
{ filePath, format, testEnvironmentMetadata, url, isEvpProxy, evpProxyPrefix },
|
|
35
35
|
callback
|
|
36
36
|
) {
|
|
37
|
-
const apiKey =
|
|
37
|
+
const apiKey = getConfig().apiKey
|
|
38
38
|
|
|
39
39
|
if (!apiKey && !isEvpProxy) {
|
|
40
40
|
return callback(new Error('DD_API_KEY is required for coverage report upload'))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const getConfig = require('../../config')
|
|
3
4
|
const request = require('../requests/request')
|
|
4
5
|
const id = require('../../id')
|
|
5
|
-
const { getValueFromEnvSources } = require('../../config/helper')
|
|
6
6
|
const log = require('../../log')
|
|
7
7
|
|
|
8
8
|
const {
|
|
@@ -121,7 +121,7 @@ function fetchFromApi ({
|
|
|
121
121
|
options.path = `${evpProxyPrefix}/api/v2/test/libraries/test-management/tests`
|
|
122
122
|
options.headers['X-Datadog-EVP-Subdomain'] = 'api'
|
|
123
123
|
} else {
|
|
124
|
-
const apiKey =
|
|
124
|
+
const { apiKey } = getConfig()
|
|
125
125
|
if (!apiKey) {
|
|
126
126
|
return done(new Error('Test management tests were not fetched because Datadog API key is not defined.'))
|
|
127
127
|
}
|
|
@@ -10,11 +10,8 @@ export interface ConfigProperties extends GeneratedConfig {
|
|
|
10
10
|
}
|
|
11
11
|
commitSHA: string | undefined
|
|
12
12
|
debug: boolean
|
|
13
|
-
gcpPubSubPushSubscriptionEnabled: boolean
|
|
14
13
|
instrumentationSource: 'manual' | 'ssi'
|
|
15
|
-
isAzureFunction: boolean
|
|
16
14
|
isCiVisibility: boolean
|
|
17
|
-
isGCPFunction: boolean
|
|
18
15
|
isServiceNameInferred: boolean
|
|
19
16
|
isServiceUserProvided: boolean
|
|
20
17
|
logger: import('../../../../index').TracerOptions['logger'] | undefined
|
|
@@ -22,7 +19,6 @@ export interface ConfigProperties extends GeneratedConfig {
|
|
|
22
19
|
readonly parsedDdTags: Record<string, string>
|
|
23
20
|
plugins: boolean
|
|
24
21
|
repositoryUrl: string | undefined
|
|
25
|
-
rules: import('../../../../index').SamplingRule[]
|
|
26
22
|
sampler: {
|
|
27
23
|
rateLimit: number
|
|
28
24
|
rules: import('../../../../index').SamplingRule[]
|
|
@@ -81,11 +81,8 @@ for (const [name, value] of Object.entries(defaults)) {
|
|
|
81
81
|
* @param {string} optionName
|
|
82
82
|
*/
|
|
83
83
|
function generateTelemetry (value = null, origin, optionName) {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
if (canonicalName === 'OTEL_RESOURCE_ATTRIBUTES') {
|
|
87
|
-
value = telemetryTransformers.MAP(value)
|
|
88
|
-
}
|
|
84
|
+
const tableEntry = configurationsTable[optionName]
|
|
85
|
+
const { type, canonicalName = optionName } = tableEntry ?? { type: typeof value }
|
|
89
86
|
// TODO: Should we not send defaults to telemetry to reduce size?
|
|
90
87
|
// TODO: How to handle aliases/actual names in the future? Optional fields? Normalize the name at intake?
|
|
91
88
|
// TODO: Validate that space separated tags are parsed by the backend. Optimizations would be possible with that.
|
|
@@ -94,9 +91,12 @@ function generateTelemetry (value = null, origin, optionName) {
|
|
|
94
91
|
if (telemetryTransformers[type]) {
|
|
95
92
|
value = telemetryTransformers[type](value)
|
|
96
93
|
} else if (typeof value === 'object' && value !== null) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
// Custom optionsTable entries (no `configurationsTable` row, e.g. `logger`)
|
|
95
|
+
// hold opaque user-supplied references that may carry cycles, so avoid
|
|
96
|
+
// traversing them via JSON.stringify.
|
|
97
|
+
value = tableEntry === undefined
|
|
98
|
+
? util.inspect(value, { depth: -1 })
|
|
99
|
+
: value instanceof URL ? String(value) : JSON.stringify(value)
|
|
100
100
|
} else if (typeof value === 'function') {
|
|
101
101
|
value = value.name || 'function'
|
|
102
102
|
}
|
|
@@ -250,7 +250,7 @@ for (const [canonicalName, entries] of Object.entries(supportedConfigurations))
|
|
|
250
250
|
option.transformer = transformer
|
|
251
251
|
}
|
|
252
252
|
if (entry.configurationNames) {
|
|
253
|
-
addOption(option,
|
|
253
|
+
addOption(option, entry.configurationNames)
|
|
254
254
|
}
|
|
255
255
|
configurationsTable[canonicalName] = option
|
|
256
256
|
|
|
@@ -287,7 +287,7 @@ for (const [fullPropertyName, alias] of fallbackConfigurations) {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
function addOption (option,
|
|
290
|
+
function addOption (option, configurationNames) {
|
|
291
291
|
for (const name of configurationNames) {
|
|
292
292
|
let index = -1
|
|
293
293
|
let lastNestedProperties
|
|
@@ -78,7 +78,7 @@ export interface GeneratedConfig {
|
|
|
78
78
|
DD_AZURE_RESOURCE_GROUP: string | undefined;
|
|
79
79
|
DD_CIVISIBILITY_AGENTLESS_ENABLED: boolean;
|
|
80
80
|
DD_CIVISIBILITY_AGENTLESS_URL: string | undefined;
|
|
81
|
-
DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER:
|
|
81
|
+
DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER: string | undefined;
|
|
82
82
|
DD_CIVISIBILITY_DANGEROUSLY_FORCE_COVERAGE: boolean;
|
|
83
83
|
DD_CIVISIBILITY_DANGEROUSLY_FORCE_TEST_SKIPPING: boolean;
|
|
84
84
|
DD_CIVISIBILITY_ENABLED: boolean;
|
|
@@ -297,6 +297,7 @@ export interface GeneratedConfig {
|
|
|
297
297
|
DD_TRACE_MIDDIE_ENABLED: boolean;
|
|
298
298
|
DD_TRACE_MOCHA_EACH_ENABLED: boolean;
|
|
299
299
|
DD_TRACE_MOCHA_ENABLED: boolean;
|
|
300
|
+
DD_TRACE_MODELCONTEXTPROTOCOL_SDK_ENABLED: boolean;
|
|
300
301
|
DD_TRACE_MOLECULER_ENABLED: boolean;
|
|
301
302
|
DD_TRACE_MONGODB_CORE_ENABLED: boolean;
|
|
302
303
|
DD_TRACE_MONGODB_ENABLED: boolean;
|
|
@@ -478,36 +479,36 @@ export interface GeneratedConfig {
|
|
|
478
479
|
};
|
|
479
480
|
openAiLogsEnabled: boolean;
|
|
480
481
|
OTEL_EXPORTER_OTLP_ENDPOINT: string | undefined;
|
|
482
|
+
OTEL_EXPORTER_OTLP_HEADERS: Record<string, string> | undefined;
|
|
483
|
+
OTEL_EXPORTER_OTLP_LOGS_HEADERS: Record<string, string> | undefined;
|
|
484
|
+
OTEL_EXPORTER_OTLP_METRICS_HEADERS: Record<string, string> | undefined;
|
|
485
|
+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: string;
|
|
486
|
+
OTEL_EXPORTER_OTLP_TRACES_HEADERS: Record<string, string> | undefined;
|
|
487
|
+
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: "http/json";
|
|
488
|
+
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: number;
|
|
481
489
|
OTEL_LOGS_EXPORTER: "none" | "otlp" | undefined;
|
|
482
490
|
OTEL_METRICS_EXPORTER: "none" | "otlp" | undefined;
|
|
483
491
|
OTEL_RESOURCE_ATTRIBUTES: Record<string, string>;
|
|
484
492
|
OTEL_SDK_DISABLED: boolean;
|
|
485
|
-
OTEL_TRACES_EXPORTER: "none" | "otlp";
|
|
493
|
+
OTEL_TRACES_EXPORTER: "none" | "otlp" | undefined;
|
|
486
494
|
OTEL_TRACES_SAMPLER: "always_on" | "always_off" | "traceidratio" | "parentbased_always_on" | "parentbased_always_off" | "parentbased_traceidratio";
|
|
487
495
|
OTEL_TRACES_SAMPLER_ARG: number | undefined;
|
|
488
496
|
otelBatchTimeout: number;
|
|
489
|
-
otelHeaders: string | undefined;
|
|
490
497
|
otelLogsEnabled: boolean;
|
|
491
|
-
otelLogsHeaders: string | undefined;
|
|
492
498
|
otelLogsProtocol: string;
|
|
493
499
|
otelLogsTimeout: number;
|
|
494
|
-
otelLogsUrl: string
|
|
500
|
+
otelLogsUrl: string;
|
|
495
501
|
otelMaxExportBatchSize: number;
|
|
496
502
|
otelMaxQueueSize: number;
|
|
497
503
|
otelMetricsEnabled: boolean;
|
|
498
504
|
otelMetricsExportInterval: number;
|
|
499
505
|
otelMetricsExportTimeout: number;
|
|
500
|
-
otelMetricsHeaders: string | undefined;
|
|
501
506
|
otelMetricsProtocol: string;
|
|
502
507
|
otelMetricsTemporalityPreference: "DELTA" | "CUMULATIVE" | "LOWMEMORY";
|
|
503
508
|
otelMetricsTimeout: number;
|
|
504
|
-
otelMetricsUrl: string
|
|
509
|
+
otelMetricsUrl: string;
|
|
505
510
|
otelProtocol: string;
|
|
506
511
|
otelTimeout: number;
|
|
507
|
-
otelTracesHeaders: Record<string, string> | undefined;
|
|
508
|
-
otelTracesProtocol: string;
|
|
509
|
-
otelTracesTimeout: number;
|
|
510
|
-
otelTracesUrl: string | undefined;
|
|
511
512
|
peerServiceMapping: Record<string, string>;
|
|
512
513
|
port: string | number;
|
|
513
514
|
profiling: {
|
|
@@ -536,7 +537,7 @@ export interface GeneratedConfig {
|
|
|
536
537
|
sampleRate: number | undefined;
|
|
537
538
|
samplingRules: import('../../../../index').SamplingRule[];
|
|
538
539
|
scope: string | undefined;
|
|
539
|
-
service: string
|
|
540
|
+
service: string;
|
|
540
541
|
serviceMapping: Record<string, string>;
|
|
541
542
|
site: string;
|
|
542
543
|
spanAttributeSchema: "v0" | "v1";
|