dd-trace 5.35.0 → 5.36.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/index.d.ts +3 -7
- package/package.json +4 -4
- package/packages/datadog-core/index.js +1 -1
- package/packages/datadog-core/src/storage.js +76 -31
- package/packages/datadog-instrumentations/src/jest.js +3 -7
- package/packages/datadog-plugin-aerospike/src/index.js +1 -1
- package/packages/datadog-plugin-apollo/src/gateway/fetch.js +1 -1
- package/packages/datadog-plugin-apollo/src/gateway/index.js +1 -1
- package/packages/datadog-plugin-apollo/src/gateway/request.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/base.js +3 -3
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +4 -4
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -2
- package/packages/datadog-plugin-azure-functions/src/index.js +1 -1
- package/packages/datadog-plugin-couchbase/src/index.js +2 -2
- package/packages/datadog-plugin-cucumber/src/index.js +11 -11
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +6 -1
- package/packages/datadog-plugin-cypress/src/support.js +36 -29
- package/packages/datadog-plugin-grpc/src/client.js +1 -1
- package/packages/datadog-plugin-grpc/src/server.js +1 -1
- package/packages/datadog-plugin-hapi/src/index.js +1 -1
- package/packages/datadog-plugin-http/src/client.js +1 -1
- package/packages/datadog-plugin-http/src/server.js +1 -1
- package/packages/datadog-plugin-http2/src/client.js +3 -3
- package/packages/datadog-plugin-http2/src/server.js +1 -1
- package/packages/datadog-plugin-jest/src/index.js +6 -11
- package/packages/datadog-plugin-langchain/src/tracing.js +1 -1
- package/packages/datadog-plugin-mariadb/src/index.js +3 -3
- package/packages/datadog-plugin-mocha/src/index.js +13 -13
- package/packages/datadog-plugin-next/src/index.js +4 -4
- package/packages/datadog-plugin-openai/src/tracing.js +1 -1
- package/packages/datadog-plugin-playwright/src/index.js +4 -4
- package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
- package/packages/datadog-plugin-router/src/index.js +2 -2
- package/packages/datadog-plugin-selenium/src/index.js +1 -1
- package/packages/datadog-plugin-vitest/src/index.js +11 -11
- package/packages/dd-trace/src/appsec/graphql.js +6 -6
- package/packages/dd-trace/src/appsec/iast/analyzers/code-injection-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +6 -6
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +2 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/sql-injection-analyzer.js +5 -5
- package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +2 -2
- package/packages/dd-trace/src/appsec/iast/context/context-plugin.js +2 -2
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +2 -2
- package/packages/dd-trace/src/appsec/iast/index.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/constants.js +6 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +8 -8
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +65 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-telemetry.js +14 -5
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +80 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +1 -1
- package/packages/dd-trace/src/appsec/index.js +4 -4
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/fs-plugin.js +5 -5
- package/packages/dd-trace/src/appsec/rasp/lfi.js +1 -1
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +2 -2
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +1 -1
- package/packages/dd-trace/src/appsec/reporter.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -1
- package/packages/dd-trace/src/appsec/waf/index.js +1 -1
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +2 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +17 -10
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +3 -3
- package/packages/dd-trace/src/config.js +2 -0
- package/packages/dd-trace/src/data_streams_context.js +2 -2
- package/packages/dd-trace/src/exporters/common/agents.js +1 -1
- package/packages/dd-trace/src/exporters/common/request.js +3 -3
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +1 -1
- package/packages/dd-trace/src/log/writer.js +3 -3
- package/packages/dd-trace/src/noop/span.js +1 -1
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +5 -4
- package/packages/dd-trace/src/opentracing/span.js +1 -1
- package/packages/dd-trace/src/plugin_manager.js +3 -1
- package/packages/dd-trace/src/plugins/apollo.js +1 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +35 -1
- package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
- package/packages/dd-trace/src/plugins/plugin.js +8 -8
- package/packages/dd-trace/src/plugins/tracing.js +3 -3
- package/packages/dd-trace/src/plugins/util/git.js +3 -3
- package/packages/dd-trace/src/plugins/util/test.js +5 -1
- package/packages/dd-trace/src/profiling/exporters/agent.js +3 -3
- package/packages/dd-trace/src/profiling/profilers/wall.js +1 -1
- package/packages/dd-trace/src/scope.js +5 -5
- package/packages/dd-trace/src/tracer.js +0 -14
|
@@ -291,6 +291,7 @@ class JestPlugin extends CiPlugin {
|
|
|
291
291
|
if (isJestWorker) {
|
|
292
292
|
this.tracer._exporter.flush()
|
|
293
293
|
}
|
|
294
|
+
this.removeAllDiProbes()
|
|
294
295
|
})
|
|
295
296
|
|
|
296
297
|
/**
|
|
@@ -317,15 +318,15 @@ class JestPlugin extends CiPlugin {
|
|
|
317
318
|
})
|
|
318
319
|
|
|
319
320
|
this.addSub('ci:jest:test:start', (test) => {
|
|
320
|
-
const store = storage.getStore()
|
|
321
|
+
const store = storage('legacy').getStore()
|
|
321
322
|
const span = this.startTestSpan(test)
|
|
322
323
|
|
|
323
324
|
this.enter(span, store)
|
|
324
325
|
this.activeTestSpan = span
|
|
325
326
|
})
|
|
326
327
|
|
|
327
|
-
this.addSub('ci:jest:test:finish', ({ status, testStartLine
|
|
328
|
-
const span = storage.getStore().span
|
|
328
|
+
this.addSub('ci:jest:test:finish', ({ status, testStartLine }) => {
|
|
329
|
+
const span = storage('legacy').getStore().span
|
|
329
330
|
span.setTag(TEST_STATUS, status)
|
|
330
331
|
if (testStartLine) {
|
|
331
332
|
span.setTag(TEST_SOURCE_START, testStartLine)
|
|
@@ -346,15 +347,11 @@ class JestPlugin extends CiPlugin {
|
|
|
346
347
|
span.finish()
|
|
347
348
|
finishAllTraceSpans(span)
|
|
348
349
|
this.activeTestSpan = null
|
|
349
|
-
if (shouldRemoveProbe && this.runningTestProbeId) {
|
|
350
|
-
promises.isProbeRemoved = withTimeout(this.removeDiProbe(this.runningTestProbeId), 2000)
|
|
351
|
-
this.runningTestProbeId = null
|
|
352
|
-
}
|
|
353
350
|
})
|
|
354
351
|
|
|
355
352
|
this.addSub('ci:jest:test:err', ({ error, shouldSetProbe, promises }) => {
|
|
356
353
|
if (error) {
|
|
357
|
-
const store = storage.getStore()
|
|
354
|
+
const store = storage('legacy').getStore()
|
|
358
355
|
if (store && store.span) {
|
|
359
356
|
const span = store.span
|
|
360
357
|
span.setTag(TEST_STATUS, 'fail')
|
|
@@ -362,9 +359,7 @@ class JestPlugin extends CiPlugin {
|
|
|
362
359
|
if (shouldSetProbe) {
|
|
363
360
|
const probeInformation = this.addDiProbe(error)
|
|
364
361
|
if (probeInformation) {
|
|
365
|
-
const {
|
|
366
|
-
this.runningTestProbeId = probeId
|
|
367
|
-
this.testErrorStackIndex = stackIndex
|
|
362
|
+
const { setProbePromise } = probeInformation
|
|
368
363
|
promises.isProbeReady = withTimeout(setProbePromise, 2000)
|
|
369
364
|
}
|
|
370
365
|
}
|
|
@@ -13,12 +13,12 @@ class MariadbPlugin extends MySQLPlugin {
|
|
|
13
13
|
super(...args)
|
|
14
14
|
|
|
15
15
|
this.addSub(`apm:${this.component}:pool:skip`, () => {
|
|
16
|
-
skippedStore = storage.getStore()
|
|
17
|
-
storage.enterWith({ noop: true })
|
|
16
|
+
skippedStore = storage('legacy').getStore()
|
|
17
|
+
storage('legacy').enterWith({ noop: true })
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
this.addSub(`apm:${this.component}:pool:unskip`, () => {
|
|
21
|
-
storage.enterWith(skippedStore)
|
|
21
|
+
storage('legacy').enterWith(skippedStore)
|
|
22
22
|
skippedStore = undefined
|
|
23
23
|
})
|
|
24
24
|
}
|
|
@@ -155,13 +155,13 @@ class MochaPlugin extends CiPlugin {
|
|
|
155
155
|
if (itrCorrelationId) {
|
|
156
156
|
testSuiteSpan.setTag(ITR_CORRELATION_ID, itrCorrelationId)
|
|
157
157
|
}
|
|
158
|
-
const store = storage.getStore()
|
|
158
|
+
const store = storage('legacy').getStore()
|
|
159
159
|
this.enter(testSuiteSpan, store)
|
|
160
160
|
this._testSuites.set(testSuite, testSuiteSpan)
|
|
161
161
|
})
|
|
162
162
|
|
|
163
163
|
this.addSub('ci:mocha:test-suite:finish', (status) => {
|
|
164
|
-
const store = storage.getStore()
|
|
164
|
+
const store = storage('legacy').getStore()
|
|
165
165
|
if (store && store.span) {
|
|
166
166
|
const span = store.span
|
|
167
167
|
// the test status of the suite may have been set in ci:mocha:test-suite:error already
|
|
@@ -174,7 +174,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
174
174
|
})
|
|
175
175
|
|
|
176
176
|
this.addSub('ci:mocha:test-suite:error', (err) => {
|
|
177
|
-
const store = storage.getStore()
|
|
177
|
+
const store = storage('legacy').getStore()
|
|
178
178
|
if (store && store.span) {
|
|
179
179
|
const span = store.span
|
|
180
180
|
span.setTag('error', err)
|
|
@@ -183,7 +183,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
183
183
|
})
|
|
184
184
|
|
|
185
185
|
this.addSub('ci:mocha:test:start', (testInfo) => {
|
|
186
|
-
const store = storage.getStore()
|
|
186
|
+
const store = storage('legacy').getStore()
|
|
187
187
|
const span = this.startTestSpan(testInfo)
|
|
188
188
|
|
|
189
189
|
this.enter(span, store)
|
|
@@ -195,7 +195,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
195
195
|
})
|
|
196
196
|
|
|
197
197
|
this.addSub('ci:mocha:test:finish', ({ status, hasBeenRetried, isLastRetry }) => {
|
|
198
|
-
const store = storage.getStore()
|
|
198
|
+
const store = storage('legacy').getStore()
|
|
199
199
|
const span = store?.span
|
|
200
200
|
|
|
201
201
|
if (span) {
|
|
@@ -219,15 +219,15 @@ class MochaPlugin extends CiPlugin {
|
|
|
219
219
|
span.finish()
|
|
220
220
|
finishAllTraceSpans(span)
|
|
221
221
|
this.activeTestSpan = null
|
|
222
|
-
if (this.di && this.libraryConfig?.isDiEnabled && this.
|
|
223
|
-
this.removeDiProbe(this.
|
|
224
|
-
this.
|
|
222
|
+
if (this.di && this.libraryConfig?.isDiEnabled && this.runningTestProbe && isLastRetry) {
|
|
223
|
+
this.removeDiProbe(this.runningTestProbe)
|
|
224
|
+
this.runningTestProbe = null
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
})
|
|
228
228
|
|
|
229
229
|
this.addSub('ci:mocha:test:skip', (testInfo) => {
|
|
230
|
-
const store = storage.getStore()
|
|
230
|
+
const store = storage('legacy').getStore()
|
|
231
231
|
// skipped through it.skip, so the span is not created yet
|
|
232
232
|
// for this test
|
|
233
233
|
if (!store) {
|
|
@@ -237,7 +237,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
237
237
|
})
|
|
238
238
|
|
|
239
239
|
this.addSub('ci:mocha:test:error', (err) => {
|
|
240
|
-
const store = storage.getStore()
|
|
240
|
+
const store = storage('legacy').getStore()
|
|
241
241
|
const span = store?.span
|
|
242
242
|
if (err && span) {
|
|
243
243
|
if (err.constructor.name === 'Pending' && !this.forbidPending) {
|
|
@@ -250,7 +250,7 @@ class MochaPlugin extends CiPlugin {
|
|
|
250
250
|
})
|
|
251
251
|
|
|
252
252
|
this.addSub('ci:mocha:test:retry', ({ isFirstAttempt, willBeRetried, err, test }) => {
|
|
253
|
-
const store = storage.getStore()
|
|
253
|
+
const store = storage('legacy').getStore()
|
|
254
254
|
const span = store?.span
|
|
255
255
|
if (span) {
|
|
256
256
|
span.setTag(TEST_STATUS, 'fail')
|
|
@@ -275,8 +275,8 @@ class MochaPlugin extends CiPlugin {
|
|
|
275
275
|
if (isFirstAttempt && willBeRetried && this.di && this.libraryConfig?.isDiEnabled) {
|
|
276
276
|
const probeInformation = this.addDiProbe(err)
|
|
277
277
|
if (probeInformation) {
|
|
278
|
-
const {
|
|
279
|
-
this.
|
|
278
|
+
const { file, line, stackIndex } = probeInformation
|
|
279
|
+
this.runningTestProbe = { file, line }
|
|
280
280
|
this.testErrorStackIndex = stackIndex
|
|
281
281
|
test._ddShouldWaitForHitProbe = true
|
|
282
282
|
// TODO: we're not waiting for setProbePromise to be resolved, so there might be race conditions
|
|
@@ -20,7 +20,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
bindStart ({ req, res }) {
|
|
23
|
-
const store = storage.getStore()
|
|
23
|
+
const store = storage('legacy').getStore()
|
|
24
24
|
const childOf = store ? store.span : store
|
|
25
25
|
const span = this.tracer.startSpan(this.operationName(), {
|
|
26
26
|
childOf,
|
|
@@ -43,7 +43,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
43
43
|
|
|
44
44
|
error ({ span, error }) {
|
|
45
45
|
if (!span) {
|
|
46
|
-
const store = storage.getStore()
|
|
46
|
+
const store = storage('legacy').getStore()
|
|
47
47
|
if (!store) return
|
|
48
48
|
|
|
49
49
|
span = store.span
|
|
@@ -53,7 +53,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
finish ({ req, res, nextRequest = {} }) {
|
|
56
|
-
const store = storage.getStore()
|
|
56
|
+
const store = storage('legacy').getStore()
|
|
57
57
|
|
|
58
58
|
if (!store) return
|
|
59
59
|
|
|
@@ -85,7 +85,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
pageLoad ({ page, isAppPath = false, isStatic = false }) {
|
|
88
|
-
const store = storage.getStore()
|
|
88
|
+
const store = storage('legacy').getStore()
|
|
89
89
|
|
|
90
90
|
if (!store) return
|
|
91
91
|
|
|
@@ -60,7 +60,7 @@ class OpenAiTracingPlugin extends TracingPlugin {
|
|
|
60
60
|
bindStart (ctx) {
|
|
61
61
|
const { methodName, args, basePath, apiKey } = ctx
|
|
62
62
|
const payload = normalizeRequestPayload(methodName, args)
|
|
63
|
-
const store = storage.getStore() || {}
|
|
63
|
+
const store = storage('legacy').getStore() || {}
|
|
64
64
|
|
|
65
65
|
const span = this.startSpan('openai.request', {
|
|
66
66
|
service: this.config.service,
|
|
@@ -68,7 +68,7 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
68
68
|
})
|
|
69
69
|
|
|
70
70
|
this.addSub('ci:playwright:test-suite:start', (testSuiteAbsolutePath) => {
|
|
71
|
-
const store = storage.getStore()
|
|
71
|
+
const store = storage('legacy').getStore()
|
|
72
72
|
const testSuite = getTestSuitePath(testSuiteAbsolutePath, this.rootDir)
|
|
73
73
|
const testSourceFile = getTestSuitePath(testSuiteAbsolutePath, this.repositoryRoot)
|
|
74
74
|
|
|
@@ -102,7 +102,7 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
102
102
|
})
|
|
103
103
|
|
|
104
104
|
this.addSub('ci:playwright:test-suite:finish', ({ status, error }) => {
|
|
105
|
-
const store = storage.getStore()
|
|
105
|
+
const store = storage('legacy').getStore()
|
|
106
106
|
const span = store && store.span
|
|
107
107
|
if (!span) return
|
|
108
108
|
if (error) {
|
|
@@ -121,7 +121,7 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
121
121
|
})
|
|
122
122
|
|
|
123
123
|
this.addSub('ci:playwright:test:start', ({ testName, testSuiteAbsolutePath, testSourceLine, browserName }) => {
|
|
124
|
-
const store = storage.getStore()
|
|
124
|
+
const store = storage('legacy').getStore()
|
|
125
125
|
const testSuite = getTestSuitePath(testSuiteAbsolutePath, this.rootDir)
|
|
126
126
|
const testSourceFile = getTestSuitePath(testSuiteAbsolutePath, this.repositoryRoot)
|
|
127
127
|
const span = this.startTestSpan(testName, testSuite, testSourceFile, testSourceLine, browserName)
|
|
@@ -129,7 +129,7 @@ class PlaywrightPlugin extends CiPlugin {
|
|
|
129
129
|
this.enter(span, store)
|
|
130
130
|
})
|
|
131
131
|
this.addSub('ci:playwright:test:finish', ({ testStatus, steps, error, extraTags, isNew, isEfdRetry, isRetry }) => {
|
|
132
|
-
const store = storage.getStore()
|
|
132
|
+
const store = storage('legacy').getStore()
|
|
133
133
|
const span = store && store.span
|
|
134
134
|
if (!span) return
|
|
135
135
|
|
|
@@ -11,7 +11,7 @@ class RheaConsumerPlugin extends ConsumerPlugin {
|
|
|
11
11
|
super(...args)
|
|
12
12
|
|
|
13
13
|
this.addTraceSub('dispatch', ({ state }) => {
|
|
14
|
-
const span = storage.getStore().span
|
|
14
|
+
const span = storage('legacy').getStore().span
|
|
15
15
|
span.setTag('amqp.delivery.state', state)
|
|
16
16
|
})
|
|
17
17
|
}
|
|
@@ -29,7 +29,7 @@ class RouterPlugin extends WebPlugin {
|
|
|
29
29
|
context.middleware.push(span)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const store = storage.getStore()
|
|
32
|
+
const store = storage('legacy').getStore()
|
|
33
33
|
this._storeStack.push(store)
|
|
34
34
|
this.enter(span, store)
|
|
35
35
|
|
|
@@ -94,7 +94,7 @@ class RouterPlugin extends WebPlugin {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
_getStoreSpan () {
|
|
97
|
-
const store = storage.getStore()
|
|
97
|
+
const store = storage('legacy').getStore()
|
|
98
98
|
|
|
99
99
|
return store && store.span
|
|
100
100
|
}
|
|
@@ -70,7 +70,7 @@ class VitestPlugin extends CiPlugin {
|
|
|
70
70
|
isRetryReasonEfd
|
|
71
71
|
}) => {
|
|
72
72
|
const testSuite = getTestSuitePath(testSuiteAbsolutePath, this.repositoryRoot)
|
|
73
|
-
const store = storage.getStore()
|
|
73
|
+
const store = storage('legacy').getStore()
|
|
74
74
|
|
|
75
75
|
const extraTags = {
|
|
76
76
|
[TEST_SOURCE_FILE]: testSuite
|
|
@@ -102,7 +102,7 @@ class VitestPlugin extends CiPlugin {
|
|
|
102
102
|
})
|
|
103
103
|
|
|
104
104
|
this.addSub('ci:vitest:test:finish-time', ({ status, task }) => {
|
|
105
|
-
const store = storage.getStore()
|
|
105
|
+
const store = storage('legacy').getStore()
|
|
106
106
|
const span = store?.span
|
|
107
107
|
|
|
108
108
|
// we store the finish time to finish at a later hook
|
|
@@ -114,7 +114,7 @@ class VitestPlugin extends CiPlugin {
|
|
|
114
114
|
})
|
|
115
115
|
|
|
116
116
|
this.addSub('ci:vitest:test:pass', ({ task }) => {
|
|
117
|
-
const store = storage.getStore()
|
|
117
|
+
const store = storage('legacy').getStore()
|
|
118
118
|
const span = store?.span
|
|
119
119
|
|
|
120
120
|
if (span) {
|
|
@@ -128,15 +128,15 @@ class VitestPlugin extends CiPlugin {
|
|
|
128
128
|
})
|
|
129
129
|
|
|
130
130
|
this.addSub('ci:vitest:test:error', ({ duration, error, shouldSetProbe, promises }) => {
|
|
131
|
-
const store = storage.getStore()
|
|
131
|
+
const store = storage('legacy').getStore()
|
|
132
132
|
const span = store?.span
|
|
133
133
|
|
|
134
134
|
if (span) {
|
|
135
135
|
if (shouldSetProbe && this.di) {
|
|
136
136
|
const probeInformation = this.addDiProbe(error)
|
|
137
137
|
if (probeInformation) {
|
|
138
|
-
const {
|
|
139
|
-
this.
|
|
138
|
+
const { file, line, stackIndex, setProbePromise } = probeInformation
|
|
139
|
+
this.runningTestProbe = { file, line }
|
|
140
140
|
this.testErrorStackIndex = stackIndex
|
|
141
141
|
promises.setProbePromise = setProbePromise
|
|
142
142
|
}
|
|
@@ -221,13 +221,13 @@ class VitestPlugin extends CiPlugin {
|
|
|
221
221
|
}
|
|
222
222
|
})
|
|
223
223
|
this.telemetry.ciVisEvent(TELEMETRY_EVENT_CREATED, 'suite')
|
|
224
|
-
const store = storage.getStore()
|
|
224
|
+
const store = storage('legacy').getStore()
|
|
225
225
|
this.enter(testSuiteSpan, store)
|
|
226
226
|
this.testSuiteSpan = testSuiteSpan
|
|
227
227
|
})
|
|
228
228
|
|
|
229
229
|
this.addSub('ci:vitest:test-suite:finish', ({ status, onFinish }) => {
|
|
230
|
-
const store = storage.getStore()
|
|
230
|
+
const store = storage('legacy').getStore()
|
|
231
231
|
const span = store?.span
|
|
232
232
|
if (span) {
|
|
233
233
|
span.setTag(TEST_STATUS, status)
|
|
@@ -237,13 +237,13 @@ class VitestPlugin extends CiPlugin {
|
|
|
237
237
|
this.telemetry.ciVisEvent(TELEMETRY_EVENT_FINISHED, 'suite')
|
|
238
238
|
// TODO: too frequent flush - find for method in worker to decrease frequency
|
|
239
239
|
this.tracer._exporter.flush(onFinish)
|
|
240
|
-
if (this.
|
|
241
|
-
this.removeDiProbe(this.
|
|
240
|
+
if (this.runningTestProbe) {
|
|
241
|
+
this.removeDiProbe(this.runningTestProbe)
|
|
242
242
|
}
|
|
243
243
|
})
|
|
244
244
|
|
|
245
245
|
this.addSub('ci:vitest:test-suite:error', ({ error }) => {
|
|
246
|
-
const store = storage.getStore()
|
|
246
|
+
const store = storage('legacy').getStore()
|
|
247
247
|
const span = store?.span
|
|
248
248
|
if (span && error) {
|
|
249
249
|
span.setTag('error', error)
|
|
@@ -30,7 +30,7 @@ function disable () {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function onGraphqlStartResolve ({ context, resolverInfo }) {
|
|
33
|
-
const req = storage.getStore()?.req
|
|
33
|
+
const req = storage('legacy').getStore()?.req
|
|
34
34
|
|
|
35
35
|
if (!req) return
|
|
36
36
|
|
|
@@ -49,7 +49,7 @@ function onGraphqlStartResolve ({ context, resolverInfo }) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function enterInApolloMiddleware (data) {
|
|
52
|
-
const req = data?.req || storage.getStore()?.req
|
|
52
|
+
const req = data?.req || storage('legacy').getStore()?.req
|
|
53
53
|
if (!req) return
|
|
54
54
|
|
|
55
55
|
graphqlRequestData.set(req, {
|
|
@@ -59,7 +59,7 @@ function enterInApolloMiddleware (data) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function enterInApolloServerCoreRequest () {
|
|
62
|
-
const req = storage.getStore()?.req
|
|
62
|
+
const req = storage('legacy').getStore()?.req
|
|
63
63
|
if (!req) return
|
|
64
64
|
|
|
65
65
|
graphqlRequestData.set(req, {
|
|
@@ -69,13 +69,13 @@ function enterInApolloServerCoreRequest () {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
function exitFromApolloMiddleware (data) {
|
|
72
|
-
const req = data?.req || storage.getStore()?.req
|
|
72
|
+
const req = data?.req || storage('legacy').getStore()?.req
|
|
73
73
|
const requestData = graphqlRequestData.get(req)
|
|
74
74
|
if (requestData) requestData.inApolloMiddleware = false
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
function enterInApolloRequest () {
|
|
78
|
-
const req = storage.getStore()?.req
|
|
78
|
+
const req = storage('legacy').getStore()?.req
|
|
79
79
|
|
|
80
80
|
const requestData = graphqlRequestData.get(req)
|
|
81
81
|
if (requestData?.inApolloMiddleware) {
|
|
@@ -85,7 +85,7 @@ function enterInApolloRequest () {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
function beforeWriteApolloGraphqlResponse ({ abortController, abortData }) {
|
|
88
|
-
const req = storage.getStore()?.req
|
|
88
|
+
const req = storage('legacy').getStore()?.req
|
|
89
89
|
if (!req) return
|
|
90
90
|
|
|
91
91
|
const requestData = graphqlRequestData.get(req)
|
|
@@ -15,7 +15,7 @@ class CodeInjectionAnalyzer extends InjectionAnalyzer {
|
|
|
15
15
|
onConfigure () {
|
|
16
16
|
this.addSub('datadog:eval:call', ({ script }) => {
|
|
17
17
|
if (!this.evalInstrumentedInc) {
|
|
18
|
-
const store = storage.getStore()
|
|
18
|
+
const store = storage('legacy').getStore()
|
|
19
19
|
const iastContext = getIastContext(store)
|
|
20
20
|
const tags = INSTRUMENTED_SINK.formatTags(CODE_INJECTION)
|
|
21
21
|
|
|
@@ -38,7 +38,7 @@ class NosqlInjectionMongodbAnalyzer extends InjectionAnalyzer {
|
|
|
38
38
|
this.configureSanitizers()
|
|
39
39
|
|
|
40
40
|
const onStart = ({ filters }) => {
|
|
41
|
-
const store = storage.getStore()
|
|
41
|
+
const store = storage('legacy').getStore()
|
|
42
42
|
if (store && !store.nosqlAnalyzed && filters?.length) {
|
|
43
43
|
filters.forEach(filter => {
|
|
44
44
|
this.analyze({ filter }, store)
|
|
@@ -51,14 +51,14 @@ class NosqlInjectionMongodbAnalyzer extends InjectionAnalyzer {
|
|
|
51
51
|
const onStartAndEnterWithStore = (message) => {
|
|
52
52
|
const store = onStart(message || {})
|
|
53
53
|
if (store) {
|
|
54
|
-
storage.enterWith({ ...store, nosqlAnalyzed: true, nosqlParentStore: store })
|
|
54
|
+
storage('legacy').enterWith({ ...store, nosqlAnalyzed: true, nosqlParentStore: store })
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const onFinish = () => {
|
|
59
|
-
const store = storage.getStore()
|
|
59
|
+
const store = storage('legacy').getStore()
|
|
60
60
|
if (store?.nosqlParentStore) {
|
|
61
|
-
storage.enterWith(store.nosqlParentStore)
|
|
61
|
+
storage('legacy').enterWith(store.nosqlParentStore)
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -74,7 +74,7 @@ class NosqlInjectionMongodbAnalyzer extends InjectionAnalyzer {
|
|
|
74
74
|
|
|
75
75
|
configureSanitizers () {
|
|
76
76
|
this.addNotSinkSub('datadog:express-mongo-sanitize:filter:finish', ({ sanitizedProperties, req }) => {
|
|
77
|
-
const store = storage.getStore()
|
|
77
|
+
const store = storage('legacy').getStore()
|
|
78
78
|
const iastContext = getIastContext(store)
|
|
79
79
|
|
|
80
80
|
if (iastContext) { // do nothing if we are not in an iast request
|
|
@@ -100,7 +100,7 @@ class NosqlInjectionMongodbAnalyzer extends InjectionAnalyzer {
|
|
|
100
100
|
})
|
|
101
101
|
|
|
102
102
|
this.addNotSinkSub('datadog:express-mongo-sanitize:sanitize:finish', ({ sanitizedObject }) => {
|
|
103
|
-
const store = storage.getStore()
|
|
103
|
+
const store = storage('legacy').getStore()
|
|
104
104
|
const iastContext = getIastContext(store)
|
|
105
105
|
|
|
106
106
|
if (iastContext) { // do nothing if we are not in an iast request
|
|
@@ -29,7 +29,7 @@ class PathTraversalAnalyzer extends InjectionAnalyzer {
|
|
|
29
29
|
|
|
30
30
|
onConfigure () {
|
|
31
31
|
this.addSub('apm:fs:operation:start', (obj) => {
|
|
32
|
-
const store = storage.getStore()
|
|
32
|
+
const store = storage('legacy').getStore()
|
|
33
33
|
const outOfReqOrChild = !store?.fs?.root
|
|
34
34
|
|
|
35
35
|
// we could filter out all the nested fs.operations based on store.fs.root
|
|
@@ -84,7 +84,7 @@ class PathTraversalAnalyzer extends InjectionAnalyzer {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
analyze (value) {
|
|
87
|
-
const iastContext = getIastContext(storage.getStore())
|
|
87
|
+
const iastContext = getIastContext(storage('legacy').getStore())
|
|
88
88
|
if (!iastContext) {
|
|
89
89
|
return
|
|
90
90
|
}
|
|
@@ -38,18 +38,18 @@ class SqlInjectionAnalyzer extends InjectionAnalyzer {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
getStoreAndAnalyze (query, dialect) {
|
|
41
|
-
const parentStore = storage.getStore()
|
|
41
|
+
const parentStore = storage('legacy').getStore()
|
|
42
42
|
if (parentStore) {
|
|
43
43
|
this.analyze(query, parentStore, dialect)
|
|
44
44
|
|
|
45
|
-
storage.enterWith({ ...parentStore, sqlAnalyzed: true, sqlParentStore: parentStore })
|
|
45
|
+
storage('legacy').enterWith({ ...parentStore, sqlAnalyzed: true, sqlParentStore: parentStore })
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
returnToParentStore () {
|
|
50
|
-
const store = storage.getStore()
|
|
50
|
+
const store = storage('legacy').getStore()
|
|
51
51
|
if (store && store.sqlParentStore) {
|
|
52
|
-
storage.enterWith(store.sqlParentStore)
|
|
52
|
+
storage('legacy').enterWith(store.sqlParentStore)
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ class SqlInjectionAnalyzer extends InjectionAnalyzer {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
analyze (value, store, dialect) {
|
|
62
|
-
store = store || storage.getStore()
|
|
62
|
+
store = store || storage('legacy').getStore()
|
|
63
63
|
if (!(store && store.sqlAnalyzed)) {
|
|
64
64
|
super.analyze(value, store, dialect)
|
|
65
65
|
}
|
|
@@ -91,7 +91,7 @@ class Analyzer extends SinkIastPlugin {
|
|
|
91
91
|
return store && !iastContext
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
analyze (value, store = storage.getStore(), meta) {
|
|
94
|
+
analyze (value, store = storage('legacy').getStore(), meta) {
|
|
95
95
|
const iastContext = getIastContext(store)
|
|
96
96
|
if (this._isInvalidContext(store, iastContext)) return
|
|
97
97
|
|
|
@@ -99,7 +99,7 @@ class Analyzer extends SinkIastPlugin {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
analyzeAll (...values) {
|
|
102
|
-
const store = storage.getStore()
|
|
102
|
+
const store = storage('legacy').getStore()
|
|
103
103
|
const iastContext = getIastContext(store)
|
|
104
104
|
if (this._isInvalidContext(store, iastContext)) return
|
|
105
105
|
|
|
@@ -48,7 +48,7 @@ class IastContextPlugin extends IastPlugin {
|
|
|
48
48
|
let isRequestAcquired = false
|
|
49
49
|
let iastContext
|
|
50
50
|
|
|
51
|
-
const store = storage.getStore()
|
|
51
|
+
const store = storage('legacy').getStore()
|
|
52
52
|
if (store) {
|
|
53
53
|
const topContext = this.getTopContext()
|
|
54
54
|
const rootSpan = this.getRootSpan(store)
|
|
@@ -70,7 +70,7 @@ class IastContextPlugin extends IastPlugin {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
finishContext () {
|
|
73
|
-
const store = storage.getStore()
|
|
73
|
+
const store = storage('legacy').getStore()
|
|
74
74
|
if (store) {
|
|
75
75
|
const topContext = this.getTopContext()
|
|
76
76
|
const iastContext = iastContextFunctions.getIastContext(store, topContext)
|
|
@@ -62,12 +62,12 @@ class IastPlugin extends Plugin {
|
|
|
62
62
|
|
|
63
63
|
_getTelemetryHandler (iastSub) {
|
|
64
64
|
return () => {
|
|
65
|
-
const iastContext = getIastContext(storage.getStore())
|
|
65
|
+
const iastContext = getIastContext(storage('legacy').getStore())
|
|
66
66
|
iastSub.increaseExecuted(iastContext)
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
_execHandlerAndIncMetric ({ handler, metric, tags, iastContext = getIastContext(storage.getStore()) }) {
|
|
70
|
+
_execHandlerAndIncMetric ({ handler, metric, tags, iastContext = getIastContext(storage('legacy').getStore()) }) {
|
|
71
71
|
try {
|
|
72
72
|
const result = handler()
|
|
73
73
|
if (iastTelemetry.isEnabled()) {
|
|
@@ -57,7 +57,7 @@ function disable () {
|
|
|
57
57
|
|
|
58
58
|
function onIncomingHttpRequestStart (data) {
|
|
59
59
|
if (data?.req) {
|
|
60
|
-
const store = storage.getStore()
|
|
60
|
+
const store = storage('legacy').getStore()
|
|
61
61
|
if (store) {
|
|
62
62
|
const topContext = web.getContext(data.req)
|
|
63
63
|
if (topContext) {
|
|
@@ -82,7 +82,7 @@ function onIncomingHttpRequestStart (data) {
|
|
|
82
82
|
|
|
83
83
|
function onIncomingHttpRequestEnd (data) {
|
|
84
84
|
if (data?.req) {
|
|
85
|
-
const store = storage.getStore()
|
|
85
|
+
const store = storage('legacy').getStore()
|
|
86
86
|
const topContext = web.getContext(data.req)
|
|
87
87
|
const iastContext = iastContextFunctions.getIastContext(store, topContext)
|
|
88
88
|
if (iastContext?.rootSpan) {
|