dd-trace 5.96.0 → 5.98.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 +60 -2
- 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 +69 -4
- package/packages/datadog-instrumentations/src/cypress-config.js +318 -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 +117 -16
- package/packages/datadog-instrumentations/src/limitd-client.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/utils.js +12 -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/redis.js +12 -6
- 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 +5 -4
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +1 -0
- package/packages/datadog-plugin-cucumber/src/index.js +13 -3
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +166 -6
- package/packages/datadog-plugin-cypress/src/index.js +59 -2
- package/packages/datadog-plugin-fs/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +2 -7
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-http/src/client.js +1 -1
- package/packages/datadog-plugin-http/src/server.js +10 -2
- package/packages/datadog-plugin-http2/src/client.js +1 -1
- package/packages/datadog-plugin-http2/src/server.js +10 -2
- 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-mongodb-core/src/index.js +3 -3
- package/packages/datadog-plugin-mysql/src/index.js +1 -1
- package/packages/datadog-plugin-next/src/index.js +10 -16
- package/packages/datadog-plugin-openai/src/services.js +1 -0
- package/packages/datadog-plugin-pg/src/index.js +1 -1
- package/packages/datadog-plugin-tedious/src/index.js +1 -1
- package/packages/datadog-plugin-ws/src/close.js +1 -1
- package/packages/datadog-plugin-ws/src/receiver.js +1 -1
- 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 +26 -22
- package/packages/dd-trace/src/appsec/blocked_templates.js +4 -3
- package/packages/dd-trace/src/appsec/blocking.js +64 -33
- 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/appsec/sdk/set_user.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/track_event.js +5 -5
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/utils.js +4 -2
- 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 +315 -146
- package/packages/dd-trace/src/config/generated-config-types.d.ts +9 -1
- package/packages/dd-trace/src/config/helper.js +59 -10
- package/packages/dd-trace/src/config/index.js +587 -1496
- 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 +406 -432
- package/packages/dd-trace/src/constants.js +1 -0
- 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/devtools_client/snapshot/processor.js +5 -2
- 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 +8 -7
- package/packages/dd-trace/src/encode/span-stats.js +4 -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 +20 -59
- 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/openfeature/remote_config.js +6 -1
- package/packages/dd-trace/src/opentelemetry/context_manager.js +6 -4
- 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/opentelemetry/otlp/otlp_http_exporter_base.js +17 -2
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +14 -2
- package/packages/dd-trace/src/opentelemetry/otlp/trace.proto +358 -0
- package/packages/dd-trace/src/opentelemetry/otlp/trace_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/trace/index.js +75 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +66 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +332 -0
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +9 -4
- package/packages/dd-trace/src/opentracing/tracer.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/log_plugin.js +3 -0
- package/packages/dd-trace/src/plugins/plugin.js +11 -13
- package/packages/dd-trace/src/plugins/storage.js +2 -2
- package/packages/dd-trace/src/plugins/tracing.js +22 -5
- package/packages/dd-trace/src/plugins/util/test.js +2 -0
- package/packages/dd-trace/src/plugins/util/web.js +6 -88
- 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 +78 -109
- 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 +40 -6
- 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 +18 -11
- package/packages/dd-trace/src/sampler.js +1 -1
- package/packages/dd-trace/src/service-naming/index.js +1 -1
- package/packages/dd-trace/src/service-naming/schemas/definition.js +4 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +15 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +24 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +60 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +17 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/websocket.js +5 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +17 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +11 -1
- package/packages/dd-trace/src/service-naming/schemas/v1/websocket.js +6 -0
- package/packages/dd-trace/src/span_stats.js +5 -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/tracer.js +2 -2
- package/packages/dd-trace/src/util.js +0 -9
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +28 -6
- package/vendor/dist/protobufjs/index.js +1 -1
- package/packages/dd-trace/src/log/utils.js +0 -16
|
@@ -18,15 +18,17 @@ const sessionPropagation = require('./session-propagation')
|
|
|
18
18
|
* @typedef {Record<string, unknown>} TelemetryPayloadObject
|
|
19
19
|
*/
|
|
20
20
|
/**
|
|
21
|
-
* @typedef {string | number | boolean | null |
|
|
21
|
+
* @typedef {string | number | boolean | null | URL | Record<string, unknown> | unknown[] | Function} ConfigValue
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {{ [K in keyof processTags]: typeof processTags.tagsObject[K] }} ProcessTags
|
|
22
25
|
*/
|
|
23
26
|
/**
|
|
24
27
|
* @typedef {{
|
|
25
28
|
* name: string,
|
|
26
29
|
* enabled: boolean,
|
|
27
30
|
* auto_enabled: boolean,
|
|
28
|
-
*
|
|
29
|
-
* }} Integration
|
|
31
|
+
* } & Partial<ProcessTags>} Integration
|
|
30
32
|
*/
|
|
31
33
|
/**
|
|
32
34
|
* @typedef {{ _enabled: boolean }} Plugin
|
|
@@ -56,41 +58,11 @@ const sessionPropagation = require('./session-propagation')
|
|
|
56
58
|
* kernel_name?: string
|
|
57
59
|
* }} TelemetryHost
|
|
58
60
|
*/
|
|
59
|
-
/**
|
|
60
|
-
* @typedef {{
|
|
61
|
-
* telemetry: {
|
|
62
|
-
* enabled: boolean,
|
|
63
|
-
* heartbeatInterval: number,
|
|
64
|
-
* debug?: boolean,
|
|
65
|
-
* dependencyCollection?: boolean,
|
|
66
|
-
* logCollection?: boolean
|
|
67
|
-
* },
|
|
68
|
-
* service: string | undefined,
|
|
69
|
-
* env: string | undefined,
|
|
70
|
-
* version: string | undefined,
|
|
71
|
-
* tags: Record<string, string>,
|
|
72
|
-
* url?: string | URL,
|
|
73
|
-
* hostname?: string,
|
|
74
|
-
* port?: string | number,
|
|
75
|
-
* site?: string,
|
|
76
|
-
* apiKey?: string,
|
|
77
|
-
* isCiVisibility?: boolean,
|
|
78
|
-
* spanAttributeSchema?: string,
|
|
79
|
-
* installSignature?: { id?: string, time?: string, type?: string },
|
|
80
|
-
* sca?: { enabled?: boolean },
|
|
81
|
-
* appsec: { enabled: boolean, apiSecurity?: {
|
|
82
|
-
* endpointCollectionEnabled?: boolean,
|
|
83
|
-
* endpointCollectionMessageLimit?: number
|
|
84
|
-
* } },
|
|
85
|
-
* profiling: { enabled: boolean | 'true' | 'false' | 'auto' }
|
|
86
|
-
* }} TelemetryConfig
|
|
87
|
-
*/
|
|
88
61
|
|
|
89
62
|
const telemetryStartChannel = dc.channel('datadog:telemetry:start')
|
|
90
|
-
const telemetryStopChannel = dc.channel('datadog:telemetry:stop')
|
|
91
63
|
const telemetryAppClosingChannel = dc.channel('datadog:telemetry:app-closing')
|
|
92
64
|
|
|
93
|
-
/** @type {
|
|
65
|
+
/** @type {import('../config/config-base') | undefined} */
|
|
94
66
|
let config
|
|
95
67
|
|
|
96
68
|
/** @type {PluginManager} */
|
|
@@ -102,18 +74,9 @@ let application
|
|
|
102
74
|
/** @type {TelemetryHost} */
|
|
103
75
|
const host = createHostObject()
|
|
104
76
|
|
|
105
|
-
/** @type {ReturnType<typeof setInterval> | undefined} */
|
|
106
|
-
let heartbeatInterval
|
|
107
|
-
|
|
108
|
-
/** @type {ReturnType<typeof setInterval> | undefined} */
|
|
109
|
-
let extendedInterval
|
|
110
|
-
|
|
111
77
|
/** @type {Integration[]} */
|
|
112
78
|
let integrations
|
|
113
79
|
|
|
114
|
-
/** @type {Map<string, { name: string, value: ConfigValue, origin: string, seq_id: number }>} */
|
|
115
|
-
const configWithOrigin = new Map()
|
|
116
|
-
|
|
117
80
|
/**
|
|
118
81
|
* Retry information that `telemetry.js` keeps in-memory to be merged into the next payload.
|
|
119
82
|
*
|
|
@@ -130,8 +93,6 @@ let heartbeatFailedDependencies = []
|
|
|
130
93
|
|
|
131
94
|
const sentIntegrations = new Set()
|
|
132
95
|
|
|
133
|
-
let seqId = 0
|
|
134
|
-
|
|
135
96
|
function getRetryData () {
|
|
136
97
|
return retryData
|
|
137
98
|
}
|
|
@@ -184,7 +145,7 @@ function getIntegrations () {
|
|
|
184
145
|
}
|
|
185
146
|
|
|
186
147
|
/**
|
|
187
|
-
* @param {
|
|
148
|
+
* @param {import('../config/config-base')} config
|
|
188
149
|
*/
|
|
189
150
|
function getProducts (config) {
|
|
190
151
|
return {
|
|
@@ -199,7 +160,7 @@ function getProducts (config) {
|
|
|
199
160
|
}
|
|
200
161
|
|
|
201
162
|
/**
|
|
202
|
-
* @param {
|
|
163
|
+
* @param {import('../config/config-base')} config
|
|
203
164
|
*/
|
|
204
165
|
function getInstallSignature (config) {
|
|
205
166
|
const { installSignature: sig } = config
|
|
@@ -212,13 +173,11 @@ function getInstallSignature (config) {
|
|
|
212
173
|
}
|
|
213
174
|
}
|
|
214
175
|
|
|
215
|
-
/**
|
|
216
|
-
* @param {TelemetryConfig} config
|
|
217
|
-
*/
|
|
176
|
+
/** @param {import('../config/config-base')} config */
|
|
218
177
|
function appStarted (config) {
|
|
219
178
|
const app = {
|
|
220
179
|
products: getProducts(config),
|
|
221
|
-
configuration:
|
|
180
|
+
configuration: latestConfiguration,
|
|
222
181
|
}
|
|
223
182
|
const installSignature = getInstallSignature(config)
|
|
224
183
|
if (installSignature) {
|
|
@@ -245,7 +204,7 @@ function appClosing () {
|
|
|
245
204
|
}
|
|
246
205
|
|
|
247
206
|
/**
|
|
248
|
-
* @param {
|
|
207
|
+
* @param {import('../config/config-base')} config
|
|
249
208
|
* @returns {TelemetryApplication}
|
|
250
209
|
*/
|
|
251
210
|
function createAppObject (config) {
|
|
@@ -320,11 +279,11 @@ function createPayload (currReqType, currPayload = {}) {
|
|
|
320
279
|
}
|
|
321
280
|
|
|
322
281
|
/**
|
|
323
|
-
* @param {
|
|
282
|
+
* @param {import('../config/config-base')} config
|
|
324
283
|
* @param {TelemetryApplication} application
|
|
325
284
|
*/
|
|
326
285
|
function heartbeat (config, application) {
|
|
327
|
-
|
|
286
|
+
setInterval(() => {
|
|
328
287
|
metricsManager.send(config, application, host)
|
|
329
288
|
telemetryLogger.send(config, application, host)
|
|
330
289
|
|
|
@@ -333,11 +292,9 @@ function heartbeat (config, application) {
|
|
|
333
292
|
}, config.telemetry.heartbeatInterval).unref()
|
|
334
293
|
}
|
|
335
294
|
|
|
336
|
-
/**
|
|
337
|
-
* @param {TelemetryConfig} config
|
|
338
|
-
*/
|
|
295
|
+
/** @param {import('../config/config-base')} config */
|
|
339
296
|
function extendedHeartbeat (config) {
|
|
340
|
-
|
|
297
|
+
setInterval(() => {
|
|
341
298
|
const appPayload = appStarted(config)
|
|
342
299
|
if (heartbeatFailedIntegrations.length > 0) {
|
|
343
300
|
appPayload.integrations = heartbeatFailedIntegrations
|
|
@@ -348,16 +305,16 @@ function extendedHeartbeat (config) {
|
|
|
348
305
|
heartbeatFailedDependencies = []
|
|
349
306
|
}
|
|
350
307
|
sendData(config, application, host, 'app-extended-heartbeat', appPayload)
|
|
351
|
-
},
|
|
308
|
+
}, config.telemetry.extendedHeartbeatInterval).unref()
|
|
352
309
|
}
|
|
353
310
|
|
|
354
311
|
/**
|
|
355
|
-
* @param {
|
|
312
|
+
* @param {import('../config/config-base')} aConfig
|
|
356
313
|
* @param {PluginManager} thePluginManager
|
|
357
314
|
*/
|
|
358
315
|
function start (aConfig, thePluginManager) {
|
|
359
316
|
if (!aConfig.telemetry.enabled) {
|
|
360
|
-
if (aConfig.sca
|
|
317
|
+
if (aConfig.appsec.sca.enabled) {
|
|
361
318
|
logger.warn('DD_APPSEC_SCA_ENABLED requires enabling telemetry to work.')
|
|
362
319
|
}
|
|
363
320
|
|
|
@@ -376,8 +333,7 @@ function start (aConfig, thePluginManager) {
|
|
|
376
333
|
sendData(config, application, host, 'app-started', appStarted(config))
|
|
377
334
|
|
|
378
335
|
if (integrations.length > 0) {
|
|
379
|
-
sendData(config, application, host, 'app-integrations-change',
|
|
380
|
-
{ integrations }, updateRetryData)
|
|
336
|
+
sendData(config, application, host, 'app-integrations-change', { integrations }, updateRetryData)
|
|
381
337
|
}
|
|
382
338
|
|
|
383
339
|
heartbeat(config, application)
|
|
@@ -388,21 +344,6 @@ function start (aConfig, thePluginManager) {
|
|
|
388
344
|
telemetryStartChannel.publish(getTelemetryData())
|
|
389
345
|
}
|
|
390
346
|
|
|
391
|
-
function stop () {
|
|
392
|
-
if (!config) {
|
|
393
|
-
return
|
|
394
|
-
}
|
|
395
|
-
clearInterval(extendedInterval)
|
|
396
|
-
clearInterval(heartbeatInterval)
|
|
397
|
-
globalThis[Symbol.for('dd-trace')].beforeExitHandlers.delete(appClosing)
|
|
398
|
-
|
|
399
|
-
telemetryStopChannel.publish(getTelemetryData())
|
|
400
|
-
|
|
401
|
-
endpoints.stop()
|
|
402
|
-
sessionPropagation.stop()
|
|
403
|
-
config = undefined
|
|
404
|
-
}
|
|
405
|
-
|
|
406
347
|
function updateIntegrations () {
|
|
407
348
|
if (!config?.telemetry.enabled) {
|
|
408
349
|
return
|
|
@@ -417,121 +358,37 @@ function updateIntegrations () {
|
|
|
417
358
|
sendData(config, application, host, reqType, payload, updateRetryData)
|
|
418
359
|
}
|
|
419
360
|
|
|
420
|
-
|
|
421
|
-
* @param {Record<string, string | number | boolean> | null | undefined} map
|
|
422
|
-
*/
|
|
423
|
-
function formatMapForTelemetry (map) {
|
|
424
|
-
// format from an object to a string map in order for
|
|
425
|
-
// telemetry intake to accept the configuration
|
|
426
|
-
return map
|
|
427
|
-
? Object.entries(map).map(([key, value]) => `${key}:${value}`).join(',')
|
|
428
|
-
: ''
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
const nameMapping = {
|
|
432
|
-
sampleRate: 'DD_TRACE_SAMPLE_RATE',
|
|
433
|
-
logInjection: 'DD_LOG_INJECTION',
|
|
434
|
-
headerTags: 'DD_TRACE_HEADER_TAGS',
|
|
435
|
-
tags: 'DD_TAGS',
|
|
436
|
-
'sampler.rules': 'DD_TRACE_SAMPLING_RULES',
|
|
437
|
-
traceEnabled: 'DD_TRACE_ENABLED',
|
|
438
|
-
url: 'DD_TRACE_AGENT_URL',
|
|
439
|
-
'sampler.rateLimit': 'DD_TRACE_RATE_LIMIT',
|
|
440
|
-
queryStringObfuscation: 'DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP',
|
|
441
|
-
version: 'DD_VERSION',
|
|
442
|
-
env: 'DD_ENV',
|
|
443
|
-
service: 'DD_SERVICE',
|
|
444
|
-
clientIpHeader: 'DD_TRACE_CLIENT_IP_HEADER',
|
|
445
|
-
'grpc.client.error.statuses': 'DD_GRPC_CLIENT_ERROR_STATUSES',
|
|
446
|
-
'grpc.server.error.statuses': 'DD_GRPC_SERVER_ERROR_STATUSES',
|
|
447
|
-
traceId128BitLoggingEnabled: 'DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED',
|
|
448
|
-
instrumentationSource: 'instrumentation_source',
|
|
449
|
-
injectionEnabled: 'ssi_injection_enabled',
|
|
450
|
-
injectForce: 'ssi_forced_injection_enabled',
|
|
451
|
-
'runtimeMetrics.enabled': 'runtimeMetrics',
|
|
452
|
-
otelLogsEnabled: 'DD_LOGS_OTEL_ENABLED',
|
|
453
|
-
otelUrl: 'OTEL_EXPORTER_OTLP_ENDPOINT',
|
|
454
|
-
otelEndpoint: 'OTEL_EXPORTER_OTLP_ENDPOINT',
|
|
455
|
-
otelHeaders: 'OTEL_EXPORTER_OTLP_HEADERS',
|
|
456
|
-
otelProtocol: 'OTEL_EXPORTER_OTLP_PROTOCOL',
|
|
457
|
-
otelTimeout: 'OTEL_EXPORTER_OTLP_TIMEOUT',
|
|
458
|
-
otelLogsHeaders: 'OTEL_EXPORTER_OTLP_LOGS_HEADERS',
|
|
459
|
-
otelLogsProtocol: 'OTEL_EXPORTER_OTLP_LOGS_PROTOCOL',
|
|
460
|
-
otelLogsTimeout: 'OTEL_EXPORTER_OTLP_LOGS_TIMEOUT',
|
|
461
|
-
otelLogsUrl: 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT',
|
|
462
|
-
otelBatchTimeout: 'OTEL_BSP_SCHEDULE_DELAY',
|
|
463
|
-
otelMaxExportBatchSize: 'OTEL_BSP_MAX_EXPORT_BATCH_SIZE',
|
|
464
|
-
otelMaxQueueSize: 'OTEL_BSP_MAX_QUEUE_SIZE',
|
|
465
|
-
otelMetricsEnabled: 'DD_METRICS_OTEL_ENABLED',
|
|
466
|
-
otelMetricsHeaders: 'OTEL_EXPORTER_OTLP_METRICS_HEADERS',
|
|
467
|
-
otelMetricsProtocol: 'OTEL_EXPORTER_OTLP_METRICS_PROTOCOL',
|
|
468
|
-
otelMetricsTimeout: 'OTEL_EXPORTER_OTLP_METRICS_TIMEOUT',
|
|
469
|
-
otelMetricsExportTimeout: 'OTEL_METRIC_EXPORT_TIMEOUT',
|
|
470
|
-
otelMetricsUrl: 'OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
|
|
471
|
-
otelMetricsExportInterval: 'OTEL_METRIC_EXPORT_INTERVAL',
|
|
472
|
-
otelMetricsTemporalityPreference: 'OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE',
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
const namesNeedFormatting = new Set(['DD_TAGS', 'peerServiceMapping', 'serviceMapping'])
|
|
361
|
+
let latestConfiguration = []
|
|
476
362
|
|
|
477
363
|
/**
|
|
478
|
-
* @param {{ name: string, value: ConfigValue, origin: string }[]}
|
|
479
|
-
* @param {
|
|
364
|
+
* @param {{ name: string, value: ConfigValue, origin: string, seq_id: number }[]} configuration
|
|
365
|
+
* @param {import('../config/config-base')} config
|
|
480
366
|
*/
|
|
481
|
-
function updateConfig (
|
|
367
|
+
function updateConfig (configuration, config) {
|
|
482
368
|
if (!config.telemetry.enabled) return
|
|
483
|
-
if (changes.length === 0) return
|
|
484
369
|
|
|
485
|
-
logger.trace(
|
|
370
|
+
logger.trace(configuration)
|
|
486
371
|
|
|
487
372
|
const application = createAppObject(config)
|
|
488
373
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
for (const change of changes) {
|
|
492
|
-
const name = nameMapping[change.name] || change.name
|
|
493
|
-
const { origin, value } = change
|
|
494
|
-
const entry = { name, value, origin, seq_id: seqId++ }
|
|
495
|
-
|
|
496
|
-
if (namesNeedFormatting.has(name)) {
|
|
497
|
-
// @ts-expect-error entry.value is known to be a map for these config names
|
|
498
|
-
entry.value = formatMapForTelemetry(value)
|
|
499
|
-
} else if (name === 'url') {
|
|
500
|
-
if (value) {
|
|
501
|
-
entry.value = value.toString()
|
|
502
|
-
}
|
|
503
|
-
} else if (name === 'DD_TRACE_SAMPLING_RULES') {
|
|
504
|
-
entry.value = JSON.stringify(value)
|
|
505
|
-
} else if (Array.isArray(value)) {
|
|
506
|
-
entry.value = value.join(',')
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
// Use composite key to support multiple origins for same config name
|
|
510
|
-
configWithOrigin.set(`${name}|${origin}`, entry)
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
if (changed) {
|
|
514
|
-
// update configWithOrigin to contain up-to-date full list of config values for app-extended-heartbeat
|
|
374
|
+
if (latestConfiguration.length) {
|
|
515
375
|
const { reqType, payload } = createPayload('app-client-configuration-change', {
|
|
516
|
-
configuration
|
|
376
|
+
configuration,
|
|
517
377
|
})
|
|
518
378
|
sendData(config, application, host, reqType, payload, updateRetryData)
|
|
519
379
|
}
|
|
380
|
+
latestConfiguration = configuration
|
|
520
381
|
}
|
|
521
382
|
|
|
522
383
|
/**
|
|
523
|
-
* @param {
|
|
384
|
+
* @param {import('../config/config-base')['profiling']['enabled']} profilingEnabled
|
|
524
385
|
*/
|
|
525
386
|
function profilingEnabledToBoolean (profilingEnabled) {
|
|
526
|
-
if (typeof profilingEnabled === 'boolean') {
|
|
527
|
-
return profilingEnabled
|
|
528
|
-
}
|
|
529
387
|
return profilingEnabled === 'true' || profilingEnabled === 'auto'
|
|
530
388
|
}
|
|
531
389
|
|
|
532
390
|
module.exports = {
|
|
533
391
|
start,
|
|
534
|
-
stop,
|
|
535
392
|
updateIntegrations,
|
|
536
393
|
updateConfig,
|
|
537
394
|
appClosing,
|
|
@@ -17,8 +17,8 @@ const SERVICE_NAME = tags.SERVICE_NAME
|
|
|
17
17
|
const MEASURED = tags.MEASURED
|
|
18
18
|
|
|
19
19
|
class DatadogTracer extends Tracer {
|
|
20
|
-
constructor (config, prioritySampler) {
|
|
21
|
-
super(config, prioritySampler)
|
|
20
|
+
constructor (config, prioritySampler, exporter) {
|
|
21
|
+
super(config, prioritySampler, exporter)
|
|
22
22
|
this._dataStreamsProcessor = new DataStreamsProcessor(config)
|
|
23
23
|
this._dataStreamsManager = new DataStreamsManager(this._dataStreamsProcessor)
|
|
24
24
|
this.dataStreamsCheckpointer = new DataStreamsCheckpointer(this)
|
|
@@ -67,14 +67,6 @@ function calculateDDBasePath (dirname) {
|
|
|
67
67
|
return dirSteps.slice(0, packagesIndex).join(path.sep) + path.sep
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
function normalizeProfilingEnabledValue (configValue) {
|
|
71
|
-
return isTrue(configValue)
|
|
72
|
-
? 'true'
|
|
73
|
-
: isFalse(configValue)
|
|
74
|
-
? 'false'
|
|
75
|
-
: configValue === 'auto' ? 'auto' : undefined
|
|
76
|
-
}
|
|
77
|
-
|
|
78
70
|
function normalizePluginEnvName (envPluginName, makeLowercase = false) {
|
|
79
71
|
if (envPluginName.startsWith('@')) {
|
|
80
72
|
envPluginName = envPluginName.slice(1)
|
|
@@ -89,6 +81,5 @@ module.exports = {
|
|
|
89
81
|
isError,
|
|
90
82
|
globMatch,
|
|
91
83
|
ddBasePath: globalThis.__DD_ESBUILD_BASEPATH || calculateDDBasePath(__dirname),
|
|
92
|
-
normalizeProfilingEnabledValue,
|
|
93
84
|
normalizePluginEnvName,
|
|
94
85
|
}
|