dd-trace 5.41.0 → 5.42.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 +1 -0
- package/index.d.ts +8 -1
- package/package.json +6 -3
- package/packages/datadog-esbuild/index.js +3 -1
- package/packages/datadog-instrumentations/src/cucumber.js +37 -29
- package/packages/datadog-instrumentations/src/fetch.js +1 -1
- package/packages/datadog-instrumentations/src/google-cloud-vertexai.js +102 -0
- package/packages/datadog-instrumentations/src/{check_require_cache.js → helpers/check-require-cache.js} +2 -2
- package/packages/datadog-instrumentations/src/helpers/hooks.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/register.js +4 -1
- package/packages/datadog-instrumentations/src/jest.js +72 -49
- package/packages/datadog-instrumentations/src/langchain.js +29 -10
- package/packages/datadog-instrumentations/src/mocha/main.js +53 -34
- package/packages/datadog-instrumentations/src/mocha/utils.js +34 -24
- package/packages/datadog-instrumentations/src/mocha/worker.js +7 -8
- package/packages/datadog-instrumentations/src/openai.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +37 -30
- package/packages/datadog-instrumentations/src/vitest.js +64 -29
- package/packages/datadog-plugin-cucumber/src/index.js +13 -4
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +41 -35
- package/packages/datadog-plugin-cypress/src/plugin.js +10 -0
- package/packages/datadog-plugin-google-cloud-vertexai/src/index.js +195 -0
- package/packages/datadog-plugin-jest/src/index.js +18 -6
- package/packages/datadog-plugin-langchain/src/handlers/embedding.js +4 -1
- package/packages/datadog-plugin-mocha/src/index.js +13 -4
- package/packages/datadog-plugin-playwright/src/index.js +19 -5
- package/packages/datadog-plugin-vitest/src/index.js +41 -17
- package/packages/dd-trace/src/appsec/api_security_sampler.js +7 -3
- package/packages/dd-trace/src/appsec/blocking.js +23 -16
- package/packages/dd-trace/src/appsec/graphql.js +13 -6
- package/packages/dd-trace/src/appsec/rasp/utils.js +0 -1
- package/packages/dd-trace/src/appsec/reporter.js +35 -0
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/index.js +5 -1
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +16 -1
- package/packages/dd-trace/src/appsec/telemetry/waf.js +16 -1
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +43 -13
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +15 -14
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +1 -2
- package/packages/dd-trace/src/ci-visibility/telemetry.js +2 -1
- package/packages/dd-trace/src/ci-visibility/{quarantined-tests/get-quarantined-tests.js → test-management/get-test-management-tests.js} +5 -5
- package/packages/dd-trace/src/config.js +11 -1
- package/packages/dd-trace/src/dogstatsd.js +137 -28
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +9 -2
- package/packages/dd-trace/src/lambda/runtime/patch.js +5 -3
- package/packages/dd-trace/src/lambda/runtime/ritm.js +13 -18
- package/packages/dd-trace/src/llmobs/plugins/openai.js +27 -2
- package/packages/dd-trace/src/opentracing/span.js +3 -0
- package/packages/dd-trace/src/plugin_manager.js +0 -4
- package/packages/dd-trace/src/plugins/ci_plugin.js +38 -10
- package/packages/dd-trace/src/plugins/index.js +2 -0
- package/packages/dd-trace/src/plugins/util/git.js +7 -3
- package/packages/dd-trace/src/plugins/util/test.js +10 -0
- package/packages/dd-trace/src/plugins/util/web.js +5 -2
- package/packages/dd-trace/src/priority_sampler.js +116 -15
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +15 -80
- package/packages/dd-trace/src/sampler.js +9 -0
- package/packages/dd-trace/src/standalone/product.js +6 -2
- package/packages/dd-trace/src/startup-log.js +2 -1
- package/packages/dd-trace/src/telemetry/metrics.js +0 -8
- package/packages/dd-trace/src/tracer.js +1 -1
- /package/packages/datadog-instrumentations/src/{utils/src → helpers}/extract-package-and-module-path.js +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
const v8 = require('v8')
|
|
6
6
|
const os = require('os')
|
|
7
|
-
const { DogStatsDClient } = require('../dogstatsd')
|
|
7
|
+
const { DogStatsDClient, MetricsAggregationClient } = require('../dogstatsd')
|
|
8
8
|
const log = require('../log')
|
|
9
9
|
const Histogram = require('../histogram')
|
|
10
10
|
const { performance, PerformanceObserver } = require('perf_hooks')
|
|
@@ -25,9 +25,6 @@ let interval
|
|
|
25
25
|
let client
|
|
26
26
|
let time
|
|
27
27
|
let cpuUsage
|
|
28
|
-
let gauges
|
|
29
|
-
let counters
|
|
30
|
-
let histograms
|
|
31
28
|
let elu
|
|
32
29
|
|
|
33
30
|
reset()
|
|
@@ -49,7 +46,7 @@ const runtimeMetrics = module.exports = {
|
|
|
49
46
|
nativeMetrics = null
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
client = new DogStatsDClient(clientConfig)
|
|
49
|
+
client = new MetricsAggregationClient(new DogStatsDClient(clientConfig))
|
|
53
50
|
|
|
54
51
|
time = process.hrtime()
|
|
55
52
|
|
|
@@ -98,50 +95,27 @@ const runtimeMetrics = module.exports = {
|
|
|
98
95
|
},
|
|
99
96
|
|
|
100
97
|
boolean (name, value, tag) {
|
|
101
|
-
|
|
98
|
+
client && client.boolean(name, value, tag)
|
|
102
99
|
},
|
|
103
100
|
|
|
104
101
|
histogram (name, value, tag) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
histograms[name] = histograms[name] || new Map()
|
|
108
|
-
|
|
109
|
-
if (!histograms[name].has(tag)) {
|
|
110
|
-
histograms[name].set(tag, new Histogram())
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
histograms[name].get(tag).record(value)
|
|
102
|
+
client && client.histogram(name, value, tag)
|
|
114
103
|
},
|
|
115
104
|
|
|
116
105
|
count (name, count, tag, monotonic = false) {
|
|
117
|
-
|
|
118
|
-
if (typeof tag === 'boolean') {
|
|
119
|
-
monotonic = tag
|
|
120
|
-
tag = undefined
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const map = monotonic ? counters : gauges
|
|
124
|
-
|
|
125
|
-
map[name] = map[name] || new Map()
|
|
126
|
-
|
|
127
|
-
const value = map[name].get(tag) || 0
|
|
128
|
-
|
|
129
|
-
map[name].set(tag, value + count)
|
|
106
|
+
client && client.count(name, count, tag, monotonic)
|
|
130
107
|
},
|
|
131
108
|
|
|
132
109
|
gauge (name, value, tag) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
gauges[name] = gauges[name] || new Map()
|
|
136
|
-
gauges[name].set(tag, value)
|
|
110
|
+
client && client.gauge(name, value, tag)
|
|
137
111
|
},
|
|
138
112
|
|
|
139
113
|
increment (name, tag, monotonic) {
|
|
140
|
-
|
|
114
|
+
client && client.increment(name, 1, tag, monotonic)
|
|
141
115
|
},
|
|
142
116
|
|
|
143
117
|
decrement (name, tag) {
|
|
144
|
-
|
|
118
|
+
client && client.decrement(name, 1, tag)
|
|
145
119
|
}
|
|
146
120
|
}
|
|
147
121
|
|
|
@@ -150,9 +124,6 @@ function reset () {
|
|
|
150
124
|
client = null
|
|
151
125
|
time = null
|
|
152
126
|
cpuUsage = null
|
|
153
|
-
gauges = {}
|
|
154
|
-
counters = {}
|
|
155
|
-
histograms = {}
|
|
156
127
|
nativeMetrics = null
|
|
157
128
|
gcObserver && gcObserver.disconnect()
|
|
158
129
|
gcObserver = null
|
|
@@ -246,33 +217,6 @@ function captureGCMetrics () {
|
|
|
246
217
|
gcProfiler.start()
|
|
247
218
|
}
|
|
248
219
|
|
|
249
|
-
function captureGauges () {
|
|
250
|
-
Object.keys(gauges).forEach(name => {
|
|
251
|
-
gauges[name].forEach((value, tag) => {
|
|
252
|
-
client.gauge(name, value, tag && [tag])
|
|
253
|
-
})
|
|
254
|
-
})
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function captureCounters () {
|
|
258
|
-
Object.keys(counters).forEach(name => {
|
|
259
|
-
counters[name].forEach((value, tag) => {
|
|
260
|
-
client.increment(name, value, tag && [tag])
|
|
261
|
-
})
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
counters = {}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function captureHistograms () {
|
|
268
|
-
Object.keys(histograms).forEach(name => {
|
|
269
|
-
histograms[name].forEach((stats, tag) => {
|
|
270
|
-
histogram(name, stats, tag && [tag])
|
|
271
|
-
stats.reset()
|
|
272
|
-
})
|
|
273
|
-
})
|
|
274
|
-
}
|
|
275
|
-
|
|
276
220
|
/**
|
|
277
221
|
* Gathers and reports Event Loop Utilization (ELU) since last run
|
|
278
222
|
*
|
|
@@ -295,9 +239,6 @@ function captureCommonMetrics () {
|
|
|
295
239
|
captureMemoryUsage()
|
|
296
240
|
captureProcess()
|
|
297
241
|
captureHeapStats()
|
|
298
|
-
captureGauges()
|
|
299
|
-
captureCounters()
|
|
300
|
-
captureHistograms()
|
|
301
242
|
captureELU()
|
|
302
243
|
captureGCMetrics()
|
|
303
244
|
}
|
|
@@ -339,21 +280,15 @@ function captureNativeMetrics () {
|
|
|
339
280
|
}
|
|
340
281
|
|
|
341
282
|
function histogram (name, stats, tags) {
|
|
342
|
-
tags = [].concat(tags)
|
|
283
|
+
tags = tags ? [].concat(tags) : []
|
|
343
284
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
285
|
+
if (tags.length > 0) {
|
|
286
|
+
for (const tag of tags) {
|
|
287
|
+
client.histogram(name, stats, tag)
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
client.histogram(name, stats)
|
|
347
291
|
}
|
|
348
|
-
|
|
349
|
-
client.gauge(`${name}.min`, stats.min, tags)
|
|
350
|
-
client.gauge(`${name}.max`, stats.max, tags)
|
|
351
|
-
client.increment(`${name}.sum`, stats.sum, tags)
|
|
352
|
-
client.increment(`${name}.total`, stats.sum, tags)
|
|
353
|
-
client.gauge(`${name}.avg`, stats.avg, tags)
|
|
354
|
-
client.increment(`${name}.count`, stats.count, tags)
|
|
355
|
-
client.gauge(`${name}.median`, stats.median, tags)
|
|
356
|
-
client.gauge(`${name}.95percentile`, stats.p95, tags)
|
|
357
292
|
}
|
|
358
293
|
|
|
359
294
|
function startGCObserver () {
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
class Sampler {
|
|
4
|
+
/**
|
|
5
|
+
* @param rate {number}
|
|
6
|
+
*/
|
|
4
7
|
constructor (rate) {
|
|
5
8
|
this._rate = rate
|
|
6
9
|
}
|
|
7
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @returns {number}
|
|
13
|
+
*/
|
|
8
14
|
rate () {
|
|
9
15
|
return this._rate
|
|
10
16
|
}
|
|
11
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @returns {boolean}
|
|
20
|
+
*/
|
|
12
21
|
isSampled () {
|
|
13
22
|
return this._rate === 1 || Math.random() < this._rate
|
|
14
23
|
}
|
|
@@ -13,12 +13,16 @@ function getProductRateLimiter (config) {
|
|
|
13
13
|
return dropAll
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const PRODUCTS = {
|
|
17
17
|
APM: { id: 1 << 0 },
|
|
18
18
|
ASM: { id: 1 << 1, mechanism: SAMPLING_MECHANISM_APPSEC },
|
|
19
19
|
DSM: { id: 1 << 2 },
|
|
20
20
|
DJM: { id: 1 << 3 },
|
|
21
|
-
DBM: { id: 1 << 4 }
|
|
21
|
+
DBM: { id: 1 << 4 }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
...PRODUCTS,
|
|
22
26
|
|
|
23
27
|
getProductRateLimiter
|
|
24
28
|
}
|
|
@@ -86,7 +86,8 @@ function tracerInfo () {
|
|
|
86
86
|
|
|
87
87
|
out.log_injection_enabled = !!config.logInjection
|
|
88
88
|
out.runtime_metrics_enabled = !!config.runtimeMetrics
|
|
89
|
-
|
|
89
|
+
const profilingEnabled = config.profiling?.enabled
|
|
90
|
+
out.profiling_enabled = profilingEnabled === 'true' || profilingEnabled === 'auto'
|
|
90
91
|
Object.assign(out, getIntegrationsAndAnalytics())
|
|
91
92
|
|
|
92
93
|
out.appsec_enabled = !!config.appsec.enabled
|
|
@@ -27,19 +27,11 @@ function hasPoints (metric) {
|
|
|
27
27
|
return metric.points.length > 0
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
let versionTag
|
|
31
|
-
|
|
32
30
|
class Metric {
|
|
33
31
|
constructor (namespace, metric, common, tags) {
|
|
34
32
|
this.namespace = namespace.toString()
|
|
35
33
|
this.metric = common ? metric : `nodejs.${metric}`
|
|
36
34
|
this.tags = tagArray(tags)
|
|
37
|
-
if (common) {
|
|
38
|
-
if (versionTag === undefined) {
|
|
39
|
-
versionTag = `version:${process.version}`
|
|
40
|
-
}
|
|
41
|
-
this.tags.push(versionTag)
|
|
42
|
-
}
|
|
43
35
|
this.common = common
|
|
44
36
|
|
|
45
37
|
this.points = []
|
|
@@ -7,7 +7,7 @@ const { isError } = require('./util')
|
|
|
7
7
|
const { setStartupLogConfig } = require('./startup-log')
|
|
8
8
|
const { ERROR_MESSAGE, ERROR_TYPE, ERROR_STACK } = require('../../dd-trace/src/constants')
|
|
9
9
|
const { DataStreamsCheckpointer, DataStreamsManager, DataStreamsProcessor } = require('./datastreams')
|
|
10
|
-
const { flushStartupLogs } = require('../../datadog-instrumentations/src/
|
|
10
|
+
const { flushStartupLogs } = require('../../datadog-instrumentations/src/helpers/check-require-cache')
|
|
11
11
|
const log = require('./log/writer')
|
|
12
12
|
|
|
13
13
|
const SPAN_TYPE = tags.SPAN_TYPE
|
|
File without changes
|