dd-trace 5.79.0 → 5.80.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 +11 -4
- package/initialize.mjs +10 -10
- package/package.json +2 -1
- package/packages/datadog-core/src/storage.js +4 -4
- package/packages/datadog-esbuild/src/utils.js +5 -1
- package/packages/datadog-instrumentations/src/aws-sdk.js +9 -2
- package/packages/datadog-instrumentations/src/azure-service-bus.js +43 -36
- package/packages/datadog-instrumentations/src/helpers/hook.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +2 -1
- package/packages/datadog-instrumentations/src/jest.js +1 -1
- package/packages/datadog-instrumentations/src/playwright.js +20 -0
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +3 -2
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +14 -5
- package/packages/datadog-plugin-jest/src/util.js +3 -2
- package/packages/datadog-plugin-kafkajs/src/consumer.js +2 -1
- package/packages/datadog-plugin-kafkajs/src/producer.js +3 -1
- package/packages/datadog-plugin-openai/src/stream-helpers.js +1 -1
- package/packages/datadog-shimmer/src/shimmer.js +2 -2
- package/packages/dd-trace/src/aiguard/sdk.js +12 -5
- package/packages/dd-trace/src/baggage.js +11 -0
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +1 -1
- package/packages/dd-trace/src/config_defaults.js +1 -0
- package/packages/dd-trace/src/encode/0.4.js +3 -3
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +2 -2
- package/packages/dd-trace/src/exporters/agent/writer.js +6 -13
- package/packages/dd-trace/src/lambda/runtime/ritm.js +1 -2
- package/packages/dd-trace/src/llmobs/index.js +5 -5
- package/packages/dd-trace/src/llmobs/noop.js +6 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +1 -0
- package/packages/dd-trace/src/llmobs/plugins/openai.js +41 -35
- package/packages/dd-trace/src/llmobs/sdk.js +5 -1
- package/packages/dd-trace/src/llmobs/span_processor.js +5 -5
- package/packages/dd-trace/src/llmobs/tagger.js +31 -17
- package/packages/dd-trace/src/msgpack/chunk.js +2 -2
- package/packages/dd-trace/src/msgpack/encoder.js +2 -3
- package/packages/dd-trace/src/msgpack/index.js +2 -2
- package/packages/dd-trace/src/openfeature/flagging_provider.js +5 -3
- package/packages/dd-trace/src/opentelemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +11 -6
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +1 -9
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +1 -1
- package/packages/dd-trace/src/plugins/database.js +1 -0
- package/packages/dd-trace/src/plugins/plugin.js +7 -9
- package/packages/dd-trace/src/profiling/exporter_cli.js +7 -6
- package/packages/dd-trace/src/require-package-json.js +1 -1
- package/packages/dd-trace/src/service-naming/index.js +31 -4
- package/packages/dd-trace/src/span_processor.js +9 -9
- /package/packages/dd-trace/src/{format.js → span_format.js} +0 -0
|
@@ -118,18 +118,16 @@ module.exports = class Plugin {
|
|
|
118
118
|
* @returns {void}
|
|
119
119
|
*/
|
|
120
120
|
addSub (channelName, handler) {
|
|
121
|
-
const plugin = this
|
|
122
121
|
/**
|
|
123
|
-
* @
|
|
124
|
-
* @returns {unknown}
|
|
122
|
+
* @type {typeof handler}
|
|
125
123
|
*/
|
|
126
|
-
const wrappedHandler =
|
|
124
|
+
const wrappedHandler = (...args) => {
|
|
127
125
|
try {
|
|
128
|
-
return handler.apply(this,
|
|
129
|
-
} catch (
|
|
130
|
-
logger.error('Error in plugin handler:',
|
|
131
|
-
logger.info('Disabling plugin: %s',
|
|
132
|
-
|
|
126
|
+
return handler.apply(this, args)
|
|
127
|
+
} catch (error) {
|
|
128
|
+
logger.error('Error in plugin handler:', error)
|
|
129
|
+
logger.info('Disabling plugin: %s', this.constructor.name)
|
|
130
|
+
this.configure(false)
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
this._subscriptions.push(new Subscription(channelName, wrappedHandler))
|
|
@@ -58,12 +58,13 @@ async function exportProfile (urls, tags, profileType, profile) {
|
|
|
58
58
|
}))
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* -
|
|
64
|
-
* -
|
|
65
|
-
* -
|
|
66
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Expected command line arguments are:
|
|
63
|
+
* - Comma separated list of URLs (eg. "http://127.0.0.1:8126/,file:///tmp/foo.pprof")
|
|
64
|
+
* - Tags (eg. "service:nodejs_oom_test,version:1.0.0")
|
|
65
|
+
* - Profiletype (eg. space,wall,cpu)
|
|
66
|
+
* - JSON profile filepath
|
|
67
|
+
*/
|
|
67
68
|
const urls = process.argv[2].split(',').map(s => new URL(s))
|
|
68
69
|
const tags = tagger.parse(process.argv[3])
|
|
69
70
|
const profileType = process.argv[4]
|
|
@@ -12,7 +12,7 @@ const fs = require('fs')
|
|
|
12
12
|
* @typedef { import('module').Module } Module
|
|
13
13
|
* @param {string} name
|
|
14
14
|
* @param {Module} module
|
|
15
|
-
* @
|
|
15
|
+
* @returns {Object} The parsed package.json
|
|
16
16
|
*/
|
|
17
17
|
function requirePackageJson (name, module) {
|
|
18
18
|
if (path.isAbsolute(name)) {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
class SchemaManager {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @type {object}
|
|
6
|
+
*/
|
|
7
|
+
config = {
|
|
8
|
+
spanAttributeSchema: 'v0',
|
|
9
|
+
spanRemoveIntegrationFromService: false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
schemas = {
|
|
13
|
+
v0: require('./schemas/v0'),
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
get schema () {
|
|
@@ -18,10 +25,24 @@ class SchemaManager {
|
|
|
18
25
|
return this.config.spanRemoveIntegrationFromService && this.version === 'v0'
|
|
19
26
|
}
|
|
20
27
|
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} type
|
|
30
|
+
* @param {string} kind
|
|
31
|
+
* @param {string} plugin
|
|
32
|
+
* @param {object} opts
|
|
33
|
+
* @returns {string}
|
|
34
|
+
*/
|
|
21
35
|
opName (type, kind, plugin, opts) {
|
|
22
36
|
return this.schema.getOpName(type, kind, plugin, opts)
|
|
23
37
|
}
|
|
24
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} type
|
|
41
|
+
* @param {string} kind
|
|
42
|
+
* @param {string} plugin
|
|
43
|
+
* @param {object} opts
|
|
44
|
+
* @returns {string}
|
|
45
|
+
*/
|
|
25
46
|
serviceName (type, kind, plugin, opts) {
|
|
26
47
|
const schema = this.shouldUseConsistentServiceNaming
|
|
27
48
|
? this.schemas.v1
|
|
@@ -30,7 +51,13 @@ class SchemaManager {
|
|
|
30
51
|
return schema.getServiceName(type, kind, plugin, { ...opts, tracerService: this.config.service })
|
|
31
52
|
}
|
|
32
53
|
|
|
33
|
-
|
|
54
|
+
/**
|
|
55
|
+
* @param {object} config
|
|
56
|
+
* @param {string} config.spanAttributeSchema
|
|
57
|
+
* @param {boolean} config.spanRemoveIntegrationFromService
|
|
58
|
+
* @param {string} [config.service]
|
|
59
|
+
*/
|
|
60
|
+
configure (config) {
|
|
34
61
|
const { spanAttributeSchema, spanRemoveIntegrationFromService } = config
|
|
35
62
|
|
|
36
63
|
if (!this.schemas.v0 && spanAttributeSchema === 'v0') {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const log = require('./log')
|
|
4
|
-
const
|
|
4
|
+
const spanFormat = require('./span_format')
|
|
5
5
|
const SpanSampler = require('./span_sampler')
|
|
6
6
|
const GitMetadataTagger = require('./git_metadata_tagger')
|
|
7
7
|
const { getEnvironmentVariable } = require('./config-helper')
|
|
@@ -9,9 +9,6 @@ const { getEnvironmentVariable } = require('./config-helper')
|
|
|
9
9
|
const startedSpans = new WeakSet()
|
|
10
10
|
const finishedSpans = new WeakSet()
|
|
11
11
|
|
|
12
|
-
const { channel } = require('dc-polyfill')
|
|
13
|
-
const spanProcessCh = channel('dd-trace:span:process')
|
|
14
|
-
|
|
15
12
|
class SpanProcessor {
|
|
16
13
|
constructor (exporter, prioritySampler, config) {
|
|
17
14
|
this._exporter = exporter
|
|
@@ -29,6 +26,12 @@ class SpanProcessor {
|
|
|
29
26
|
this._gitMetadataTagger = new GitMetadataTagger(config)
|
|
30
27
|
}
|
|
31
28
|
|
|
29
|
+
sample (span) {
|
|
30
|
+
const spanContext = span.context()
|
|
31
|
+
this._prioritySampler.sample(spanContext)
|
|
32
|
+
this._spanSampler.sample(spanContext)
|
|
33
|
+
}
|
|
34
|
+
|
|
32
35
|
process (span) {
|
|
33
36
|
const spanContext = span.context()
|
|
34
37
|
const active = []
|
|
@@ -43,8 +46,7 @@ class SpanProcessor {
|
|
|
43
46
|
return
|
|
44
47
|
}
|
|
45
48
|
if (started.length === finished.length || finished.length >= flushMinSpans) {
|
|
46
|
-
this.
|
|
47
|
-
this._spanSampler.sample(spanContext)
|
|
49
|
+
this.sample(span)
|
|
48
50
|
this._gitMetadataTagger.tagGitMetadata(spanContext)
|
|
49
51
|
|
|
50
52
|
let isChunkRoot = true
|
|
@@ -53,12 +55,10 @@ class SpanProcessor {
|
|
|
53
55
|
if (span._duration === undefined) {
|
|
54
56
|
active.push(span)
|
|
55
57
|
} else {
|
|
56
|
-
const formattedSpan =
|
|
58
|
+
const formattedSpan = spanFormat(span, isChunkRoot)
|
|
57
59
|
isChunkRoot = false
|
|
58
60
|
this._stats?.onSpanFinished(formattedSpan)
|
|
59
61
|
formatted.push(formattedSpan)
|
|
60
|
-
|
|
61
|
-
spanProcessCh.publish({ span })
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
File without changes
|