dd-trace 6.22.0 → 6.24.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/ci/cypress/support.js +15 -1
- package/ci/diagnose.js +4 -4
- package/ci/test-annotations.d.ts +5 -0
- package/ci/test-annotations.js +5 -0
- package/ci/test-optimization-validation/approval-artifacts.js +2 -2
- package/ci/test-optimization-validation/approval.js +2 -2
- package/ci/test-optimization-validation/artifact-id.js +2 -3
- package/ci/test-optimization-validation/ci-package-scripts.js +1 -1
- package/ci/test-optimization-validation/cli.js +1 -1
- package/ci/test-optimization-validation/command-runner.js +2 -3
- package/ci/test-optimization-validation/executable.js +1 -1
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +1 -1
- package/ci/test-optimization-validation/literal-environment.js +2 -2
- package/ci/test-optimization-validation/manifest-scaffold.js +1 -1
- package/ci/test-optimization-validation/offline-fixtures.js +1 -1
- package/ci/test-optimization-validation/redaction.js +3 -3
- package/ci/test-optimization-validation/runner-contract.js +10 -10
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +1 -1
- package/ci/vitest-no-worker-init-annotations.mjs +4 -0
- package/ci/vitest-no-worker-init-node-setup.mjs +22 -0
- package/ci/vitest-no-worker-init-runner-setup.mjs +7 -5
- package/ci/vitest-no-worker-init-setup.mjs +34 -12
- package/ci/vitest-no-worker-init-v5-setup.mjs +6 -0
- package/ext/exporters.js +1 -0
- package/index.d.ts +35 -5
- package/loader-hook.mjs +53 -0
- package/openfeature/exposure-hook.d.ts +66 -0
- package/openfeature/exposure-hook.js +5 -0
- package/package.json +23 -20
- package/packages/datadog-core/src/storage.js +1 -1
- package/packages/datadog-esbuild/index.js +70 -7
- package/packages/datadog-instrumentations/index.js +2 -1
- package/packages/datadog-instrumentations/src/cucumber.js +64 -21
- package/packages/datadog-instrumentations/src/cypress-config.js +163 -15
- package/packages/datadog-instrumentations/src/graphql.js +9 -3
- package/packages/datadog-instrumentations/src/grpc/server.js +23 -6
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +27 -8
- package/packages/datadog-instrumentations/src/helpers/fetch.js +5 -1
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +30 -8
- package/packages/datadog-instrumentations/src/helpers/hooks.js +2 -1
- package/packages/datadog-instrumentations/src/helpers/register.js +9 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +16 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +10 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql-jit.js +3 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/jest.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/react-router.js +49 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/typesafe.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/vitest.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.js +19 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +13 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +1 -1
- package/packages/datadog-instrumentations/src/jest.js +332 -137
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +69 -11
- package/packages/datadog-instrumentations/src/mariadb.js +13 -6
- package/packages/datadog-instrumentations/src/mocha/common.js +89 -8
- package/packages/datadog-instrumentations/src/mocha/main.js +11 -2
- package/packages/datadog-instrumentations/src/mocha/utils.js +92 -13
- package/packages/datadog-instrumentations/src/mocha/worker.js +1 -1
- package/packages/datadog-instrumentations/src/nova-sonic/session.js +25 -16
- package/packages/datadog-instrumentations/src/oracledb.js +33 -0
- package/packages/datadog-instrumentations/src/pg.js +2 -1
- package/packages/datadog-instrumentations/src/playwright.js +81 -26
- package/packages/datadog-instrumentations/src/react-router.js +106 -0
- package/packages/datadog-instrumentations/src/stripe.js +23 -12
- package/packages/datadog-instrumentations/src/typesafe.js +89 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +84 -47
- package/packages/datadog-instrumentations/src/vitest-main.js +33 -3
- package/packages/datadog-instrumentations/src/vitest-test-annotations.js +20 -0
- package/packages/datadog-instrumentations/src/vitest-util.js +5 -2
- package/packages/datadog-instrumentations/src/vitest-worker.js +39 -17
- package/packages/datadog-instrumentations/src/vitest.js +16 -6
- package/packages/datadog-plugin-cucumber/src/index.js +5 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +277 -44
- package/packages/datadog-plugin-cypress/src/index.js +1 -1
- package/packages/datadog-plugin-cypress/src/lifecycle-owner.js +20 -0
- package/packages/datadog-plugin-cypress/src/plugin.js +10 -0
- package/packages/datadog-plugin-cypress/src/retry-config-observer.js +281 -0
- package/packages/datadog-plugin-cypress/src/setup-handoff.js +125 -0
- package/packages/datadog-plugin-cypress/src/support.js +1217 -437
- package/packages/datadog-plugin-graphql/src/execute.js +2 -2
- package/packages/datadog-plugin-graphql/src/utils.js +5 -5
- package/packages/datadog-plugin-jest/src/index.js +25 -3
- package/packages/datadog-plugin-mocha/src/index.js +47 -6
- package/packages/datadog-plugin-oracledb/src/connection-parser.js +21 -11
- package/packages/datadog-plugin-playwright/src/index.js +4 -0
- package/packages/datadog-plugin-react-router/src/index.js +118 -0
- package/packages/datadog-plugin-typesafe/src/index.js +17 -0
- package/packages/datadog-plugin-typesafe/src/tracing.js +31 -0
- package/packages/datadog-plugin-vitest/src/index.js +8 -0
- package/packages/dd-trace/src/agent/info.js +2 -1
- package/packages/dd-trace/src/aiguard/evaluation.js +143 -1
- package/packages/dd-trace/src/aiguard/sdk.js +0 -11
- package/packages/dd-trace/src/appsec/iast/path-line.js +2 -1
- package/packages/dd-trace/src/appsec/stack_trace.js +3 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +3 -2
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +9 -16
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +4 -2
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +9 -16
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +9 -14
- package/packages/dd-trace/src/ci-visibility/requests/route.js +44 -0
- package/packages/dd-trace/src/ci-visibility/telemetry-logs.js +5 -0
- package/packages/dd-trace/src/ci-visibility/test-annotations.js +72 -0
- package/packages/dd-trace/src/ci-visibility/test-declaration-annotations.js +170 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +9 -16
- package/packages/dd-trace/src/config/defaults.js +4 -3
- package/packages/dd-trace/src/config/generated-config-types.d.ts +6 -0
- package/packages/dd-trace/src/config/index.js +140 -39
- package/packages/dd-trace/src/config/parsers.js +9 -1
- package/packages/dd-trace/src/config/supported-configurations.json +25 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +6 -5
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +5 -5
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +4 -6
- package/packages/dd-trace/src/debugger/probe_sampler.js +6 -6
- package/packages/dd-trace/src/debugger/unsupported-runtime.js +16 -0
- package/packages/dd-trace/src/encode/0.4.js +2 -2
- package/packages/dd-trace/src/esm-module-load.js +58 -0
- package/packages/dd-trace/src/exporter.js +25 -6
- package/packages/dd-trace/src/exporters/agent/index.js +3 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +3 -1
- package/packages/dd-trace/src/exporters/common/request.js +4 -4
- package/packages/dd-trace/src/exporters/llmobs/index.js +135 -0
- package/packages/dd-trace/src/exporters/log/index.js +4 -3
- package/packages/dd-trace/src/llmobs/agent-manifest.js +19 -2
- package/packages/dd-trace/src/llmobs/constants/tags.js +4 -0
- package/packages/dd-trace/src/llmobs/experiments/index.js +2 -3
- package/packages/dd-trace/src/llmobs/experiments/noop.js +5 -2
- package/packages/dd-trace/src/llmobs/index.js +13 -2
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +8 -4
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +5 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +9 -1
- package/packages/dd-trace/src/llmobs/plugins/typesafe/index.js +102 -0
- package/packages/dd-trace/src/llmobs/prompts/cache.js +3 -1
- package/packages/dd-trace/src/llmobs/sdk.js +17 -5
- package/packages/dd-trace/src/llmobs/span_processor.js +222 -12
- package/packages/dd-trace/src/llmobs/tagger.js +21 -8
- package/packages/dd-trace/src/llmobs/util.js +10 -4
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -3
- package/packages/dd-trace/src/log/writer.js +7 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +64 -6
- package/packages/dd-trace/src/openfeature/configuration_source.js +18 -2
- package/packages/dd-trace/src/openfeature/debug-logging-hook.js +66 -3
- package/packages/dd-trace/src/openfeature/exposure-hook.js +185 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +39 -13
- package/packages/dd-trace/src/openfeature/index.js +6 -0
- package/packages/dd-trace/src/openfeature/remote_config.js +16 -3
- package/packages/dd-trace/src/openfeature/writers/base.js +62 -27
- package/packages/dd-trace/src/openfeature/writers/exposures.js +161 -1
- package/packages/dd-trace/src/openfeature/writers/flag-eval-evp-hook.js +5 -0
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-aggregation.js +9 -4
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-payload.js +2 -0
- package/packages/dd-trace/src/openfeature/writers/flag-evaluation-pii.js +2 -0
- package/packages/dd-trace/src/openfeature/writers/split-features.js +25 -0
- package/packages/dd-trace/src/openfeature/writers/util.js +4 -4
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +2 -2
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +18 -1
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +5 -1
- package/packages/dd-trace/src/opentracing/tracer.js +9 -13
- package/packages/dd-trace/src/otel-thread-ctx.js +47 -21
- package/packages/dd-trace/src/plugin_manager.js +1 -2
- package/packages/dd-trace/src/plugins/ci_plugin.js +4 -4
- package/packages/dd-trace/src/plugins/index.js +3 -0
- package/packages/dd-trace/src/plugins/tracing.js +1 -2
- package/packages/dd-trace/src/plugins/util/git.js +102 -40
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +2 -4
- package/packages/dd-trace/src/plugins/util/stacktrace.js +2 -1
- package/packages/dd-trace/src/plugins/util/test.js +28 -6
- package/packages/dd-trace/src/plugins/util/web.js +106 -20
- package/packages/dd-trace/src/process-tags/index.js +1 -1
- package/packages/dd-trace/src/profiling/config.js +6 -3
- package/packages/dd-trace/src/proxy.js +15 -4
- package/packages/dd-trace/src/serverless.js +3 -2
- package/packages/dd-trace/src/span_processor.js +21 -9
- package/packages/dd-trace/src/span_stats.js +32 -3
- package/packages/dd-trace/src/startup-log.js +2 -1
- package/packages/dd-trace/src/tagger.js +7 -5
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -0
- package/packages/dd-trace/src/telemetry/index.js +3 -0
- package/packages/dd-trace/src/telemetry/logs/index.js +21 -2
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +2 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +10 -3
- package/packages/dd-trace/src/util.js +9 -5
- package/register.js +2 -1
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +8 -8
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.d.ts +78 -0
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.js +1 -1
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vendor/dist/@opentelemetry/resources/LICENSE +0 -201
- package/vendor/dist/@opentelemetry/resources/index.js +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const declarationMethods = new Set([
|
|
4
|
+
'concurrent', 'sequential', 'shuffle', 'skip', 'only', 'todo', 'fails', 'each', 'for', 'extend',
|
|
5
|
+
'skipIf', 'runIf', 'describe', 'suite',
|
|
6
|
+
])
|
|
7
|
+
const wrappedDeclarations = new WeakMap()
|
|
8
|
+
const capturedCollectors = new WeakSet()
|
|
9
|
+
const declarationFactories = ['each', 'for', 'extend', 'skipIf', 'runIf']
|
|
10
|
+
let captureLocations = false
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {{
|
|
14
|
+
* type: 'collector', test: Function & { fn: Function }, tasks: object[], options?: { retry?: unknown }
|
|
15
|
+
* }} Collector
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {Function & { fn: Function }} test
|
|
20
|
+
* @param {() => Collector} getCurrentSuite
|
|
21
|
+
*/
|
|
22
|
+
function captureDeclarations (test, getCurrentSuite) {
|
|
23
|
+
// The setup-based main-process reporter requests declaration locations.
|
|
24
|
+
captureLocations = true
|
|
25
|
+
captureFactories(test, getCurrentSuite)
|
|
26
|
+
captureCollector(getCurrentSuite())
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {Function & { fn: Function }} test
|
|
31
|
+
* @param {() => Collector} getCurrentSuite
|
|
32
|
+
*/
|
|
33
|
+
function captureFactories (test, getCurrentSuite) {
|
|
34
|
+
for (const target of [test, test.fn]) {
|
|
35
|
+
for (const method of declarationFactories) {
|
|
36
|
+
if (typeof target[method] === 'function') target[method] = wrapDeclaration(target[method], getCurrentSuite)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @param {Collector} collector */
|
|
42
|
+
function captureCollector (collector) {
|
|
43
|
+
if (capturedCollectors.has(collector)) return
|
|
44
|
+
capturedCollectors.add(collector)
|
|
45
|
+
|
|
46
|
+
const getCollector = () => collector
|
|
47
|
+
const declaration = collector.test.fn
|
|
48
|
+
const wrapped = wrapDeclaration(declaration, getCollector)
|
|
49
|
+
captureFactories(collector.test, getCollector)
|
|
50
|
+
// Vitest's exported test dispatches through .fn.call; suite-local chains close over .fn and use .apply.
|
|
51
|
+
// Native bindings avoid an extra stack frame inside Vitest's bounded declaration-location capture.
|
|
52
|
+
Object.defineProperties(declaration, {
|
|
53
|
+
call: {
|
|
54
|
+
value: Function.prototype.call.bind(wrapped),
|
|
55
|
+
writable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
},
|
|
58
|
+
apply: {
|
|
59
|
+
value: Function.prototype.apply.bind(wrapped),
|
|
60
|
+
writable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
const push = collector.tasks.push
|
|
65
|
+
collector.tasks.push = function (...tasks) {
|
|
66
|
+
for (const task of tasks) {
|
|
67
|
+
if (task.type === 'collector') captureCollector(task)
|
|
68
|
+
else if (captureLocations && task.type === 'test' && !task.location) {
|
|
69
|
+
const location = getDeclarationLocation(task.file?.filepath)
|
|
70
|
+
if (location) task.location = location
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return push.apply(this, tasks)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Captures declaration metadata before Vitest replaces callbacks for fixtures, timeouts and parameterized cases.
|
|
79
|
+
*
|
|
80
|
+
* @param {Function} declaration
|
|
81
|
+
* @param {() => Collector} getCurrentSuite
|
|
82
|
+
*/
|
|
83
|
+
function wrapDeclaration (declaration, getCurrentSuite) {
|
|
84
|
+
if (wrappedDeclarations.has(declaration)) return wrappedDeclarations.get(declaration)
|
|
85
|
+
const wrapped = new Proxy(declaration, {
|
|
86
|
+
apply (target, receiver, args) {
|
|
87
|
+
const collector = getCurrentSuite()
|
|
88
|
+
captureCollector(collector)
|
|
89
|
+
let annotations
|
|
90
|
+
let options
|
|
91
|
+
for (let index = 1; index < args.length; index++) {
|
|
92
|
+
const argument = args[index]
|
|
93
|
+
if (typeof argument === 'function') {
|
|
94
|
+
const observed = argument[Symbol.for('dd-trace:test-annotations')] || {}
|
|
95
|
+
if (observed.mustFail || observed.noAutoRetry) annotations = observed
|
|
96
|
+
} else if (argument && typeof argument === 'object') {
|
|
97
|
+
options = argument
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const hasFrameworkRetry = options?.retry !== undefined || collector.options?.retry !== undefined
|
|
101
|
+
if (!annotations && !hasFrameworkRetry) {
|
|
102
|
+
const result = Reflect.apply(target, receiver, args)
|
|
103
|
+
return typeof result === 'function' ? wrapDeclaration(result, getCurrentSuite) : result
|
|
104
|
+
}
|
|
105
|
+
const firstTask = collector.tasks.length
|
|
106
|
+
const result = Reflect.apply(target, receiver, args)
|
|
107
|
+
for (let index = firstTask; index < collector.tasks.length; index++) {
|
|
108
|
+
const task = collector.tasks[index]
|
|
109
|
+
if (task.type !== 'test') continue
|
|
110
|
+
if (hasFrameworkRetry) task.meta = { ...task.meta, __ddTestOptNativeRetry: true }
|
|
111
|
+
if (annotations) {
|
|
112
|
+
task.meta = {
|
|
113
|
+
...task.meta,
|
|
114
|
+
__ddTestOptAnnotations: {
|
|
115
|
+
mustFail: annotations.mustFail,
|
|
116
|
+
noAutoRetry: annotations.noAutoRetry,
|
|
117
|
+
hasFrameworkRetry: hasFrameworkRetry || task.meta?.__ddTestOptHasFrameworkRetry === true,
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return typeof result === 'function' ? wrapDeclaration(result, getCurrentSuite) : result
|
|
123
|
+
},
|
|
124
|
+
get (target, property, receiver) {
|
|
125
|
+
const value = Reflect.get(target, property, receiver)
|
|
126
|
+
return declarationMethods.has(property) && typeof value === 'function'
|
|
127
|
+
? wrapDeclaration(value, getCurrentSuite)
|
|
128
|
+
: value
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
wrappedDeclarations.set(wrapped, wrapped)
|
|
132
|
+
wrappedDeclarations.set(declaration, wrapped)
|
|
133
|
+
return wrapped
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @param {string|undefined} filepath
|
|
138
|
+
* @returns {{ line: number, column: number }|undefined}
|
|
139
|
+
*/
|
|
140
|
+
function getDeclarationLocation (filepath) {
|
|
141
|
+
if (!filepath) return
|
|
142
|
+
try {
|
|
143
|
+
const limit = Error.stackTraceLimit
|
|
144
|
+
let error
|
|
145
|
+
try {
|
|
146
|
+
// Vitest's ten-frame budget can omit callers behind generated declarations and fixture chains.
|
|
147
|
+
Error.stackTraceLimit = 25
|
|
148
|
+
error = new Error('Datadog Vitest declaration')
|
|
149
|
+
} finally {
|
|
150
|
+
Error.stackTraceLimit = limit
|
|
151
|
+
}
|
|
152
|
+
if (typeof error.stack !== 'string') return
|
|
153
|
+
for (let frame of error.stack.split('\n')) {
|
|
154
|
+
if (!frame.includes(filepath)) {
|
|
155
|
+
try { frame = decodeURIComponent(frame) } catch { continue }
|
|
156
|
+
}
|
|
157
|
+
const start = frame.lastIndexOf(filepath)
|
|
158
|
+
if (start === -1) continue
|
|
159
|
+
const location = frame.slice(start + filepath.length).match(/^(?:[?#].*?)?:(\d+):(\d+)\)?$/)
|
|
160
|
+
if (location) return { line: Number(location[1]), column: Number(location[2]) }
|
|
161
|
+
}
|
|
162
|
+
} catch {}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Browser Mode serves this dependency as ESM without CommonJS conversion in independent projects.
|
|
166
|
+
if (typeof module === 'undefined') {
|
|
167
|
+
globalThis[Symbol.for('dd-trace.vitest.declaration-annotations')] = { captureDeclarations }
|
|
168
|
+
} else {
|
|
169
|
+
module.exports = { wrapDeclaration, captureDeclarations }
|
|
170
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const getConfig = require('../../config')
|
|
4
|
-
const { EVP_SUBDOMAIN_HEADER_NAME } = require('../../evp_proxy/constants')
|
|
5
|
-
const { joinEVPProxyPath } = require('../../evp_proxy/path')
|
|
6
4
|
const id = require('../../id')
|
|
7
5
|
const log = require('../../log')
|
|
8
6
|
const {
|
|
@@ -15,6 +13,7 @@ const {
|
|
|
15
13
|
TELEMETRY_TEST_MANAGEMENT_TESTS_RESPONSE_BYTES,
|
|
16
14
|
} = require('../telemetry')
|
|
17
15
|
const request = require('../requests/request')
|
|
16
|
+
const { createApiRequestRoute } = require('../requests/route')
|
|
18
17
|
const { buildCacheKey, writeToCache, withCache } = require('../requests/fs-cache')
|
|
19
18
|
const { validateTestManagementTestsResponse } = require('../test-optimization-http-cache-schema')
|
|
20
19
|
|
|
@@ -117,32 +116,26 @@ function fetchFromApi ({
|
|
|
117
116
|
branch,
|
|
118
117
|
cacheKey,
|
|
119
118
|
}, done) {
|
|
119
|
+
const path = '/api/v2/test/libraries/test-management/tests'
|
|
120
|
+
const route = createApiRequestRoute(getConfig(), { url, path, isEvpProxy, evpProxyPrefix })
|
|
121
|
+
if (!route) {
|
|
122
|
+
return done(new Error('Test management tests were not fetched because Datadog API key is not defined.'))
|
|
123
|
+
}
|
|
124
|
+
|
|
120
125
|
const options = {
|
|
121
|
-
|
|
126
|
+
...route,
|
|
122
127
|
method: 'POST',
|
|
123
128
|
headers: {
|
|
129
|
+
...route.headers,
|
|
124
130
|
'Content-Type': 'application/json',
|
|
125
131
|
},
|
|
126
132
|
timeout: 20_000,
|
|
127
|
-
url,
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
if (isGzipCompatible) {
|
|
131
136
|
options.headers['accept-encoding'] = 'gzip'
|
|
132
137
|
}
|
|
133
138
|
|
|
134
|
-
if (isEvpProxy) {
|
|
135
|
-
options.path = joinEVPProxyPath(evpProxyPrefix, '/api/v2/test/libraries/test-management/tests')
|
|
136
|
-
options.headers[EVP_SUBDOMAIN_HEADER_NAME] = 'api'
|
|
137
|
-
} else {
|
|
138
|
-
const { DD_API_KEY } = getConfig()
|
|
139
|
-
if (!DD_API_KEY) {
|
|
140
|
-
return done(new Error('Test management tests were not fetched because Datadog API key is not defined.'))
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
options.headers['dd-api-key'] = DD_API_KEY
|
|
144
|
-
}
|
|
145
|
-
|
|
146
139
|
const data = JSON.stringify({
|
|
147
140
|
data: {
|
|
148
141
|
id: id().toString(10),
|
|
@@ -36,12 +36,13 @@ const parseErrors = new Map()
|
|
|
36
36
|
*/
|
|
37
37
|
function warnInvalidValue (value, optionName, source, baseMessage, error, outcome = 'picked default') {
|
|
38
38
|
const canonicalName = optionsTable[optionName]?.canonicalName ?? optionName
|
|
39
|
+
const displayValue = sensitiveConfigurations.has(canonicalName) ? '<redacted>' : value
|
|
39
40
|
const telemetryKey = canonicalName + source
|
|
40
41
|
const telemetryEntry = configWithOrigin.get(telemetryKey)
|
|
41
42
|
// Lazy load log module to avoid circular dependency
|
|
42
43
|
if (!parseErrors.has(telemetryKey) && !telemetryEntry?.error) {
|
|
43
44
|
// TODO: Report the prior source when an invalid value does not use the default.
|
|
44
|
-
let message = `${baseMessage}: ${util.inspect(
|
|
45
|
+
let message = `${baseMessage}: ${util.inspect(displayValue)} for ${optionName} (source: ${source})`
|
|
45
46
|
if (outcome) message += `, ${outcome}`
|
|
46
47
|
if (error) {
|
|
47
48
|
error.stack = error.toString()
|
|
@@ -69,10 +70,10 @@ const defaults = {
|
|
|
69
70
|
logger: undefined,
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
for (const [name, value] of Object.entries(defaults)) {
|
|
73
|
+
for (const [name, value = null] of Object.entries(defaults)) {
|
|
73
74
|
configWithOrigin.set(`${name}default`, {
|
|
74
75
|
name,
|
|
75
|
-
value
|
|
76
|
+
value,
|
|
76
77
|
origin: 'default',
|
|
77
78
|
seq_id: seqId++,
|
|
78
79
|
})
|
|
@@ -381,6 +381,7 @@ export interface GeneratedConfig {
|
|
|
381
381
|
DD_TRACE_Q_ENABLED: boolean;
|
|
382
382
|
DD_TRACE_REACT_DOM_ENABLED: boolean;
|
|
383
383
|
DD_TRACE_REACT_ENABLED: boolean;
|
|
384
|
+
DD_TRACE_REACT_ROUTER_ENABLED: boolean;
|
|
384
385
|
DD_TRACE_REDIS_CLIENT_ENABLED: boolean;
|
|
385
386
|
DD_TRACE_REDIS_ENABLED: boolean;
|
|
386
387
|
DD_TRACE_REQUEST_ENABLED: boolean;
|
|
@@ -400,6 +401,7 @@ export interface GeneratedConfig {
|
|
|
400
401
|
DD_TRACE_SUPABASE_ENABLED: boolean;
|
|
401
402
|
DD_TRACE_TAGS: Record<string, string> | undefined;
|
|
402
403
|
DD_TRACE_TEDIOUS_ENABLED: boolean;
|
|
404
|
+
DD_TRACE_TYPESAFE_ENABLED: boolean;
|
|
403
405
|
DD_TRACE_UNDICI_ENABLED: boolean;
|
|
404
406
|
DD_TRACE_URL_ENABLED: boolean;
|
|
405
407
|
DD_TRACE_VITEST_ENABLED: boolean;
|
|
@@ -439,6 +441,7 @@ export interface GeneratedConfig {
|
|
|
439
441
|
DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_REQUEST_TIMEOUT_SECONDS: number;
|
|
440
442
|
DD_FEATURE_FLAGS_ENABLED: boolean;
|
|
441
443
|
DD_FEATURE_FLAGS_EVALUATION_TELEMETRY_PER_SUBJECT_OPT_OUT_ENABLED: boolean;
|
|
444
|
+
DD_FEATURE_FLAGS_EXPOSURES_DATADOG_LOGGING_ENABLED: boolean;
|
|
442
445
|
DD_FLAGGING_EVALUATION_COUNTS_ENABLED: boolean;
|
|
443
446
|
};
|
|
444
447
|
flushInterval: number;
|
|
@@ -726,6 +729,7 @@ export interface GeneratedEnvVarConfig {
|
|
|
726
729
|
DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_REQUEST_TIMEOUT_SECONDS: number;
|
|
727
730
|
DD_FEATURE_FLAGS_ENABLED: boolean;
|
|
728
731
|
DD_FEATURE_FLAGS_EVALUATION_TELEMETRY_PER_SUBJECT_OPT_OUT_ENABLED: boolean;
|
|
732
|
+
DD_FEATURE_FLAGS_EXPOSURES_DATADOG_LOGGING_ENABLED: boolean;
|
|
729
733
|
DD_FLAGGING_EVALUATION_COUNTS_ENABLED: boolean;
|
|
730
734
|
DD_GIT_BRANCH: string | undefined;
|
|
731
735
|
DD_GIT_COMMIT_AUTHOR_DATE: string | undefined;
|
|
@@ -1105,6 +1109,7 @@ export interface GeneratedEnvVarConfig {
|
|
|
1105
1109
|
DD_TRACE_RATE_LIMIT: number;
|
|
1106
1110
|
DD_TRACE_REACT_DOM_ENABLED: boolean;
|
|
1107
1111
|
DD_TRACE_REACT_ENABLED: boolean;
|
|
1112
|
+
DD_TRACE_REACT_ROUTER_ENABLED: boolean;
|
|
1108
1113
|
DD_TRACE_REDIS_CLIENT_ENABLED: boolean;
|
|
1109
1114
|
DD_TRACE_REDIS_ENABLED: boolean;
|
|
1110
1115
|
DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED: boolean;
|
|
@@ -1132,6 +1137,7 @@ export interface GeneratedEnvVarConfig {
|
|
|
1132
1137
|
DD_TRACE_TAGS: Record<string, string> | undefined;
|
|
1133
1138
|
DD_TRACE_TEDIOUS_ENABLED: boolean;
|
|
1134
1139
|
DD_TRACE_TELEMETRY_ENABLED: boolean;
|
|
1140
|
+
DD_TRACE_TYPESAFE_ENABLED: boolean;
|
|
1135
1141
|
DD_TRACE_UNDICI_ENABLED: boolean;
|
|
1136
1142
|
DD_TRACE_URL: string | URL;
|
|
1137
1143
|
DD_TRACE_URL_ENABLED: boolean;
|
|
@@ -12,19 +12,24 @@ const uuid = require('../../../../vendor/dist/crypto-randomuuid') // we need to
|
|
|
12
12
|
const set = require('../../../datadog-core/src/utils/src/set')
|
|
13
13
|
const { DD_MAJOR, NODE_MAJOR } = require('../../../../version')
|
|
14
14
|
const log = require('../log')
|
|
15
|
+
const { warn } = require('../log/writer')
|
|
15
16
|
const pkg = require('../pkg')
|
|
16
17
|
const { isTrue } = require('../util')
|
|
17
18
|
const telemetry = require('../telemetry')
|
|
18
19
|
const telemetryMetrics = require('../telemetry/metrics')
|
|
19
20
|
const {
|
|
21
|
+
getServerlessPlatform,
|
|
20
22
|
getServerlessPlatformTags,
|
|
21
23
|
IS_SERVERLESS,
|
|
24
|
+
IS_AWS_LAMBDA,
|
|
22
25
|
getIsGCPFunction,
|
|
23
26
|
getIsAzureFunction,
|
|
24
27
|
} = require('../serverless')
|
|
25
28
|
const { ORIGIN_KEY, DATADOG_MINI_AGENT_PATH } = require('../constants')
|
|
29
|
+
const { usesOtlpTraceExporter } = require('../exporter')
|
|
26
30
|
const { appendRules } = require('../payload-tagging/config')
|
|
27
31
|
const { createSiteUrl } = require('../exporters/common/url')
|
|
32
|
+
const { getUnsupportedRuntime } = require('../debugger/unsupported-runtime')
|
|
28
33
|
const ConfigBase = require('./config-base')
|
|
29
34
|
const {
|
|
30
35
|
getEnvironmentVariable,
|
|
@@ -200,6 +205,12 @@ class Config extends ConfigBase {
|
|
|
200
205
|
*/
|
|
201
206
|
#parsedDdTags
|
|
202
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Options already explained as deactivated, so recalculating the config doesn't repeat the explanation
|
|
210
|
+
* @type {Set<ConfigPath>}
|
|
211
|
+
*/
|
|
212
|
+
#explainedDeactivations = new Set()
|
|
213
|
+
|
|
203
214
|
/**
|
|
204
215
|
* @type {Record<string, string>}
|
|
205
216
|
*/
|
|
@@ -420,10 +431,8 @@ class Config extends ConfigBase {
|
|
|
420
431
|
setAndTrack(this, 'DD_METRICS_OTEL_ENABLED', false)
|
|
421
432
|
}
|
|
422
433
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
setAndTrack(this, 'OTEL_TRACES_EXPORTER', 'none')
|
|
426
|
-
}
|
|
434
|
+
const agentlessTracingEnabled = this.DD_AGENTLESS_ENABLED ||
|
|
435
|
+
isTrue(getEnvironmentVariable('_DD_APM_TRACING_AGENTLESS_ENABLED'))
|
|
427
436
|
|
|
428
437
|
if (this.telemetry.DD_TELEMETRY_HEARTBEAT_INTERVAL) {
|
|
429
438
|
setAndTrack(this, 'telemetry.DD_TELEMETRY_HEARTBEAT_INTERVAL',
|
|
@@ -443,8 +452,15 @@ class Config extends ConfigBase {
|
|
|
443
452
|
setAndTrack(this, 'DD_TRACE_RESOURCE_RENAMING_ENABLED', this.appsec.DD_APPSEC_ENABLED ?? false)
|
|
444
453
|
}
|
|
445
454
|
|
|
446
|
-
|
|
447
|
-
|
|
455
|
+
// Enable the thread context writer when appsec is enabled and only
|
|
456
|
+
// if DD_TRACE_OTEL_CTX_ENABLED is not explicitly set. The writer is started once
|
|
457
|
+
// at init, so appsec enabled later through remote config does not start it.
|
|
458
|
+
// Serverless functions and Vercel are left out: the eBPF reader cannot run there.
|
|
459
|
+
if (!trackedConfigOrigins.has('DD_TRACE_OTEL_CTX_ENABLED') &&
|
|
460
|
+
this.appsec.DD_APPSEC_ENABLED &&
|
|
461
|
+
!IS_SERVERLESS &&
|
|
462
|
+
!getServerlessPlatform().isVercel) {
|
|
463
|
+
setAndTrack(this, 'DD_TRACE_OTEL_CTX_ENABLED', true)
|
|
448
464
|
}
|
|
449
465
|
|
|
450
466
|
if (!this.apmTracingEnabled) {
|
|
@@ -471,7 +487,7 @@ class Config extends ConfigBase {
|
|
|
471
487
|
setAndTrack(this, 'tracePropagationStyle.extract', this.tracePropagationStyle.extract)
|
|
472
488
|
}
|
|
473
489
|
|
|
474
|
-
if (
|
|
490
|
+
if (IS_AWS_LAMBDA && !fs.existsSync(DATADOG_MINI_AGENT_PATH)) {
|
|
475
491
|
setAndTrack(this, 'flushInterval', 0)
|
|
476
492
|
}
|
|
477
493
|
|
|
@@ -495,23 +511,6 @@ class Config extends ConfigBase {
|
|
|
495
511
|
setAndTrack(this, 'runtimeMetrics.enabled', false)
|
|
496
512
|
}
|
|
497
513
|
|
|
498
|
-
const agentlessTracingEnabled = this.DD_AGENTLESS_ENABLED ||
|
|
499
|
-
isTrue(getEnvironmentVariable('_DD_APM_TRACING_AGENTLESS_ENABLED'))
|
|
500
|
-
|
|
501
|
-
// Apply the OTel sampler when the user opted into OTel traces or explicitly set the sampler.
|
|
502
|
-
// OTEL_TRACES_SAMPLER has `default: parentbased_always_on` (per OTel spec), so opt-in users
|
|
503
|
-
// that don't set the sampler still get parent-based sampling. Electron exporter spans go over
|
|
504
|
-
// the Electron SDK's IPC bridge rather than OTLP (see opentracing/tracer.js), so an
|
|
505
|
-
// OTEL_TRACES_EXPORTER=otlp set for an unrelated telemetry pipeline shouldn't also override
|
|
506
|
-
// dd-trace's own sampling policy in that case.
|
|
507
|
-
if (!trackedConfigOrigins.has('sampleRate') &&
|
|
508
|
-
(trackedConfigOrigins.has('OTEL_TRACES_SAMPLER') ||
|
|
509
|
-
(this.OTEL_TRACES_EXPORTER === 'otlp' &&
|
|
510
|
-
this.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER !== 'electron'))) {
|
|
511
|
-
setAndTrack(this, 'sampleRate',
|
|
512
|
-
getFromOtelSamplerMap(this.OTEL_TRACES_SAMPLER, this.OTEL_TRACES_SAMPLER_ARG))
|
|
513
|
-
}
|
|
514
|
-
|
|
515
514
|
if (this.DD_SPAN_SAMPLING_RULES_FILE) {
|
|
516
515
|
try {
|
|
517
516
|
// TODO: Should we log a warning in case this is defined next to spanSamplingRules?
|
|
@@ -521,14 +520,6 @@ class Config extends ConfigBase {
|
|
|
521
520
|
}
|
|
522
521
|
}
|
|
523
522
|
|
|
524
|
-
// All sampler options are tracked as individual values. No need to track the sampler object as a whole.
|
|
525
|
-
this.sampler = {
|
|
526
|
-
rules: this.samplingRules,
|
|
527
|
-
rateLimit: this.rateLimit,
|
|
528
|
-
sampleRate: this.sampleRate,
|
|
529
|
-
spanSamplingRules: this.spanSamplingRules,
|
|
530
|
-
}
|
|
531
|
-
|
|
532
523
|
// For LLMObs, we want to auto enable it when other llmobs options are defined.
|
|
533
524
|
if (!this.llmobs.DD_LLMOBS_ENABLED &&
|
|
534
525
|
!trackedConfigOrigins.has('llmobs.DD_LLMOBS_ENABLED') &&
|
|
@@ -538,6 +529,14 @@ class Config extends ConfigBase {
|
|
|
538
529
|
setAndTrack(this, 'llmobs.DD_LLMOBS_ENABLED', true)
|
|
539
530
|
}
|
|
540
531
|
|
|
532
|
+
if (this.llmobs.DD_LLMOBS_ENABLED) {
|
|
533
|
+
// LLMObs payloads use APM structured metadata, which is only supported by protocol v0.4.
|
|
534
|
+
if (this.protocolVersion !== '0.4') {
|
|
535
|
+
log.warn('LLM Observability requires protocol version 0.4 - overriding choice of %s', this.protocolVersion)
|
|
536
|
+
}
|
|
537
|
+
setAndTrack(this, 'protocolVersion', '0.4')
|
|
538
|
+
}
|
|
539
|
+
|
|
541
540
|
if (this.OTEL_RESOURCE_ATTRIBUTES) {
|
|
542
541
|
for (const [key, value] of Object.entries(this.OTEL_RESOURCE_ATTRIBUTES)) {
|
|
543
542
|
// Not replacing existing tags keeps the order of the tags as before.
|
|
@@ -639,6 +638,12 @@ class Config extends ConfigBase {
|
|
|
639
638
|
setAndTrack(this, 'remoteConfig.DD_REMOTE_CONFIGURATION_ENABLED', false)
|
|
640
639
|
}
|
|
641
640
|
|
|
641
|
+
if (this.isCiVisibility) {
|
|
642
|
+
// Test Optimization reports its metrics through instrumentation telemetry, not DogStatsD.
|
|
643
|
+
set(this, 'dogstatsd', undefined)
|
|
644
|
+
setAndTrack(this, 'runtimeMetrics.enabled', false)
|
|
645
|
+
}
|
|
646
|
+
|
|
642
647
|
const isTestOptimizationWorker = this.isCiVisibility &&
|
|
643
648
|
TEST_OPTIMIZATION_WORKER_EXPORTERS.has(this.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER)
|
|
644
649
|
if (isTestOptimizationWorker) {
|
|
@@ -674,10 +679,6 @@ class Config extends ConfigBase {
|
|
|
674
679
|
setAndTrack(this, 'stats.DD_TRACE_STATS_COMPUTATION_ENABLED', false)
|
|
675
680
|
// Enable hostname reporting
|
|
676
681
|
setAndTrack(this, 'reportHostname', true)
|
|
677
|
-
// Disable rate limiting - server-side sampling will be used
|
|
678
|
-
setAndTrack(this, 'sampler.rateLimit', -1)
|
|
679
|
-
// Clear sampling rules - server-side sampling handles this
|
|
680
|
-
setAndTrack(this, 'sampler.rules', [])
|
|
681
682
|
// Agentless intake only accepts 64-bit trace IDs; disable 128-bit generation
|
|
682
683
|
if (!trackedConfigOrigins.has('traceId128BitGenerationEnabled')) {
|
|
683
684
|
setAndTrack(this, 'traceId128BitGenerationEnabled', false)
|
|
@@ -697,6 +698,75 @@ class Config extends ConfigBase {
|
|
|
697
698
|
}
|
|
698
699
|
}
|
|
699
700
|
|
|
701
|
+
if (this.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
702
|
+
let warning
|
|
703
|
+
|
|
704
|
+
if (this.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER === exporters.ELECTRON) {
|
|
705
|
+
warning = 'DD_TRACE_EXPERIMENTAL_EXPORTER=electron is incompatible with DD_TRACE_OTEL_SEMANTICS_ENABLED. ' +
|
|
706
|
+
'DD_TRACE_OTEL_SEMANTICS_ENABLED deactivated'
|
|
707
|
+
} else if (this.tracing.DD_TRACE_EXPERIMENTAL_EXPORTER === exporters.AGENTLESS) {
|
|
708
|
+
warning = 'Agentless tracing is incompatible with DD_TRACE_OTEL_SEMANTICS_ENABLED. ' +
|
|
709
|
+
'DD_TRACE_OTEL_SEMANTICS_ENABLED deactivated'
|
|
710
|
+
} else if (this.isCiVisibility) {
|
|
711
|
+
warning = 'Test Optimization is incompatible with DD_TRACE_OTEL_SEMANTICS_ENABLED. ' +
|
|
712
|
+
'Deactivating DD_TRACE_OTEL_SEMANTICS_ENABLED'
|
|
713
|
+
} else if (this.OTEL_TRACES_EXPORTER === 'none') {
|
|
714
|
+
warning = 'DD_TRACE_OTEL_SEMANTICS_ENABLED is deactivated due to OTEL_TRACES_EXPORTER set to "none"'
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
if (warning) {
|
|
718
|
+
log.warn(warning)
|
|
719
|
+
setAndTrack(this, 'DD_TRACE_OTEL_SEMANTICS_ENABLED', false)
|
|
720
|
+
} else {
|
|
721
|
+
setAndTrack(this, 'OTEL_TRACES_EXPORTER', 'otlp')
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
if (this.OTEL_TRACES_EXPORTER === 'otlp' && trackedConfigOrigins.has('protocolVersion')) {
|
|
726
|
+
log.warn('DD_TRACE_AGENT_PROTOCOL_VERSION is set, disabling OTLP traces export')
|
|
727
|
+
setAndTrack(this, 'OTEL_TRACES_EXPORTER', 'none')
|
|
728
|
+
if (this.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
729
|
+
setAndTrack(this, 'DD_TRACE_OTEL_SEMANTICS_ENABLED', false)
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
if (this.DD_TRACE_OTEL_SEMANTICS_ENABLED) {
|
|
734
|
+
if (this.spanAttributeSchema !== 'v0') {
|
|
735
|
+
log.warn('DD_TRACE_OTEL_SEMANTICS_ENABLED requires DD_TRACE_SPAN_ATTRIBUTE_SCHEMA to be "v0". Resetting')
|
|
736
|
+
}
|
|
737
|
+
if (this.spanComputePeerService) {
|
|
738
|
+
log.warn(
|
|
739
|
+
'DD_TRACE_OTEL_SEMANTICS_ENABLED requires DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED to be false. Resetting'
|
|
740
|
+
)
|
|
741
|
+
}
|
|
742
|
+
setAndTrack(this, 'spanAttributeSchema', 'v0')
|
|
743
|
+
setAndTrack(this, 'spanComputePeerService', false)
|
|
744
|
+
} else if (!trackedConfigOrigins.has('spanComputePeerService') && this.spanAttributeSchema !== 'v0') {
|
|
745
|
+
setAndTrack(this, 'spanComputePeerService', true)
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// An explicit OTel sampler also applies to native trace exporters.
|
|
749
|
+
if (!trackedConfigOrigins.has('sampleRate') &&
|
|
750
|
+
(trackedConfigOrigins.has('OTEL_TRACES_SAMPLER') || usesOtlpTraceExporter(this))) {
|
|
751
|
+
setAndTrack(this, 'sampleRate',
|
|
752
|
+
getFromOtelSamplerMap(this.OTEL_TRACES_SAMPLER, this.OTEL_TRACES_SAMPLER_ARG))
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// All sampler options are tracked as individual values. No need to track the sampler object as a whole.
|
|
756
|
+
this.sampler = {
|
|
757
|
+
rules: this.samplingRules,
|
|
758
|
+
rateLimit: this.rateLimit,
|
|
759
|
+
sampleRate: this.sampleRate,
|
|
760
|
+
spanSamplingRules: this.spanSamplingRules,
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
if (agentlessTracingEnabled && !this.isCiVisibility) {
|
|
764
|
+
// Disable rate limiting - server-side sampling will be used
|
|
765
|
+
setAndTrack(this, 'sampler.rateLimit', -1)
|
|
766
|
+
// Clear sampling rules - server-side sampling handles this
|
|
767
|
+
setAndTrack(this, 'sampler.rules', [])
|
|
768
|
+
}
|
|
769
|
+
|
|
700
770
|
// TODO: This could likely be moved to the base class and allow easier GRPC handling
|
|
701
771
|
// Default OTLP endpoints follow the configured agent host so users who point DD at a custom
|
|
702
772
|
// agent (DD_AGENT_HOST / DD_TRACE_AGENT_URL) also reach OTLP on that host. In agentless mode
|
|
@@ -728,7 +798,7 @@ class Config extends ConfigBase {
|
|
|
728
798
|
assignOtlpHeaderApiKey('OTEL_EXPORTER_OTLP_TRACES_HEADERS')
|
|
729
799
|
}
|
|
730
800
|
|
|
731
|
-
const autoTraceMetrics = this
|
|
801
|
+
const autoTraceMetrics = usesOtlpTraceExporter(this) && this.DD_METRICS_OTEL_ENABLED === true
|
|
732
802
|
setAndTrack(this, 'OTEL_TRACES_SPAN_METRICS_ENABLED', this.OTEL_TRACES_SPAN_METRICS_ENABLED ?? autoTraceMetrics)
|
|
733
803
|
|
|
734
804
|
if (this.OTEL_TRACES_SPAN_METRICS_ENABLED) {
|
|
@@ -750,11 +820,42 @@ class Config extends ConfigBase {
|
|
|
750
820
|
deactivateIfEnabledAndWarnOnWindows(this, 'DD_PROFILING_ASYNC_CONTEXT_FRAME_ENABLED')
|
|
751
821
|
}
|
|
752
822
|
|
|
823
|
+
const unsupportedRuntime = getUnsupportedRuntime()
|
|
824
|
+
if (unsupportedRuntime !== undefined) {
|
|
825
|
+
this.#deactivateOnUnsupportedRuntime(
|
|
826
|
+
'dynamicInstrumentation.DD_DYNAMIC_INSTRUMENTATION_ENABLED',
|
|
827
|
+
`Live Debugger/Dynamic Instrumentation is disabled, because it is not supported on ${unsupportedRuntime}.`
|
|
828
|
+
)
|
|
829
|
+
this.#deactivateOnUnsupportedRuntime(
|
|
830
|
+
'testOptimization.DD_TEST_FAILED_TEST_REPLAY_ENABLED',
|
|
831
|
+
'Failed Test Replay is disabled, ' +
|
|
832
|
+
`because Live Debugger/Dynamic Instrumentation is not supported on ${unsupportedRuntime}.`
|
|
833
|
+
)
|
|
834
|
+
}
|
|
835
|
+
|
|
753
836
|
// Single tags update is tracked as a calculated value.
|
|
754
837
|
setAndTrack(this, 'tags', this.tags)
|
|
755
838
|
|
|
756
839
|
telemetry.updateConfig([...configWithOrigin.values()], this)
|
|
757
840
|
}
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Only explains the deactivation of an option that was explicitly set, since Failed Test Replay is enabled by
|
|
844
|
+
* default.
|
|
845
|
+
*
|
|
846
|
+
* @param {ConfigPath} name
|
|
847
|
+
* @param {string} reason
|
|
848
|
+
*/
|
|
849
|
+
#deactivateOnUnsupportedRuntime (name, reason) {
|
|
850
|
+
if (!get(this, name)) return
|
|
851
|
+
|
|
852
|
+
if (this.startupLogs && trackedConfigOrigins.has(name) && !this.#explainedDeactivations.has(name)) {
|
|
853
|
+
this.#explainedDeactivations.add(name)
|
|
854
|
+
// `log.warn` only prints with debug logging enabled, so write the diagnostic like the startup logs do
|
|
855
|
+
warn(`DATADOG TRACER DIAGNOSTIC - ${reason}`)
|
|
856
|
+
}
|
|
857
|
+
setAndTrack(this, name, false)
|
|
858
|
+
}
|
|
758
859
|
}
|
|
759
860
|
|
|
760
861
|
/**
|
|
@@ -811,7 +912,7 @@ function getFromOtelSamplerMap (otelTracesSampler, otelTracesSamplerArg) {
|
|
|
811
912
|
function warnWrongOtelSettings () {
|
|
812
913
|
// This mostly works for non-aliased environment variables only.
|
|
813
914
|
// TODO: Adjust this to work across all sources.
|
|
814
|
-
for (const [otelEnvVar, ddEnvVar, key] of [
|
|
915
|
+
for (const [otelEnvVar, ddEnvVar, key = otelEnvVar] of [
|
|
815
916
|
// eslint-disable-next-line eslint-rules/eslint-env-aliases
|
|
816
917
|
['OTEL_LOG_LEVEL', 'DD_TRACE_LOG_LEVEL', 'logLevel'],
|
|
817
918
|
// eslint-disable-next-line eslint-rules/eslint-env-aliases
|
|
@@ -828,7 +929,7 @@ function warnWrongOtelSettings () {
|
|
|
828
929
|
]) {
|
|
829
930
|
// eslint-disable-next-line eslint-rules/eslint-process-env
|
|
830
931
|
const envs = process.env
|
|
831
|
-
const otelSource = trackedConfigOrigins.get(/** @type {ConfigPath} */ (key
|
|
932
|
+
const otelSource = trackedConfigOrigins.get(/** @type {ConfigPath} */ (key))
|
|
832
933
|
const otelEnvValue = envs[otelEnvVar]
|
|
833
934
|
if (otelEnvValue) {
|
|
834
935
|
if (envs[ddEnvVar]) {
|
|
@@ -334,7 +334,15 @@ const parsers = {
|
|
|
334
334
|
// DD_TAGS is a special case. It may be a map of key-value pairs separated by spaces.
|
|
335
335
|
raw = raw.replaceAll(/\s+/g, ',')
|
|
336
336
|
}
|
|
337
|
-
|
|
337
|
+
if (valueSeparator === '=' && raw.includes('%')) {
|
|
338
|
+
try {
|
|
339
|
+
tagger.add(entries, raw, valueSeparator, true)
|
|
340
|
+
} catch {
|
|
341
|
+
return
|
|
342
|
+
}
|
|
343
|
+
} else {
|
|
344
|
+
tagger.add(entries, raw, valueSeparator)
|
|
345
|
+
}
|
|
338
346
|
return entries
|
|
339
347
|
},
|
|
340
348
|
JSON (raw) {
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
{
|
|
144
144
|
"implementation": "A",
|
|
145
145
|
"type": "string",
|
|
146
|
+
"allowed": ".+",
|
|
146
147
|
"default": null,
|
|
147
148
|
"aliases": [
|
|
148
149
|
"DATADOG_API_KEY"
|
|
@@ -497,6 +498,7 @@
|
|
|
497
498
|
{
|
|
498
499
|
"implementation": "A",
|
|
499
500
|
"type": "string",
|
|
501
|
+
"allowed": ".+",
|
|
500
502
|
"default": null,
|
|
501
503
|
"sensitive": true
|
|
502
504
|
}
|
|
@@ -1004,6 +1006,15 @@
|
|
|
1004
1006
|
"namespace": "featureFlags"
|
|
1005
1007
|
}
|
|
1006
1008
|
],
|
|
1009
|
+
"DD_FEATURE_FLAGS_EXPOSURES_DATADOG_LOGGING_ENABLED": [
|
|
1010
|
+
{
|
|
1011
|
+
"implementation": "A",
|
|
1012
|
+
"type": "boolean",
|
|
1013
|
+
"default": "true",
|
|
1014
|
+
"description": "Enable Feature Flagging exposure delivery to Datadog independently of flag evaluation and evaluation telemetry.",
|
|
1015
|
+
"namespace": "featureFlags"
|
|
1016
|
+
}
|
|
1017
|
+
],
|
|
1007
1018
|
"DD_FLAGGING_EVALUATION_COUNTS_ENABLED": [
|
|
1008
1019
|
{
|
|
1009
1020
|
"implementation": "A",
|
|
@@ -4008,6 +4019,13 @@
|
|
|
4008
4019
|
"default": "true"
|
|
4009
4020
|
}
|
|
4010
4021
|
],
|
|
4022
|
+
"DD_TRACE_REACT_ROUTER_ENABLED": [
|
|
4023
|
+
{
|
|
4024
|
+
"implementation": "A",
|
|
4025
|
+
"type": "boolean",
|
|
4026
|
+
"default": "true"
|
|
4027
|
+
}
|
|
4028
|
+
],
|
|
4011
4029
|
"DD_TRACE_REDIS_CLIENT_ENABLED": [
|
|
4012
4030
|
{
|
|
4013
4031
|
"implementation": "A",
|
|
@@ -4220,6 +4238,13 @@
|
|
|
4220
4238
|
"default": "true"
|
|
4221
4239
|
}
|
|
4222
4240
|
],
|
|
4241
|
+
"DD_TRACE_TYPESAFE_ENABLED": [
|
|
4242
|
+
{
|
|
4243
|
+
"implementation": "A",
|
|
4244
|
+
"type": "boolean",
|
|
4245
|
+
"default": "true"
|
|
4246
|
+
}
|
|
4247
|
+
],
|
|
4223
4248
|
"DD_TRACE_UNDICI_ENABLED": [
|
|
4224
4249
|
{
|
|
4225
4250
|
"implementation": "A",
|