dd-trace 5.96.0 → 5.97.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 +34 -0
- package/package.json +9 -7
- package/packages/datadog-esbuild/index.js +20 -9
- package/packages/datadog-instrumentations/src/child_process.js +7 -17
- package/packages/datadog-instrumentations/src/crypto.js +1 -2
- package/packages/datadog-instrumentations/src/cucumber.js +4 -1
- package/packages/datadog-instrumentations/src/cypress-config.js +324 -0
- package/packages/datadog-instrumentations/src/cypress.js +86 -4
- package/packages/datadog-instrumentations/src/dns.js +1 -2
- package/packages/datadog-instrumentations/src/express.js +4 -4
- package/packages/datadog-instrumentations/src/fs.js +27 -29
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +41 -13
- package/packages/datadog-instrumentations/src/helpers/hook.js +31 -6
- package/packages/datadog-instrumentations/src/helpers/hooks.js +12 -19
- package/packages/datadog-instrumentations/src/helpers/instrument.js +27 -13
- package/packages/datadog-instrumentations/src/helpers/register.js +103 -142
- package/packages/datadog-instrumentations/src/http/client.js +2 -3
- package/packages/datadog-instrumentations/src/http/server.js +2 -5
- package/packages/datadog-instrumentations/src/http2/client.js +1 -3
- package/packages/datadog-instrumentations/src/http2/server.js +1 -3
- package/packages/datadog-instrumentations/src/jest.js +13 -4
- package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/utils.js +4 -1
- package/packages/datadog-instrumentations/src/net.js +2 -8
- package/packages/datadog-instrumentations/src/pino.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +4 -1
- package/packages/datadog-instrumentations/src/prisma.js +1 -2
- package/packages/datadog-instrumentations/src/selenium.js +4 -1
- package/packages/datadog-instrumentations/src/sequelize.js +1 -1
- package/packages/datadog-instrumentations/src/url.js +1 -3
- package/packages/datadog-instrumentations/src/vitest.js +5 -1
- package/packages/datadog-instrumentations/src/vm.js +1 -3
- package/packages/datadog-plugin-aws-sdk/src/base.js +4 -3
- package/packages/datadog-plugin-cucumber/src/index.js +7 -3
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +57 -5
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-jest/src/index.js +4 -2
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +31 -4
- package/packages/datadog-plugin-mocha/src/index.js +5 -2
- package/packages/datadog-plugin-next/src/index.js +2 -14
- package/packages/datadog-plugin-openai/src/services.js +1 -0
- package/packages/datadog-webpack/index.js +3 -3
- package/packages/dd-trace/index.js +12 -10
- package/packages/dd-trace/src/agent/url.js +2 -2
- package/packages/dd-trace/src/aiguard/sdk.js +4 -0
- package/packages/dd-trace/src/appsec/blocking.js +3 -0
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +1 -1
- package/packages/dd-trace/src/appsec/remote_config.js +1 -0
- package/packages/dd-trace/src/appsec/sdk/index.js +4 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +6 -1
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +4 -0
- package/packages/dd-trace/src/config/defaults.js +316 -146
- package/packages/dd-trace/src/config/generated-config-types.d.ts +4 -1
- package/packages/dd-trace/src/config/helper.js +59 -10
- package/packages/dd-trace/src/config/index.js +569 -1505
- package/packages/dd-trace/src/config/parsers.js +256 -0
- package/packages/dd-trace/src/config/remote_config.js +59 -2
- package/packages/dd-trace/src/config/supported-configurations.json +350 -433
- package/packages/dd-trace/src/crashtracking/crashtracker.js +7 -1
- package/packages/dd-trace/src/crashtracking/index.js +1 -7
- package/packages/dd-trace/src/debugger/index.js +1 -1
- package/packages/dd-trace/src/dogstatsd.js +12 -9
- package/packages/dd-trace/src/encode/0.4.js +1 -1
- package/packages/dd-trace/src/exporters/agent/writer.js +7 -1
- package/packages/dd-trace/src/exporters/common/request.js +9 -0
- package/packages/dd-trace/src/exporters/common/writer.js +12 -2
- package/packages/dd-trace/src/heap_snapshots.js +3 -0
- package/packages/dd-trace/src/index.js +5 -2
- package/packages/dd-trace/src/lambda/runtime/ritm.js +6 -6
- package/packages/dd-trace/src/llmobs/index.js +4 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +5 -1
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +60 -12
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +4 -2
- package/packages/dd-trace/src/llmobs/sdk.js +12 -8
- package/packages/dd-trace/src/llmobs/span_processor.js +1 -1
- package/packages/dd-trace/src/llmobs/tagger.js +9 -6
- package/packages/dd-trace/src/llmobs/writers/base.js +2 -0
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -0
- package/packages/dd-trace/src/log/index.js +26 -55
- package/packages/dd-trace/src/log/writer.js +7 -19
- package/packages/dd-trace/src/noop/proxy.js +8 -0
- package/packages/dd-trace/src/opentelemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +1 -1
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +9 -4
- package/packages/dd-trace/src/payload-tagging/config/index.js +6 -5
- package/packages/dd-trace/src/plugin_manager.js +8 -6
- package/packages/dd-trace/src/plugins/ci_plugin.js +4 -0
- package/packages/dd-trace/src/plugins/plugin.js +7 -4
- package/packages/dd-trace/src/process-tags/index.js +3 -0
- package/packages/dd-trace/src/profiler.js +27 -2
- package/packages/dd-trace/src/profiling/config.js +73 -241
- package/packages/dd-trace/src/profiling/exporter_cli.js +1 -4
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +6 -2
- package/packages/dd-trace/src/profiling/profiler.js +56 -44
- package/packages/dd-trace/src/profiling/profilers/events.js +2 -3
- package/packages/dd-trace/src/profiling/profilers/wall.js +89 -6
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +4 -1
- package/packages/dd-trace/src/propagation-hash/index.js +2 -1
- package/packages/dd-trace/src/proxy.js +32 -3
- package/packages/dd-trace/src/remote_config/index.js +3 -0
- package/packages/dd-trace/src/require-package-json.js +8 -4
- package/packages/dd-trace/src/ritm.js +58 -26
- package/packages/dd-trace/src/runtime_metrics/index.js +3 -0
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +3 -0
- package/packages/dd-trace/src/sampler.js +1 -1
- package/packages/dd-trace/src/standalone/index.js +3 -0
- package/packages/dd-trace/src/telemetry/index.js +2 -3
- package/packages/dd-trace/src/telemetry/send-data.js +5 -19
- package/packages/dd-trace/src/telemetry/session-propagation.js +19 -44
- package/packages/dd-trace/src/telemetry/telemetry.js +28 -171
- package/packages/dd-trace/src/util.js +0 -9
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// Capture real timers at module load time, before any test can install fake timers.
|
|
4
|
+
const realDateNow = Date.now.bind(Date)
|
|
5
|
+
const realSetTimeout = setTimeout
|
|
6
|
+
|
|
3
7
|
const CiPlugin = require('../../dd-trace/src/plugins/ci_plugin')
|
|
4
8
|
const { storage } = require('../../datadog-core')
|
|
5
9
|
const { getEnvironmentVariable, getValueFromEnvSources } = require('../../dd-trace/src/config/helper')
|
|
@@ -229,7 +233,7 @@ class CucumberPlugin extends CiPlugin {
|
|
|
229
233
|
// Time we give the breakpoint to be hit
|
|
230
234
|
if (promises && this.runningTestProbe) {
|
|
231
235
|
promises.hitBreakpointPromise = new Promise((resolve) => {
|
|
232
|
-
|
|
236
|
+
realSetTimeout(resolve, BREAKPOINT_HIT_GRACE_PERIOD_MS)
|
|
233
237
|
})
|
|
234
238
|
}
|
|
235
239
|
|
|
@@ -252,8 +256,8 @@ class CucumberPlugin extends CiPlugin {
|
|
|
252
256
|
const { file, line, stackIndex } = probeInformation
|
|
253
257
|
this.runningTestProbe = { file, line }
|
|
254
258
|
this.testErrorStackIndex = stackIndex
|
|
255
|
-
const waitUntil =
|
|
256
|
-
while (
|
|
259
|
+
const waitUntil = realDateNow() + BREAKPOINT_SET_GRACE_PERIOD_MS
|
|
260
|
+
while (realDateNow() < waitUntil) {
|
|
257
261
|
// TODO: To avoid a race condition, we should wait until `probeInformation.setProbePromise` has resolved.
|
|
258
262
|
// However, Cucumber doesn't have a mechanism for waiting asyncrounously here, so for now, we'll have to
|
|
259
263
|
// fall back to a fixed syncronous delay.
|
|
@@ -307,10 +307,55 @@ class CypressPlugin {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
/**
|
|
311
|
+
* Resets state that is scoped to a single Cypress run so the singleton plugin
|
|
312
|
+
* can be reused safely across multiple programmatic cypress.run() calls.
|
|
313
|
+
*
|
|
314
|
+
* @returns {void}
|
|
315
|
+
*/
|
|
316
|
+
resetRunState () {
|
|
317
|
+
this._isInit = false
|
|
318
|
+
this.finishedTestsByFile = {}
|
|
319
|
+
this.testStatuses = {}
|
|
320
|
+
this.isTestsSkipped = false
|
|
321
|
+
this.isSuitesSkippingEnabled = false
|
|
322
|
+
this.isCodeCoverageEnabled = false
|
|
323
|
+
this.isFlakyTestRetriesEnabled = false
|
|
324
|
+
this.flakyTestRetriesCount = 0
|
|
325
|
+
this.isEarlyFlakeDetectionEnabled = false
|
|
326
|
+
this.isKnownTestsEnabled = false
|
|
327
|
+
this.earlyFlakeDetectionNumRetries = 0
|
|
328
|
+
this.testsToSkip = []
|
|
329
|
+
this.skippedTests = []
|
|
330
|
+
this.hasForcedToRunSuites = false
|
|
331
|
+
this.hasUnskippableSuites = false
|
|
332
|
+
this.unskippableSuites = []
|
|
333
|
+
this.knownTests = []
|
|
334
|
+
this.knownTestsByTestSuite = undefined
|
|
335
|
+
this.isTestManagementTestsEnabled = false
|
|
336
|
+
this.testManagementAttemptToFixRetries = 0
|
|
337
|
+
this.testManagementTests = undefined
|
|
338
|
+
this.isImpactedTestsEnabled = false
|
|
339
|
+
this.modifiedFiles = []
|
|
340
|
+
this.activeTestSpan = null
|
|
341
|
+
this.testSuiteSpan = null
|
|
342
|
+
this.testModuleSpan = null
|
|
343
|
+
this.testSessionSpan = null
|
|
344
|
+
this.command = undefined
|
|
345
|
+
this.frameworkVersion = undefined
|
|
346
|
+
this.rootDir = undefined
|
|
347
|
+
this.itrCorrelationId = undefined
|
|
348
|
+
this.isTestIsolationEnabled = undefined
|
|
349
|
+
this.rumFlushWaitMillis = undefined
|
|
350
|
+
this._pendingRequestErrorTags = []
|
|
351
|
+
this.libraryConfigurationPromise = undefined
|
|
352
|
+
}
|
|
353
|
+
|
|
310
354
|
// Init function returns a promise that resolves with the Cypress configuration
|
|
311
355
|
// Depending on the received configuration, the Cypress configuration can be modified:
|
|
312
356
|
// for example, to enable retries for failed tests.
|
|
313
357
|
init (tracer, cypressConfig) {
|
|
358
|
+
this.resetRunState()
|
|
314
359
|
this._isInit = true
|
|
315
360
|
this.tracer = tracer
|
|
316
361
|
this.cypressConfig = cypressConfig
|
|
@@ -694,20 +739,27 @@ class CypressPlugin {
|
|
|
694
739
|
}
|
|
695
740
|
|
|
696
741
|
return new Promise(resolve => {
|
|
742
|
+
const finishAfterRun = () => {
|
|
743
|
+
this._isInit = false
|
|
744
|
+
appClosingTelemetry()
|
|
745
|
+
resolve(null)
|
|
746
|
+
}
|
|
747
|
+
|
|
697
748
|
const exporter = this.tracer._tracer._exporter
|
|
698
749
|
if (!exporter) {
|
|
699
|
-
|
|
750
|
+
finishAfterRun()
|
|
751
|
+
return
|
|
700
752
|
}
|
|
701
753
|
if (exporter.flush) {
|
|
702
754
|
exporter.flush(() => {
|
|
703
|
-
|
|
704
|
-
resolve(null)
|
|
755
|
+
finishAfterRun()
|
|
705
756
|
})
|
|
706
757
|
} else if (exporter._writer) {
|
|
707
758
|
exporter._writer.flush(() => {
|
|
708
|
-
|
|
709
|
-
resolve(null)
|
|
759
|
+
finishAfterRun()
|
|
710
760
|
})
|
|
761
|
+
} else {
|
|
762
|
+
finishAfterRun()
|
|
711
763
|
}
|
|
712
764
|
})
|
|
713
765
|
}
|
|
@@ -28,7 +28,7 @@ class GraphQLResolvePlugin extends TracingPlugin {
|
|
|
28
28
|
if (rootCtx.fields[computedPathString]) return
|
|
29
29
|
|
|
30
30
|
if (!rootCtx[collapsedPathSym]) {
|
|
31
|
-
rootCtx[collapsedPathSym] =
|
|
31
|
+
rootCtx[collapsedPathSym] = Object.create(null)
|
|
32
32
|
} else if (rootCtx[collapsedPathSym][computedPathString]) {
|
|
33
33
|
return
|
|
34
34
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// Capture real timers at module load time, before any test can install fake timers.
|
|
4
|
+
const realSetTimeout = setTimeout
|
|
5
|
+
|
|
3
6
|
const CiPlugin = require('../../dd-trace/src/plugins/ci_plugin')
|
|
4
7
|
const { storage } = require('../../datadog-core')
|
|
5
8
|
const { getEnvironmentVariable, getValueFromEnvSources } = require('../../dd-trace/src/config/helper')
|
|
@@ -60,8 +63,7 @@ const CHILD_MESSAGE_END = 2
|
|
|
60
63
|
|
|
61
64
|
function withTimeout (promise, timeoutMs) {
|
|
62
65
|
return new Promise(resolve => {
|
|
63
|
-
|
|
64
|
-
setTimeout(resolve, timeoutMs)
|
|
66
|
+
realSetTimeout(resolve, timeoutMs)
|
|
65
67
|
|
|
66
68
|
// Also resolve if the original promise resolves
|
|
67
69
|
promise.then(resolve)
|
|
@@ -8,20 +8,47 @@ class KafkajsBatchConsumerPlugin extends ConsumerPlugin {
|
|
|
8
8
|
static id = 'kafkajs'
|
|
9
9
|
static operation = 'consume-batch'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
const { topic, messages, groupId, clusterId } = ctx.extractedArgs || ctx
|
|
11
|
+
bindStart (ctx) {
|
|
12
|
+
const { topic, partition, messages, groupId, clusterId } = ctx.extractedArgs || ctx
|
|
13
|
+
|
|
14
|
+
const span = this.startSpan({
|
|
15
|
+
resource: topic,
|
|
16
|
+
type: 'worker',
|
|
17
|
+
meta: {
|
|
18
|
+
component: this.constructor.id,
|
|
19
|
+
'kafka.topic': topic,
|
|
20
|
+
'kafka.cluster_id': clusterId,
|
|
21
|
+
'messaging.destination.name': topic,
|
|
22
|
+
'messaging.system': 'kafka',
|
|
23
|
+
},
|
|
24
|
+
metrics: {
|
|
25
|
+
'kafka.partition': partition,
|
|
26
|
+
'messaging.batch.message_count': messages.length,
|
|
27
|
+
},
|
|
28
|
+
}, ctx)
|
|
13
29
|
|
|
14
|
-
if (!this.config.dsmEnabled) return
|
|
15
30
|
for (const message of messages) {
|
|
16
31
|
if (!message || !message.headers) continue
|
|
32
|
+
|
|
33
|
+
const headers = convertToTextMap(message.headers)
|
|
34
|
+
if (headers) {
|
|
35
|
+
const childOf = this.tracer.extract('text_map', headers)
|
|
36
|
+
if (childOf) {
|
|
37
|
+
span.addLink(childOf)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!this.config.dsmEnabled) continue
|
|
17
42
|
const payloadSize = getMessageSize(message)
|
|
18
|
-
this.tracer.decodeDataStreamsContext(
|
|
43
|
+
this.tracer.decodeDataStreamsContext(headers)
|
|
19
44
|
const edgeTags = ['direction:in', `group:${groupId}`, `topic:${topic}`, 'type:kafka']
|
|
20
45
|
if (clusterId) {
|
|
21
46
|
edgeTags.push(`kafka_cluster_id:${clusterId}`)
|
|
22
47
|
}
|
|
23
48
|
this.tracer.setCheckpoint(edgeTags, null, payloadSize)
|
|
24
49
|
}
|
|
50
|
+
|
|
51
|
+
return ctx.currentStore
|
|
25
52
|
}
|
|
26
53
|
}
|
|
27
54
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// Capture real Date.now at module load time, before any test can install fake timers.
|
|
4
|
+
const realDateNow = Date.now.bind(Date)
|
|
5
|
+
|
|
3
6
|
const CiPlugin = require('../../dd-trace/src/plugins/ci_plugin')
|
|
4
7
|
const { storage } = require('../../datadog-core')
|
|
5
8
|
const { getValueFromEnvSources } = require('../../dd-trace/src/config/helper')
|
|
@@ -323,8 +326,8 @@ class MochaPlugin extends CiPlugin {
|
|
|
323
326
|
this.runningTestProbe = { file, line }
|
|
324
327
|
this.testErrorStackIndex = stackIndex
|
|
325
328
|
test._ddShouldWaitForHitProbe = true
|
|
326
|
-
const waitUntil =
|
|
327
|
-
while (
|
|
329
|
+
const waitUntil = realDateNow() + BREAKPOINT_SET_GRACE_PERIOD_MS
|
|
330
|
+
while (realDateNow() < waitUntil) {
|
|
328
331
|
// TODO: To avoid a race condition, we should wait until `probeInformation.setProbePromise` has resolved.
|
|
329
332
|
// However, Mocha doesn't have a mechanism for waiting asyncrounously here, so for now, we'll have to
|
|
330
333
|
// fall back to a fixed syncronous delay.
|
|
@@ -10,7 +10,6 @@ const errorPages = new Set(['/404', '/500', '/_error', '/_not-found', '/_not-fou
|
|
|
10
10
|
|
|
11
11
|
class NextPlugin extends ServerPlugin {
|
|
12
12
|
static id = 'next'
|
|
13
|
-
#requestsBySpanId = new WeakMap()
|
|
14
13
|
|
|
15
14
|
constructor (...args) {
|
|
16
15
|
super(...args)
|
|
@@ -35,11 +34,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
35
34
|
|
|
36
35
|
analyticsSampler.sample(span, this.config.measured, true)
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
const spanId = span.context()._spanId
|
|
40
|
-
this.#requestsBySpanId.set(spanId, req)
|
|
41
|
-
|
|
42
|
-
return { ...store, span }
|
|
37
|
+
return { ...store, span, req }
|
|
43
38
|
}
|
|
44
39
|
|
|
45
40
|
error ({ span, error }) {
|
|
@@ -90,14 +85,7 @@ class NextPlugin extends ServerPlugin {
|
|
|
90
85
|
|
|
91
86
|
if (!store) return
|
|
92
87
|
|
|
93
|
-
const span = store
|
|
94
|
-
|
|
95
|
-
const spanId = span.context()._spanId
|
|
96
|
-
const parentSpanId = span.context()._parentId
|
|
97
|
-
|
|
98
|
-
// Try current span first, then parent span.
|
|
99
|
-
// This handles cases where pageLoad runs in a child span context
|
|
100
|
-
const req = this.#requestsBySpanId.get(spanId) ?? this.#requestsBySpanId.get(parentSpanId)
|
|
88
|
+
const { span, req } = store
|
|
101
89
|
|
|
102
90
|
// safeguard against missing req in complicated timeout scenarios
|
|
103
91
|
if (!req) return
|
|
@@ -21,12 +21,12 @@ for (const hook of Object.values(hooks)) {
|
|
|
21
21
|
|
|
22
22
|
const modulesOfInterest = new Set()
|
|
23
23
|
|
|
24
|
-
for (const instrumentation of Object.
|
|
24
|
+
for (const [name, instrumentation] of Object.entries(instrumentations)) {
|
|
25
25
|
for (const entry of instrumentation) {
|
|
26
26
|
if (entry.file) {
|
|
27
|
-
modulesOfInterest.add(`${
|
|
27
|
+
modulesOfInterest.add(`${name}/${entry.file}`) // e.g. "redis/my/file.js"
|
|
28
28
|
} else {
|
|
29
|
-
modulesOfInterest.add(
|
|
29
|
+
modulesOfInterest.add(name) // e.g. "redis"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
if (!global._ddtrace) {
|
|
4
|
-
const TracerProxy = require('./src')
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(global, '_ddtrace', {
|
|
7
|
-
value: new TracerProxy(),
|
|
8
|
-
enumerable: false,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true,
|
|
11
|
-
})
|
|
12
|
-
|
|
13
4
|
const ddTraceSymbol = Symbol.for('dd-trace')
|
|
14
5
|
|
|
6
|
+
// Set up beforeExitHandlers before loading the tracer so that modules loaded
|
|
7
|
+
// during require('./src') can register handlers.
|
|
15
8
|
Object.defineProperty(globalThis, ddTraceSymbol, {
|
|
16
9
|
value: {
|
|
17
10
|
beforeExitHandlers: new Set(),
|
|
18
11
|
},
|
|
19
12
|
enumerable: false,
|
|
20
|
-
configurable: true,
|
|
13
|
+
configurable: true,
|
|
21
14
|
writable: false,
|
|
22
15
|
})
|
|
23
16
|
|
|
@@ -29,6 +22,15 @@ if (!global._ddtrace) {
|
|
|
29
22
|
}
|
|
30
23
|
})
|
|
31
24
|
|
|
25
|
+
const TracerProxy = require('./src')
|
|
26
|
+
|
|
27
|
+
Object.defineProperty(global, '_ddtrace', {
|
|
28
|
+
value: new TracerProxy(),
|
|
29
|
+
enumerable: false,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
})
|
|
33
|
+
|
|
32
34
|
global._ddtrace.default = global._ddtrace
|
|
33
35
|
global._ddtrace.tracer = global._ddtrace
|
|
34
36
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { URL, format } = require('url')
|
|
4
|
-
const defaults = require('../config/defaults')
|
|
4
|
+
const { defaults } = require('../config/defaults')
|
|
5
5
|
|
|
6
6
|
module.exports = { getAgentUrl }
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ module.exports = { getAgentUrl }
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Gets the agent URL from config, constructing it from hostname/port if needed
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {Partial<import('../config/config-base')>} config - Tracer configuration object
|
|
16
16
|
* @returns {URL} The agent URL
|
|
17
17
|
*/
|
|
18
18
|
function getAgentUrl (config) {
|
|
@@ -57,6 +57,10 @@ class AIGuard extends NoopAIGuard {
|
|
|
57
57
|
#maxContentSize
|
|
58
58
|
#meta
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @param {import('../tracer')} tracer - Tracer instance
|
|
62
|
+
* @param {import('../config/config-base')} config - Tracer configuration
|
|
63
|
+
*/
|
|
60
64
|
constructor (tracer, config) {
|
|
61
65
|
super()
|
|
62
66
|
|
|
@@ -164,6 +164,9 @@ function getBlockingAction (actions) {
|
|
|
164
164
|
return actions?.redirect_request || actions?.block_request
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
/**
|
|
168
|
+
* @param {import('../config/config-base')} config - Tracer configuration
|
|
169
|
+
*/
|
|
167
170
|
function setTemplates (config) {
|
|
168
171
|
templateHtml = config.appsec.blockedTemplateHtml || blockedTemplates.html
|
|
169
172
|
|
|
@@ -168,7 +168,7 @@ class IastPlugin extends Plugin {
|
|
|
168
168
|
loadChannel.subscribe(this.onInstrumentationLoadedListener)
|
|
169
169
|
|
|
170
170
|
// check for already instrumented modules
|
|
171
|
-
for (const name
|
|
171
|
+
for (const name of Object.keys(instrumentations)) {
|
|
172
172
|
this._onInstrumentationLoaded(name)
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
const log = require('../../../../log')
|
|
5
5
|
const vulnerabilities = require('../../vulnerabilities')
|
|
6
|
-
const defaults = require('../../../../config/defaults')
|
|
6
|
+
const { defaults } = require('../../../../config/defaults')
|
|
7
7
|
|
|
8
8
|
const { contains, intersects, remove } = require('./range-utils')
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const crypto = require('crypto')
|
|
4
4
|
|
|
5
|
-
const defaults = require('../../../config/defaults')
|
|
5
|
+
const { defaults } = require('../../../config/defaults')
|
|
6
6
|
|
|
7
7
|
const STRINGIFY_RANGE_KEY = 'DD_' + crypto.randomBytes(20).toString('hex')
|
|
8
8
|
const STRINGIFY_SENSITIVE_KEY = STRINGIFY_RANGE_KEY + 'SENSITIVE'
|
|
@@ -26,6 +26,10 @@ class EventTrackingV2 {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
class AppsecSdk {
|
|
29
|
+
/**
|
|
30
|
+
* @param {import('../../tracer')} tracer - Tracer instance
|
|
31
|
+
* @param {import('../../config/config-base')} config - Tracer configuration
|
|
32
|
+
*/
|
|
29
33
|
constructor (tracer, config) {
|
|
30
34
|
this._tracer = tracer
|
|
31
35
|
if (config) {
|
|
@@ -11,6 +11,9 @@ const probeIdToResolveBreakpointSet = new Map()
|
|
|
11
11
|
const probeIdToResolveBreakpointRemove = new Map()
|
|
12
12
|
|
|
13
13
|
class TestVisDynamicInstrumentation {
|
|
14
|
+
/**
|
|
15
|
+
* @param {import('../../config/config-base')} config - Tracer configuration
|
|
16
|
+
*/
|
|
14
17
|
constructor (config) {
|
|
15
18
|
this._config = config
|
|
16
19
|
this.worker = null
|
|
@@ -83,7 +86,6 @@ class TestVisDynamicInstrumentation {
|
|
|
83
86
|
DD_TRACE_ENABLED: 'false',
|
|
84
87
|
DD_TEST_FAILED_TEST_REPLAY_ENABLED: 'false',
|
|
85
88
|
DD_CIVISIBILITY_MANUAL_API_ENABLED: 'false',
|
|
86
|
-
DD_TRACING_ENABLED: 'false',
|
|
87
89
|
DD_INSTRUMENTATION_TELEMETRY_ENABLED: 'false',
|
|
88
90
|
},
|
|
89
91
|
workerData: {
|
|
@@ -150,6 +152,9 @@ class TestVisDynamicInstrumentation {
|
|
|
150
152
|
|
|
151
153
|
let dynamicInstrumentation
|
|
152
154
|
|
|
155
|
+
/**
|
|
156
|
+
* @param {import('../../config/config-base')} config - Tracer configuration
|
|
157
|
+
*/
|
|
153
158
|
module.exports = function createAndGetTestVisDynamicInstrumentation (config) {
|
|
154
159
|
if (dynamicInstrumentation) {
|
|
155
160
|
return dynamicInstrumentation
|
|
@@ -54,6 +54,10 @@ class TestApiManualPlugin extends CiPlugin {
|
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* @param {import('../../config/config-base')} config - Tracer configuration
|
|
59
|
+
* @param {boolean} shouldGetEnvironmentData - Whether to get environment data
|
|
60
|
+
*/
|
|
57
61
|
configure (config, shouldGetEnvironmentData) {
|
|
58
62
|
this._config = config
|
|
59
63
|
super.configure(config, shouldGetEnvironmentData)
|