dd-trace 5.68.0 → 5.69.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 +6 -1
- package/index.d.ts +193 -1
- package/package.json +10 -1
- package/packages/datadog-core/src/storage.js +14 -13
- package/packages/datadog-esbuild/index.js +62 -26
- package/packages/datadog-instrumentations/src/helpers/instrument.js +4 -3
- package/packages/datadog-plugin-confluentinc-kafka-javascript/src/index.js +6 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +0 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +18 -5
- package/packages/dd-trace/src/aiguard/client.js +25 -0
- package/packages/dd-trace/src/aiguard/noop.js +9 -0
- package/packages/dd-trace/src/aiguard/sdk.js +173 -0
- package/packages/dd-trace/src/aiguard/tags.js +11 -0
- package/packages/dd-trace/src/appsec/iast/path-line.js +21 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +6 -3
- package/packages/dd-trace/src/appsec/stack_trace.js +20 -1
- package/packages/dd-trace/src/config-helper.js +8 -1
- package/packages/dd-trace/src/config.js +23 -0
- package/packages/dd-trace/src/config_defaults.js +5 -0
- package/packages/dd-trace/src/datastreams/index.js +23 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +11 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +8 -6
- package/packages/dd-trace/src/log/index.js +4 -4
- package/packages/dd-trace/src/noop/proxy.js +4 -0
- package/packages/dd-trace/src/opentracing/span.js +1 -1
- package/packages/dd-trace/src/payload-tagging/config/index.js +16 -0
- package/packages/dd-trace/src/payload-tagging/index.js +26 -15
- package/packages/dd-trace/src/payload-tagging/tagging.js +17 -8
- package/packages/dd-trace/src/pkg.js +3 -1
- package/packages/dd-trace/src/plugins/composite.js +3 -0
- package/packages/dd-trace/src/plugins/plugin.js +67 -0
- package/packages/dd-trace/src/plugins/util/git.js +1 -1
- package/packages/dd-trace/src/plugins/util/test.js +19 -0
- package/packages/dd-trace/src/priority_sampler.js +70 -46
- package/packages/dd-trace/src/proxy.js +15 -0
- package/packages/dd-trace/src/rate_limiter.js +26 -1
- package/packages/dd-trace/src/sampling_rule.js +124 -2
- package/packages/dd-trace/src/span_sampler.js +19 -0
- package/packages/dd-trace/src/standalone/product.js +9 -0
- package/packages/dd-trace/src/standalone/tracesource.js +16 -1
- package/packages/dd-trace/src/standalone/tracesource_priority_sampler.js +13 -0
- package/packages/dd-trace/src/startup-log.js +19 -1
- package/packages/dd-trace/src/supported-configurations.json +6 -0
- package/packages/dd-trace/src/util.js +1 -1
- package/version.js +4 -2
|
@@ -3,14 +3,25 @@
|
|
|
3
3
|
const limiter = require('limiter')
|
|
4
4
|
|
|
5
5
|
class RateLimiter {
|
|
6
|
+
/**
|
|
7
|
+
* @param {number} rateLimit - Allowed units per interval. Negative means unlimited, 0 disables.
|
|
8
|
+
* @param {'second'|'minute'|'hour'|'day'} [interval='second'] - Time window for the limiter.
|
|
9
|
+
*/
|
|
6
10
|
constructor (rateLimit, interval = 'second') {
|
|
7
|
-
this._rateLimit = Number.parseInt(rateLimit)
|
|
11
|
+
this._rateLimit = Number.parseInt(String(rateLimit))
|
|
12
|
+
// The limiter constructor accepts a token count number and an interval string
|
|
8
13
|
this._limiter = new limiter.RateLimiter(this._rateLimit, interval)
|
|
9
14
|
this._tokensRequested = 0
|
|
10
15
|
this._prevIntervalTokens = 0
|
|
11
16
|
this._prevTokensRequested = 0
|
|
12
17
|
}
|
|
13
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Attempts to consume a token and reports whether it was allowed.
|
|
21
|
+
* Updates internal counters used for effective rate computation.
|
|
22
|
+
*
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
14
25
|
isAllowed () {
|
|
15
26
|
const curIntervalStart = this._limiter.curIntervalStart
|
|
16
27
|
const curIntervalTokens = this._limiter.tokensThisInterval
|
|
@@ -27,6 +38,12 @@ class RateLimiter {
|
|
|
27
38
|
return allowed
|
|
28
39
|
}
|
|
29
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Returns the fraction of allowed requests over requested ones in the
|
|
43
|
+
* current and previous intervals combined.
|
|
44
|
+
*
|
|
45
|
+
* @returns {number}
|
|
46
|
+
*/
|
|
30
47
|
effectiveRate () {
|
|
31
48
|
if (this._rateLimit < 0) return 1
|
|
32
49
|
if (this._rateLimit === 0) return 0
|
|
@@ -38,6 +55,10 @@ class RateLimiter {
|
|
|
38
55
|
return allowed / requested
|
|
39
56
|
}
|
|
40
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Internal token consumption without counter side-effects.
|
|
60
|
+
* @returns {boolean}
|
|
61
|
+
*/
|
|
41
62
|
_isAllowed () {
|
|
42
63
|
if (this._rateLimit < 0) return true
|
|
43
64
|
if (this._rateLimit === 0) return false
|
|
@@ -45,6 +66,10 @@ class RateLimiter {
|
|
|
45
66
|
return this._limiter.tryRemoveTokens(1)
|
|
46
67
|
}
|
|
47
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Effective rate within the current interval only.
|
|
71
|
+
* @returns {number}
|
|
72
|
+
*/
|
|
48
73
|
_currentWindowRate () {
|
|
49
74
|
if (this._rateLimit < 0) return 1
|
|
50
75
|
if (this._rateLimit === 0) return 0
|
|
@@ -4,18 +4,53 @@ const { globMatch } = require('../src/util')
|
|
|
4
4
|
const RateLimiter = require('./rate_limiter')
|
|
5
5
|
const Sampler = require('./sampler')
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Typedefs for clarity when matching spans.
|
|
9
|
+
*
|
|
10
|
+
* @typedef {import('./opentracing/span')} DatadogSpan
|
|
11
|
+
* @typedef {import('./opentracing/span_context')} DatadogSpanContext
|
|
12
|
+
*
|
|
13
|
+
* @callback Locator
|
|
14
|
+
* A function that derives a string subject from a span.
|
|
15
|
+
* @param {DatadogSpan} span
|
|
16
|
+
* @returns {string|undefined}
|
|
17
|
+
*
|
|
18
|
+
* @typedef {object} RuleMatcher
|
|
19
|
+
* @property {(span: DatadogSpan) => boolean} match - Returns true if the span matches.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Matcher that always returns true.
|
|
24
|
+
* Implements the minimal `RuleMatcher` interface.
|
|
25
|
+
* @implements {RuleMatcher}
|
|
26
|
+
*/
|
|
7
27
|
class AlwaysMatcher {
|
|
8
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @param {DatadogSpan} span
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
match (span) {
|
|
9
33
|
return true
|
|
10
34
|
}
|
|
11
35
|
}
|
|
12
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Matcher that evaluates a glob pattern against a derived subject.
|
|
39
|
+
*/
|
|
13
40
|
class GlobMatcher {
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} pattern - Glob pattern used to match the subject.
|
|
43
|
+
* @param {Locator} locator - Function extracting the subject to match.
|
|
44
|
+
*/
|
|
14
45
|
constructor (pattern, locator) {
|
|
15
46
|
this.pattern = pattern
|
|
16
47
|
this.locator = locator
|
|
17
48
|
}
|
|
18
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @param {DatadogSpan} span
|
|
52
|
+
* @returns {boolean}
|
|
53
|
+
*/
|
|
19
54
|
match (span) {
|
|
20
55
|
const subject = this.locator(span)
|
|
21
56
|
if (!subject) return false
|
|
@@ -23,12 +58,23 @@ class GlobMatcher {
|
|
|
23
58
|
}
|
|
24
59
|
}
|
|
25
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Matcher that evaluates a regular expression against a derived subject.
|
|
63
|
+
*/
|
|
26
64
|
class RegExpMatcher {
|
|
65
|
+
/**
|
|
66
|
+
* @param {RegExp} pattern - Regular expression used to test the subject.
|
|
67
|
+
* @param {Locator} locator - Function extracting the subject to test.
|
|
68
|
+
*/
|
|
27
69
|
constructor (pattern, locator) {
|
|
28
70
|
this.pattern = pattern
|
|
29
71
|
this.locator = locator
|
|
30
72
|
}
|
|
31
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @param {DatadogSpan} span
|
|
76
|
+
* @returns {boolean}
|
|
77
|
+
*/
|
|
32
78
|
match (span) {
|
|
33
79
|
const subject = this.locator(span)
|
|
34
80
|
if (!subject) return false
|
|
@@ -36,6 +82,15 @@ class RegExpMatcher {
|
|
|
36
82
|
}
|
|
37
83
|
}
|
|
38
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Creates a matcher for the provided pattern and locator.
|
|
87
|
+
* Returns a glob matcher for non-trivial strings, a regexp matcher for RegExp,
|
|
88
|
+
* or an always-true matcher for wildcard or missing patterns.
|
|
89
|
+
*
|
|
90
|
+
* @param {string|RegExp|undefined} pattern
|
|
91
|
+
* @param {Locator} locator
|
|
92
|
+
* @returns {RuleMatcher}
|
|
93
|
+
*/
|
|
39
94
|
function matcher (pattern, locator) {
|
|
40
95
|
if (pattern instanceof RegExp) {
|
|
41
96
|
return new RegExpMatcher(pattern, locator)
|
|
@@ -47,14 +102,32 @@ function matcher (pattern, locator) {
|
|
|
47
102
|
return new AlwaysMatcher()
|
|
48
103
|
}
|
|
49
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Creates a locator that reads a specific tag from the span context.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} tag
|
|
109
|
+
* @returns {Locator}
|
|
110
|
+
*/
|
|
50
111
|
function makeTagLocator (tag) {
|
|
51
112
|
return (span) => span.context()._tags[tag]
|
|
52
113
|
}
|
|
53
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Extracts the operation name from the span context.
|
|
117
|
+
*
|
|
118
|
+
* @param {DatadogSpan} span
|
|
119
|
+
* @returns {string|undefined}
|
|
120
|
+
*/
|
|
54
121
|
function nameLocator (span) {
|
|
55
122
|
return span.context()._name
|
|
56
123
|
}
|
|
57
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Extracts the service name from the span context or tracer configuration.
|
|
127
|
+
*
|
|
128
|
+
* @param {DatadogSpan} span
|
|
129
|
+
* @returns {string|undefined}
|
|
130
|
+
*/
|
|
58
131
|
function serviceLocator (span) {
|
|
59
132
|
const { _tags: tags } = span.context()
|
|
60
133
|
return tags.service ||
|
|
@@ -62,13 +135,39 @@ function serviceLocator (span) {
|
|
|
62
135
|
span.tracer()._service
|
|
63
136
|
}
|
|
64
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Extracts the resource name from the span context.
|
|
140
|
+
*
|
|
141
|
+
* @param {DatadogSpan} span
|
|
142
|
+
* @returns {string|undefined}
|
|
143
|
+
*/
|
|
65
144
|
function resourceLocator (span) {
|
|
66
145
|
const { _tags: tags } = span.context()
|
|
67
146
|
return tags.resource ||
|
|
68
147
|
tags['resource.name']
|
|
69
148
|
}
|
|
70
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Configuration options for a sampling rule.
|
|
152
|
+
*
|
|
153
|
+
* @typedef {object} SamplingRuleConfig
|
|
154
|
+
* @property {string|RegExp} [name] - Match on span operation name.
|
|
155
|
+
* @property {string|RegExp} [service] - Match on service name.
|
|
156
|
+
* @property {string|RegExp} [resource] - Match on resource name.
|
|
157
|
+
* @property {Record<string, string|RegExp>} [tags] - Match on specific tag values by key.
|
|
158
|
+
* @property {number} [sampleRate=1] - Deterministic sampling rate in [0, 1].
|
|
159
|
+
* @property {string} [provenance] - Optional provenance/metadata for this rule.
|
|
160
|
+
* @property {number} [maxPerSecond] - Maximum samples per second (rate limit).
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* SamplingRule encapsulates matching criteria and sampling/limiting behavior
|
|
165
|
+
* to decide whether a span should be sampled.
|
|
166
|
+
*/
|
|
71
167
|
class SamplingRule {
|
|
168
|
+
/**
|
|
169
|
+
* @param {SamplingRuleConfig} [config]
|
|
170
|
+
*/
|
|
72
171
|
constructor ({ name, service, resource, tags, sampleRate = 1, provenance, maxPerSecond } = {}) {
|
|
73
172
|
this.matchers = []
|
|
74
173
|
|
|
@@ -94,22 +193,45 @@ class SamplingRule {
|
|
|
94
193
|
}
|
|
95
194
|
}
|
|
96
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Constructs a SamplingRule from the given configuration.
|
|
198
|
+
* @param {SamplingRuleConfig} config
|
|
199
|
+
* @returns {SamplingRule}
|
|
200
|
+
*/
|
|
97
201
|
static from (config) {
|
|
98
202
|
return new SamplingRule(config)
|
|
99
203
|
}
|
|
100
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Deterministic sampling rate in [0, 1].
|
|
207
|
+
* @returns {number}
|
|
208
|
+
*/
|
|
101
209
|
get sampleRate () {
|
|
102
210
|
return this._sampler.rate()
|
|
103
211
|
}
|
|
104
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Effective rate applied by the rate limiter, if configured.
|
|
215
|
+
* @returns {number|undefined}
|
|
216
|
+
*/
|
|
105
217
|
get effectiveRate () {
|
|
106
218
|
return this._limiter && this._limiter.effectiveRate()
|
|
107
219
|
}
|
|
108
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Maximum samples per second if a limiter is present.
|
|
223
|
+
* @returns {number|undefined}
|
|
224
|
+
*/
|
|
109
225
|
get maxPerSecond () {
|
|
110
226
|
return this._limiter && this._limiter._rateLimit
|
|
111
227
|
}
|
|
112
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Checks whether the provided span matches all configured criteria.
|
|
231
|
+
*
|
|
232
|
+
* @param {DatadogSpan} span
|
|
233
|
+
* @returns {boolean}
|
|
234
|
+
*/
|
|
113
235
|
match (span) {
|
|
114
236
|
for (const matcher of this.matchers) {
|
|
115
237
|
// Rule is a special object with a .match() property.
|
|
@@ -126,7 +248,7 @@ class SamplingRule {
|
|
|
126
248
|
/**
|
|
127
249
|
* Determines whether a span should be sampled based on the configured sampling rule.
|
|
128
250
|
*
|
|
129
|
-
* @param {
|
|
251
|
+
* @param {DatadogSpan|DatadogSpanContext} span - The span or span context to evaluate.
|
|
130
252
|
* @returns {boolean} `true` if the span should be sampled, otherwise `false`.
|
|
131
253
|
*/
|
|
132
254
|
sample (span) {
|
|
@@ -3,11 +3,23 @@
|
|
|
3
3
|
const { USER_KEEP, AUTO_KEEP } = require('../../../ext').priority
|
|
4
4
|
const SamplingRule = require('./sampling_rule')
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Samples individual spans within a trace using span-level rules.
|
|
8
|
+
*/
|
|
6
9
|
class SpanSampler {
|
|
10
|
+
/**
|
|
11
|
+
* @param {{ spanSamplingRules?: Array<import('./sampling_rule')>|Array<Record<string, unknown>> }} [config]
|
|
12
|
+
*/
|
|
7
13
|
constructor ({ spanSamplingRules = [] } = {}) {
|
|
8
14
|
this._rules = spanSamplingRules.map(SamplingRule.from)
|
|
9
15
|
}
|
|
10
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Finds the first matching span sampling rule for the given span.
|
|
19
|
+
*
|
|
20
|
+
* @param {import('./opentracing/span')} context
|
|
21
|
+
* @returns {import('./sampling_rule')|undefined}
|
|
22
|
+
*/
|
|
11
23
|
findRule (context) {
|
|
12
24
|
for (const rule of this._rules) {
|
|
13
25
|
// Rule is a special object with a .match() property.
|
|
@@ -19,6 +31,13 @@ class SpanSampler {
|
|
|
19
31
|
}
|
|
20
32
|
}
|
|
21
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Applies span sampling to spans in the trace, tagging matching spans with
|
|
36
|
+
* span sampling metadata when appropriate.
|
|
37
|
+
*
|
|
38
|
+
* @param {import('./opentracing/span_context')} spanContext
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/
|
|
22
41
|
sample (spanContext) {
|
|
23
42
|
const decision = spanContext._sampling.priority
|
|
24
43
|
if (decision === USER_KEEP || decision === AUTO_KEEP) return
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
const { SAMPLING_MECHANISM_APPSEC } = require('../constants')
|
|
4
4
|
const RateLimiter = require('../rate_limiter')
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Returns a rate limiter tuned for the provided product configuration.
|
|
8
|
+
*
|
|
9
|
+
* @param {{ appsec?: { enabled?: boolean }, iast?: { enabled?: boolean } } | undefined} config
|
|
10
|
+
* @returns {import('../rate_limiter')}
|
|
11
|
+
*/
|
|
6
12
|
function getProductRateLimiter (config) {
|
|
7
13
|
if (config?.appsec?.enabled || config?.iast?.enabled) {
|
|
8
14
|
return new RateLimiter(1, 'minute') // onePerMinute
|
|
@@ -11,6 +17,9 @@ function getProductRateLimiter (config) {
|
|
|
11
17
|
return new RateLimiter(0) // dropAll
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Available products and their identifiers/mechanisms.
|
|
22
|
+
*/
|
|
14
23
|
const PRODUCTS = {
|
|
15
24
|
APM: { id: 1 << 0 },
|
|
16
25
|
ASM: { id: 1 << 1, mechanism: SAMPLING_MECHANISM_APPSEC },
|
|
@@ -2,15 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
const { TRACE_SOURCE_PROPAGATION_KEY } = require('../constants')
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Adds or updates the trace source propagation tag with the given product bit.
|
|
7
|
+
*
|
|
8
|
+
* @param {Record<string, unknown>|undefined} tags
|
|
9
|
+
* @param {{ id: number }|undefined} product
|
|
10
|
+
* @returns {Record<string, unknown>|undefined}
|
|
11
|
+
*/
|
|
5
12
|
function addTraceSourceTag (tags, product) {
|
|
6
13
|
if (tags && product) {
|
|
7
|
-
const actual = tags[TRACE_SOURCE_PROPAGATION_KEY]
|
|
14
|
+
const actual = tags[TRACE_SOURCE_PROPAGATION_KEY]
|
|
15
|
+
? Number.parseInt(String(tags[TRACE_SOURCE_PROPAGATION_KEY]), 16)
|
|
16
|
+
: 0
|
|
8
17
|
tags[TRACE_SOURCE_PROPAGATION_KEY] = ((actual | product.id) >>> 0).toString(16).padStart(2, '0')
|
|
9
18
|
}
|
|
10
19
|
|
|
11
20
|
return tags
|
|
12
21
|
}
|
|
13
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Returns true when the trace source propagation tag exists on the given tags object.
|
|
25
|
+
*
|
|
26
|
+
* @param {Record<string, unknown>} tags
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
14
29
|
function hasTraceSourcePropagationTag (tags) {
|
|
15
30
|
return Object.hasOwn(tags, TRACE_SOURCE_PROPAGATION_KEY)
|
|
16
31
|
}
|
|
@@ -8,12 +8,19 @@ const { addTraceSourceTag, hasTraceSourcePropagationTag } = require('./tracesour
|
|
|
8
8
|
const { getProductRateLimiter } = require('./product')
|
|
9
9
|
|
|
10
10
|
class TraceSourcePrioritySampler extends PrioritySampler {
|
|
11
|
+
/**
|
|
12
|
+
* @override
|
|
13
|
+
*/
|
|
11
14
|
configure (env, sampler, config) {
|
|
12
15
|
// rules not supported
|
|
13
16
|
this._env = env
|
|
14
17
|
this._limiter = getProductRateLimiter(config)
|
|
15
18
|
}
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @override
|
|
22
|
+
* @returns {import('../priority_sampler').SamplingPriority|undefined}
|
|
23
|
+
*/
|
|
17
24
|
_getPriorityFromTags (tags, context) {
|
|
18
25
|
if (Object.hasOwn(tags, MANUAL_KEEP) &&
|
|
19
26
|
tags[MANUAL_KEEP] !== false &&
|
|
@@ -23,6 +30,9 @@ class TraceSourcePrioritySampler extends PrioritySampler {
|
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @override
|
|
35
|
+
*/
|
|
26
36
|
_getPriorityFromAuto (span) {
|
|
27
37
|
const context = this._getContext(span)
|
|
28
38
|
|
|
@@ -35,6 +45,9 @@ class TraceSourcePrioritySampler extends PrioritySampler {
|
|
|
35
45
|
return this._isSampledByRateLimit(context) ? AUTO_KEEP : AUTO_REJECT
|
|
36
46
|
}
|
|
37
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
*/
|
|
38
51
|
setPriority (span, samplingPriority, product) {
|
|
39
52
|
super.setPriority(span, samplingPriority, product)
|
|
40
53
|
|
|
@@ -13,12 +13,18 @@ let pluginManager
|
|
|
13
13
|
let samplingRules = []
|
|
14
14
|
let alreadyRan = false
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @returns {Record<string, unknown>}
|
|
18
|
+
*/
|
|
16
19
|
function getIntegrationsAndAnalytics () {
|
|
17
20
|
return {
|
|
18
21
|
integrations_loaded: Object.keys(pluginManager._pluginsByName)
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @param {{ agentError: { code: string, message: string } }} [options]
|
|
27
|
+
*/
|
|
22
28
|
function startupLog ({ agentError } = {}) {
|
|
23
29
|
if (!config || !pluginManager) {
|
|
24
30
|
return
|
|
@@ -34,7 +40,7 @@ function startupLog ({ agentError } = {}) {
|
|
|
34
40
|
return
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
const out = tracerInfo(
|
|
43
|
+
const out = tracerInfo()
|
|
38
44
|
|
|
39
45
|
if (agentError) {
|
|
40
46
|
out.agent_error = agentError.message
|
|
@@ -50,6 +56,9 @@ function startupLog ({ agentError } = {}) {
|
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
|
|
59
|
+
/**
|
|
60
|
+
* @returns {Record<string, unknown>}
|
|
61
|
+
*/
|
|
53
62
|
function tracerInfo () {
|
|
54
63
|
const url = config.url || `http://${config.hostname || defaults.hostname}:${config.port}`
|
|
55
64
|
|
|
@@ -94,14 +103,23 @@ function tracerInfo () {
|
|
|
94
103
|
return out
|
|
95
104
|
}
|
|
96
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @param {import('./config')} aConfig
|
|
108
|
+
*/
|
|
97
109
|
function setStartupLogConfig (aConfig) {
|
|
98
110
|
config = aConfig
|
|
99
111
|
}
|
|
100
112
|
|
|
113
|
+
/**
|
|
114
|
+
* @param {import('./plugin_manager')} thePluginManager
|
|
115
|
+
*/
|
|
101
116
|
function setStartupLogPluginManager (thePluginManager) {
|
|
102
117
|
pluginManager = thePluginManager
|
|
103
118
|
}
|
|
104
119
|
|
|
120
|
+
/**
|
|
121
|
+
* @param {import('./sampling_rule')} theRules
|
|
122
|
+
*/
|
|
105
123
|
function setSamplingRules (theRules) {
|
|
106
124
|
samplingRules = theRules
|
|
107
125
|
}
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
"DD_AGENT_HOST": ["A"],
|
|
6
6
|
"DD_AGENTLESS_LOG_SUBMISSION_ENABLED": ["A"],
|
|
7
7
|
"DD_AGENTLESS_LOG_SUBMISSION_URL": ["A"],
|
|
8
|
+
"DD_AI_GUARD_ENABLED": ["A"],
|
|
9
|
+
"DD_AI_GUARD_ENDPOINT": ["A"],
|
|
10
|
+
"DD_AI_GUARD_MAX_CONTENT_SIZE": ["A"],
|
|
11
|
+
"DD_AI_GUARD_MAX_MESSAGES_LENGTH": ["A"],
|
|
12
|
+
"DD_AI_GUARD_TIMEOUT": ["A"],
|
|
8
13
|
"DD_API_KEY": ["A"],
|
|
9
14
|
"DD_API_SECURITY_ENABLED": ["A"],
|
|
10
15
|
"DD_API_SECURITY_SAMPLE_DELAY": ["A"],
|
|
@@ -12,6 +17,7 @@
|
|
|
12
17
|
"DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT": ["A"],
|
|
13
18
|
"DD_APM_FLUSH_DEADLINE_MILLISECONDS": ["A"],
|
|
14
19
|
"DD_APM_TRACING_ENABLED": ["A"],
|
|
20
|
+
"DD_APP_KEY": ["A"],
|
|
15
21
|
"DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODE": ["A"],
|
|
16
22
|
"DD_APPSEC_COLLECT_ALL_HEADERS": ["A"],
|
|
17
23
|
"DD_APPSEC_ENABLED": ["A"],
|
package/version.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
var version = require('./package.json').version
|
|
4
|
-
|
|
5
|
-
var
|
|
4
|
+
// @ts-expect-error
|
|
5
|
+
var /** @type {RegExpMatchArray} */ ddMatches = version.match(/^(\d+)\.(\d+)\.(\d+)/)
|
|
6
|
+
// @ts-expect-error
|
|
7
|
+
var /** @type {RegExpMatchArray} */ nodeMatches = process.versions.node.match(/^(\d+)\.(\d+)\.(\d+)/)
|
|
6
8
|
|
|
7
9
|
module.exports = {
|
|
8
10
|
VERSION: version,
|