dd-trace 5.83.0 → 5.84.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 +0 -1
- package/index.d.ts +61 -1
- package/package.json +3 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +6 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +73 -16
- package/packages/datadog-instrumentations/src/jest.js +89 -50
- package/packages/datadog-instrumentations/src/playwright.js +12 -8
- package/packages/datadog-plugin-cucumber/src/index.js +33 -32
- package/packages/datadog-plugin-playwright/src/index.js +23 -23
- package/packages/datadog-shimmer/src/shimmer.js +2 -5
- package/packages/dd-trace/src/agent/info.js +57 -0
- package/packages/dd-trace/src/agent/url.js +28 -0
- package/packages/dd-trace/src/appsec/index.js +47 -7
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +3 -4
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +3 -3
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +2 -9
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -2
- package/packages/dd-trace/src/config/index.js +15 -1
- package/packages/dd-trace/src/config/remote_config.js +1 -0
- package/packages/dd-trace/src/config/supported-configurations.json +1 -1
- package/packages/dd-trace/src/crashtracking/crashtracker.js +2 -5
- package/packages/dd-trace/src/datastreams/writer.js +2 -8
- package/packages/dd-trace/src/debugger/devtools_client/config.js +2 -7
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +10 -11
- package/packages/dd-trace/src/dogstatsd.js +3 -9
- package/packages/dd-trace/src/exporters/agent/index.js +4 -8
- package/packages/dd-trace/src/exporters/agent/writer.js +3 -2
- package/packages/dd-trace/src/exporters/common/{agent-info-exporter.js → buffering-exporter.js} +10 -37
- package/packages/dd-trace/src/exporters/span-stats/index.js +3 -10
- package/packages/dd-trace/src/llmobs/writers/base.js +2 -8
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -9
- package/packages/dd-trace/src/log/index.js +45 -30
- package/packages/dd-trace/src/log/writer.js +13 -78
- package/packages/dd-trace/src/openfeature/writers/base.js +2 -8
- package/packages/dd-trace/src/openfeature/writers/util.js +3 -8
- package/packages/dd-trace/src/profiling/config.js +3 -6
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -0
- package/packages/dd-trace/src/remote_config/index.js +2 -7
- package/packages/dd-trace/src/startup-log.js +2 -2
- package/vendor/dist/@isaacs/ttlcache/index.js +1 -1
- package/vendor/dist/esquery/index.js +1 -1
- package/vendor/dist/meriyah/index.js +1 -1
- package/vendor/dist/protobufjs/index.js +1 -1
package/packages/dd-trace/src/exporters/common/{agent-info-exporter.js → buffering-exporter.js}
RENAMED
|
@@ -1,47 +1,20 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { URL, format } = require('url')
|
|
4
|
-
|
|
5
|
-
const defaults = require('../../config/defaults')
|
|
6
3
|
const { incrementCountMetric, TELEMETRY_EVENTS_ENQUEUED_FOR_SERIALIZATION } = require('../../ci-visibility/telemetry')
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
function fetchAgentInfo (url, callback) {
|
|
10
|
-
request('', {
|
|
11
|
-
path: '/info',
|
|
12
|
-
url
|
|
13
|
-
}, (err, res) => {
|
|
14
|
-
if (err) {
|
|
15
|
-
return callback(err)
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const response = JSON.parse(res)
|
|
19
|
-
return callback(null, response)
|
|
20
|
-
} catch (e) {
|
|
21
|
-
return callback(e)
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
}
|
|
4
|
+
const { getAgentUrl } = require('../../agent/url')
|
|
25
5
|
|
|
26
6
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
7
|
+
* Base exporter that buffers traces until a writer is initialized.
|
|
8
|
+
* Provides common export logic with flush intervals.
|
|
29
9
|
*/
|
|
30
|
-
class
|
|
10
|
+
class BufferingExporter {
|
|
11
|
+
_traceBuffer = []
|
|
12
|
+
_isInitialized = false
|
|
13
|
+
_writer
|
|
14
|
+
|
|
31
15
|
constructor (tracerConfig) {
|
|
32
16
|
this._config = tracerConfig
|
|
33
|
-
|
|
34
|
-
this._url = url || new URL(format({
|
|
35
|
-
protocol: 'http:',
|
|
36
|
-
hostname,
|
|
37
|
-
port
|
|
38
|
-
}))
|
|
39
|
-
this._traceBuffer = []
|
|
40
|
-
this._isInitialized = false
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
getAgentInfo (onReceivedInfo) {
|
|
44
|
-
fetchAgentInfo(this._url, onReceivedInfo)
|
|
17
|
+
this._url = getAgentUrl(tracerConfig)
|
|
45
18
|
}
|
|
46
19
|
|
|
47
20
|
export (trace) {
|
|
@@ -86,4 +59,4 @@ class AgentInfoExporter {
|
|
|
86
59
|
}
|
|
87
60
|
}
|
|
88
61
|
|
|
89
|
-
module.exports =
|
|
62
|
+
module.exports = BufferingExporter
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
const defaults = require('../../config/defaults')
|
|
3
|
+
const { getAgentUrl } = require('../../agent/url')
|
|
6
4
|
const { Writer } = require('./writer')
|
|
7
5
|
|
|
8
6
|
class SpanStatsExporter {
|
|
9
7
|
constructor (config) {
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
protocol: 'http:',
|
|
13
|
-
hostname,
|
|
14
|
-
port
|
|
15
|
-
}))
|
|
16
|
-
this._writer = new Writer({ url: this._url, tags })
|
|
8
|
+
this._url = getAgentUrl(config)
|
|
9
|
+
this._writer = new Writer({ url: this._url })
|
|
17
10
|
}
|
|
18
11
|
|
|
19
12
|
export (payload) {
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
EVP_SUBDOMAIN_HEADER_NAME,
|
|
15
15
|
EVP_PROXY_AGENT_BASE_PATH
|
|
16
16
|
} = require('../constants/writers')
|
|
17
|
+
const { getAgentUrl } = require('../../agent/url')
|
|
17
18
|
const { parseResponseAndLog } = require('./util')
|
|
18
19
|
|
|
19
20
|
class LLMObsBuffer {
|
|
@@ -198,16 +199,9 @@ class BaseLLMObsWriter {
|
|
|
198
199
|
}
|
|
199
200
|
}
|
|
200
201
|
|
|
201
|
-
const { hostname, port } = this._config
|
|
202
|
-
|
|
203
202
|
const overrideOriginEnv = getEnvironmentVariable('_DD_LLMOBS_OVERRIDE_ORIGIN')
|
|
204
203
|
const overrideOriginUrl = overrideOriginEnv && new URL(overrideOriginEnv)
|
|
205
|
-
|
|
206
|
-
const base = overrideOriginUrl ?? this._config.url ?? new URL(format({
|
|
207
|
-
protocol: 'http:',
|
|
208
|
-
hostname,
|
|
209
|
-
port
|
|
210
|
-
}))
|
|
204
|
+
const base = overrideOriginUrl ?? getAgentUrl(this._config)
|
|
211
205
|
|
|
212
206
|
return {
|
|
213
207
|
url: base,
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
const logger = require('../../log')
|
|
4
4
|
const { EVP_PROXY_AGENT_BASE_PATH } = require('../constants/writers')
|
|
5
5
|
const telemetry = require('../telemetry')
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
/** @type {AgentInfoExporter} */
|
|
9
|
-
let agentInfoExporter
|
|
6
|
+
const { fetchAgentInfo } = require('../../agent/info')
|
|
7
|
+
const { getAgentUrl } = require('../../agent/url')
|
|
10
8
|
|
|
11
9
|
function setAgentStrategy (config, setWritersAgentlessValue) {
|
|
12
10
|
const agentlessEnabled = config.llmobs.agentlessEnabled
|
|
@@ -16,11 +14,7 @@ function setAgentStrategy (config, setWritersAgentlessValue) {
|
|
|
16
14
|
return
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
agentInfoExporter = new AgentInfoExporter(config)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
agentInfoExporter.getAgentInfo((err, agentInfo) => {
|
|
17
|
+
fetchAgentInfo(getAgentUrl(config), (err, agentInfo) => {
|
|
24
18
|
if (err) {
|
|
25
19
|
setWritersAgentlessValue(true)
|
|
26
20
|
return
|
|
@@ -31,31 +31,31 @@ const log = {
|
|
|
31
31
|
use (logger) {
|
|
32
32
|
config.logger = logger
|
|
33
33
|
logWriter.use(logger)
|
|
34
|
-
return
|
|
34
|
+
return log
|
|
35
35
|
},
|
|
36
36
|
|
|
37
37
|
toggle (enabled, logLevel) {
|
|
38
38
|
config.enabled = enabled
|
|
39
39
|
config.logLevel = logLevel
|
|
40
40
|
logWriter.toggle(enabled, logLevel)
|
|
41
|
-
return
|
|
41
|
+
return log
|
|
42
42
|
},
|
|
43
43
|
|
|
44
44
|
reset () {
|
|
45
45
|
logWriter.reset()
|
|
46
|
-
|
|
47
|
-
errorChannel
|
|
46
|
+
log._deprecate = memoize((code, message) => {
|
|
47
|
+
publishFormatted(errorChannel, null, message)
|
|
48
48
|
return true
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
return
|
|
51
|
+
return log
|
|
52
52
|
},
|
|
53
53
|
|
|
54
54
|
trace (...args) {
|
|
55
55
|
if (traceChannel.hasSubscribers) {
|
|
56
56
|
const logRecord = {}
|
|
57
57
|
|
|
58
|
-
Error.captureStackTrace(logRecord,
|
|
58
|
+
Error.captureStackTrace(logRecord, log.trace)
|
|
59
59
|
|
|
60
60
|
const stack = logRecord.stack.split('\n')
|
|
61
61
|
const fn = stack[1].replace(/^\s+at ([^\s]+) .+/, '$1')
|
|
@@ -64,49 +64,46 @@ const log = {
|
|
|
64
64
|
|
|
65
65
|
stack[0] = `Trace: ${fn}(${params})`
|
|
66
66
|
|
|
67
|
-
traceChannel
|
|
67
|
+
publishFormatted(traceChannel, null, stack.join('\n'))
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return log
|
|
70
70
|
},
|
|
71
71
|
|
|
72
72
|
debug (...args) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
return this
|
|
73
|
+
publishFormatted(debugChannel, null, ...args)
|
|
74
|
+
return log
|
|
77
75
|
},
|
|
78
76
|
|
|
79
77
|
info (...args) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
return this
|
|
78
|
+
publishFormatted(infoChannel, null, ...args)
|
|
79
|
+
return log
|
|
84
80
|
},
|
|
85
81
|
|
|
86
82
|
warn (...args) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
return this
|
|
83
|
+
publishFormatted(warnChannel, null, ...args)
|
|
84
|
+
return log
|
|
91
85
|
},
|
|
92
86
|
|
|
93
87
|
error (...args) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
publishFormatted(errorChannel, formatted => {
|
|
89
|
+
const stackTraceLimitBackup = Error.stackTraceLimit
|
|
90
|
+
Error.stackTraceLimit = 0
|
|
91
|
+
const newError = new Error(formatted)
|
|
92
|
+
Error.stackTraceLimit = stackTraceLimitBackup
|
|
93
|
+
Error.captureStackTrace(newError, log.error)
|
|
94
|
+
return newError
|
|
95
|
+
}, ...args)
|
|
96
|
+
return log
|
|
98
97
|
},
|
|
99
98
|
|
|
100
99
|
errorWithoutTelemetry (...args) {
|
|
101
100
|
args.push(NO_TRANSMIT)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
return this
|
|
101
|
+
publishFormatted(errorChannel, null, ...args)
|
|
102
|
+
return log
|
|
106
103
|
},
|
|
107
104
|
|
|
108
105
|
deprecate (code, message) {
|
|
109
|
-
return
|
|
106
|
+
return log._deprecate(code, message)
|
|
110
107
|
},
|
|
111
108
|
|
|
112
109
|
isEnabled (fleetStableConfigValue, localStableConfigValue) {
|
|
@@ -133,7 +130,25 @@ const log = {
|
|
|
133
130
|
}
|
|
134
131
|
}
|
|
135
132
|
|
|
136
|
-
|
|
133
|
+
function publishFormatted (ch, formatter, ...args) {
|
|
134
|
+
if (ch.hasSubscribers) {
|
|
135
|
+
const log = Log.parse(...args)
|
|
136
|
+
const { formatted, cause } = getErrorLog(log)
|
|
137
|
+
|
|
138
|
+
// calling twice ch.publish() because Error cause is only available in Node.js v16.9.0
|
|
139
|
+
// TODO: replace it with Error(message, { cause }) when cause has broad support
|
|
140
|
+
if (formatted) ch.publish(formatter?.(formatted) || formatted)
|
|
141
|
+
if (cause) ch.publish(cause)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function getErrorLog (err) {
|
|
146
|
+
if (typeof err?.delegate === 'function') {
|
|
147
|
+
const result = err.delegate()
|
|
148
|
+
return Array.isArray(result) ? Log.parse(...result) : Log.parse(result)
|
|
149
|
+
}
|
|
150
|
+
return err
|
|
151
|
+
}
|
|
137
152
|
|
|
138
153
|
log.reset()
|
|
139
154
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const { storage } = require('../../../datadog-core')
|
|
4
4
|
const { LogChannel } = require('./channels')
|
|
5
|
-
const { Log } = require('./log')
|
|
6
5
|
const defaultLogger = {
|
|
7
6
|
debug: msg => console.debug(msg), /* eslint-disable-line no-console */
|
|
8
7
|
info: msg => console.info(msg), /* eslint-disable-line no-console */
|
|
@@ -13,7 +12,6 @@ const defaultLogger = {
|
|
|
13
12
|
let enabled = false
|
|
14
13
|
let logger = defaultLogger
|
|
15
14
|
let logChannel = new LogChannel()
|
|
16
|
-
let stackTraceLimitFunction = onError
|
|
17
15
|
|
|
18
16
|
function withNoop (fn) {
|
|
19
17
|
const store = storage('legacy').getStore()
|
|
@@ -24,7 +22,7 @@ function withNoop (fn) {
|
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
function unsubscribeAll () {
|
|
27
|
-
logChannel.unsubscribe({ trace
|
|
25
|
+
logChannel.unsubscribe({ trace, debug, info, warn, error })
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
function toggleSubscription (enable, level) {
|
|
@@ -32,7 +30,7 @@ function toggleSubscription (enable, level) {
|
|
|
32
30
|
|
|
33
31
|
if (enable) {
|
|
34
32
|
logChannel = new LogChannel(level)
|
|
35
|
-
logChannel.subscribe({ trace
|
|
33
|
+
logChannel.subscribe({ trace, debug, info, warn, error })
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
|
|
@@ -53,89 +51,26 @@ function reset () {
|
|
|
53
51
|
toggleSubscription(false)
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
const result = err.delegate()
|
|
59
|
-
return Array.isArray(result) ? Log.parse(...result) : Log.parse(result)
|
|
60
|
-
}
|
|
61
|
-
return err
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function setStackTraceLimitFunction (fn) {
|
|
65
|
-
if (typeof fn !== 'function') {
|
|
66
|
-
throw new TypeError('stackTraceLimitFunction must be a function')
|
|
67
|
-
}
|
|
68
|
-
stackTraceLimitFunction = fn
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function onError (err) {
|
|
72
|
-
const { formatted, cause } = getErrorLog(err)
|
|
73
|
-
|
|
74
|
-
// calling twice logger.error() because Error cause is only available in Node.js v16.9.0
|
|
75
|
-
// TODO: replace it with Error(message, { cause }) when cause has broad support
|
|
76
|
-
if (formatted) {
|
|
77
|
-
withNoop(() => {
|
|
78
|
-
const stackTraceLimitBackup = Error.stackTraceLimit
|
|
79
|
-
Error.stackTraceLimit = 0
|
|
80
|
-
const newError = new Error(formatted)
|
|
81
|
-
Error.stackTraceLimit = stackTraceLimitBackup
|
|
82
|
-
Error.captureStackTrace(newError, stackTraceLimitFunction)
|
|
83
|
-
logger.error(newError)
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
if (cause) withNoop(() => logger.error(cause))
|
|
54
|
+
function error (err) {
|
|
55
|
+
withNoop(() => logger.error(err))
|
|
87
56
|
}
|
|
88
57
|
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
if (formatted) withNoop(() => logger.warn(formatted))
|
|
92
|
-
if (cause) withNoop(() => logger.warn(cause))
|
|
58
|
+
function warn (log) {
|
|
59
|
+
withNoop(() => logger.warn ? logger.warn(log) : logger.debug(log))
|
|
93
60
|
}
|
|
94
61
|
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
if (formatted) withNoop(() => logger.info(formatted))
|
|
98
|
-
if (cause) withNoop(() => logger.info(cause))
|
|
62
|
+
function info (log) {
|
|
63
|
+
withNoop(() => logger.info ? logger.info(log) : logger.debug(log))
|
|
99
64
|
}
|
|
100
65
|
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
if (formatted) withNoop(() => logger.debug(formatted))
|
|
104
|
-
if (cause) withNoop(() => logger.debug(cause))
|
|
66
|
+
function debug (log) {
|
|
67
|
+
withNoop(() => logger.debug(log))
|
|
105
68
|
}
|
|
106
69
|
|
|
107
|
-
function
|
|
108
|
-
const { formatted, cause } = getErrorLog(log)
|
|
70
|
+
function trace (log) {
|
|
109
71
|
// Using logger.debug() because not all loggers have trace level,
|
|
110
72
|
// and console.trace() has a completely different meaning.
|
|
111
|
-
|
|
112
|
-
if (cause) withNoop(() => logger.debug(cause))
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function error (...args) {
|
|
116
|
-
onError(Log.parse(...args))
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function warn (...args) {
|
|
120
|
-
const log = Log.parse(...args)
|
|
121
|
-
if (!logger.warn) return onDebug(log)
|
|
122
|
-
|
|
123
|
-
onWarn(log)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function info (...args) {
|
|
127
|
-
const log = Log.parse(...args)
|
|
128
|
-
if (!logger.info) return onDebug(log)
|
|
129
|
-
|
|
130
|
-
onInfo(log)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function debug (...args) {
|
|
134
|
-
onDebug(Log.parse(...args))
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function trace (...args) {
|
|
138
|
-
onTrace(Log.parse(...args))
|
|
73
|
+
withNoop(() => logger.debug(log))
|
|
139
74
|
}
|
|
140
75
|
|
|
141
|
-
module.exports = { use, toggle, reset, error, warn, info, debug, trace
|
|
76
|
+
module.exports = { use, toggle, reset, error, warn, info, debug, trace }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { URL, format } = require('node:url')
|
|
4
3
|
const request = require('../../exporters/common/request')
|
|
5
4
|
const { safeJSONStringify } = require('../../exporters/common/util')
|
|
5
|
+
const { getAgentUrl } = require('../../agent/url')
|
|
6
6
|
|
|
7
7
|
const log = require('../../log')
|
|
8
8
|
|
|
@@ -158,13 +158,7 @@ class BaseFFEWriter {
|
|
|
158
158
|
* @returns {URL} Constructs agent URL from config
|
|
159
159
|
*/
|
|
160
160
|
_getAgentUrl () {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return this._config.url ?? new URL(format({
|
|
164
|
-
protocol: 'http:',
|
|
165
|
-
hostname: hostname || 'localhost',
|
|
166
|
-
port: port || 8126
|
|
167
|
-
}))
|
|
161
|
+
return getAgentUrl(this._config)
|
|
168
162
|
}
|
|
169
163
|
|
|
170
164
|
/**
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const logger = require('../../log')
|
|
4
4
|
const { EVP_PROXY_AGENT_BASE_PATH } = require('../constants/constants')
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
let agentInfoExporter
|
|
5
|
+
const { fetchAgentInfo } = require('../../agent/info')
|
|
6
|
+
const { getAgentUrl } = require('../../agent/url')
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Determines if the agent supports EVP proxy and sets the writer enabled state accordingly
|
|
@@ -12,11 +11,7 @@ let agentInfoExporter
|
|
|
12
11
|
* @param {Function} setWriterEnabledValue - Callback to set the writer enabled state
|
|
13
12
|
*/
|
|
14
13
|
function setAgentStrategy (config, setWriterEnabledValue) {
|
|
15
|
-
|
|
16
|
-
agentInfoExporter = new AgentInfoExporter(config)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
agentInfoExporter.getAgentInfo((err, agentInfo) => {
|
|
14
|
+
fetchAgentInfo(getAgentUrl(config), (err, agentInfo) => {
|
|
20
15
|
if (err) {
|
|
21
16
|
logger.debug('FFE Writer disabled - error getting agent info:', err.message)
|
|
22
17
|
setWriterEnabledValue(false)
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const os = require('os')
|
|
4
4
|
const path = require('path')
|
|
5
|
-
const {
|
|
5
|
+
const { pathToFileURL } = require('url')
|
|
6
6
|
const satisfies = require('../../../../vendor/dist/semifies')
|
|
7
7
|
const { GIT_REPOSITORY_URL, GIT_COMMIT_SHA } = require('../plugins/util/tags')
|
|
8
8
|
const { getIsAzureFunction } = require('../serverless')
|
|
9
9
|
const { isFalse, isTrue } = require('../util')
|
|
10
10
|
const { getAzureTagsFromMetadata, getAzureAppMetadata, getAzureFunctionMetadata } = require('../azure_metadata')
|
|
11
11
|
const { getEnvironmentVariable, getValueFromEnvSources } = require('../config/helper')
|
|
12
|
+
const { getAgentUrl } = require('../agent/url')
|
|
12
13
|
const { AgentExporter } = require('./exporters/agent')
|
|
13
14
|
const { FileExporter } = require('./exporters/file')
|
|
14
15
|
const { ConsoleLogger } = require('./loggers/console')
|
|
@@ -111,11 +112,7 @@ class Config {
|
|
|
111
112
|
this.pprofPrefix = pprofPrefix
|
|
112
113
|
this.v8ProfilerBugWorkaroundEnabled = isTrue(options.v8ProfilerBugWorkaround ??
|
|
113
114
|
DD_PROFILING_V8_PROFILER_BUG_WORKAROUND ?? true)
|
|
114
|
-
this.url =
|
|
115
|
-
protocol: 'http:',
|
|
116
|
-
hostname: options.hostname,
|
|
117
|
-
port: options.port
|
|
118
|
-
}))
|
|
115
|
+
this.url = getAgentUrl(options)
|
|
119
116
|
|
|
120
117
|
this.libraryInjected = options.libraryInjected
|
|
121
118
|
this.activation = options.activation
|
|
@@ -33,6 +33,7 @@ module.exports = {
|
|
|
33
33
|
ASM_RASP_CMDI: 1n << 37n,
|
|
34
34
|
APM_TRACING_ENABLE_DYNAMIC_INSTRUMENTATION: 1n << 38n,
|
|
35
35
|
APM_TRACING_ENABLE_CODE_ORIGIN: 1n << 40n,
|
|
36
|
+
APM_TRACING_ENABLE_LIVE_DEBUGGING: 1n << 41n,
|
|
36
37
|
ASM_DD_MULTICONFIG: 1n << 42n,
|
|
37
38
|
ASM_TRACE_TAGGING_RULES: 1n << 43n,
|
|
38
39
|
ASM_EXTENDED_DATA_COLLECTION: 1n << 44n,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { URL, format } = require('url')
|
|
4
3
|
const uuid = require('../../../../vendor/dist/crypto-randomuuid')
|
|
5
4
|
const tracerVersion = require('../../../../package.json').version
|
|
6
5
|
const request = require('../exporters/common/request')
|
|
@@ -8,7 +7,7 @@ const log = require('../log')
|
|
|
8
7
|
const { getExtraServices } = require('../service-naming/extra-services')
|
|
9
8
|
const { GIT_REPOSITORY_URL, GIT_COMMIT_SHA } = require('../plugins/util/tags')
|
|
10
9
|
const tagger = require('../tagger')
|
|
11
|
-
const
|
|
10
|
+
const { getAgentUrl } = require('../agent/url')
|
|
12
11
|
const processTags = require('../process-tags')
|
|
13
12
|
const Scheduler = require('./scheduler')
|
|
14
13
|
const { UNACKNOWLEDGED, ACKNOWLEDGED, ERROR } = require('./apply_states')
|
|
@@ -29,11 +28,7 @@ class RemoteConfig {
|
|
|
29
28
|
constructor (config) {
|
|
30
29
|
const pollInterval = Math.floor(config.remoteConfig.pollInterval * 1000)
|
|
31
30
|
|
|
32
|
-
this.url = config
|
|
33
|
-
protocol: 'http:',
|
|
34
|
-
hostname: config.hostname || defaults.hostname,
|
|
35
|
-
port: config.port
|
|
36
|
-
}))
|
|
31
|
+
this.url = getAgentUrl(config)
|
|
37
32
|
|
|
38
33
|
tagger.add(config.tags, {
|
|
39
34
|
'_dd.rc.client_id': clientId
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const os = require('os')
|
|
4
4
|
const { inspect } = require('util')
|
|
5
5
|
const tracerVersion = require('../../../package.json').version
|
|
6
|
-
const
|
|
6
|
+
const { getAgentUrl } = require('./agent/url')
|
|
7
7
|
const { info, warn } = require('./log/writer')
|
|
8
8
|
|
|
9
9
|
const errors = {}
|
|
@@ -43,7 +43,7 @@ function startupLog (agentError) {
|
|
|
43
43
|
* @returns {Record<string, unknown>}
|
|
44
44
|
*/
|
|
45
45
|
function tracerInfo () {
|
|
46
|
-
const url = config
|
|
46
|
+
const url = getAgentUrl(config)
|
|
47
47
|
|
|
48
48
|
const out = {
|
|
49
49
|
[inspect.custom] () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var t={};t.d=(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var e={};t.r(e),t.d(e,{TTLCache:()=>
|
|
1
|
+
(()=>{"use strict";var t={};t.d=(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var e={};t.r(e),t.d(e,{TTLCache:()=>o});let i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,s=()=>i.now(),r=t=>t===1/0||!!t&&t===Math.floor(t)&&t>0&&isFinite(t),a=0x80000000-1;class o{expirations=Object.create(null);data=new Map;expirationMap=new Map;ttl;max;updateAgeOnGet;updateAgeOnHas;noUpdateTTL;noDisposeOnSet;checkAgeOnGet;checkAgeOnHas;dispose;timer;timerExpiration;immortalKeys=new Set;constructor({max:t=1/0,ttl:e,updateAgeOnGet:i=!1,checkAgeOnGet:s=!1,updateAgeOnHas:a=!1,checkAgeOnHas:o=!1,noUpdateTTL:h=!1,dispose:n,noDisposeOnSet:l=!1}={}){if(void 0!==e&&!r(e))throw TypeError("ttl must be positive integer or Infinity if set");if(!r(t))throw TypeError("max must be positive integer or Infinity");if(this.ttl=e,this.max=t,this.updateAgeOnGet=!!i,this.checkAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.checkAgeOnHas=!!o,this.noUpdateTTL=!!h,this.noDisposeOnSet=!!l,void 0!==n){if("function"!=typeof n)throw TypeError("dispose must be function if set");this.dispose=n}else this.dispose=(t,e,i)=>{};this.timer=void 0,this.timerExpiration=void 0}setTimer(t,e){if(this.timerExpiration&&this.timerExpiration<t)return;this.timer&&clearTimeout(this.timer);let i=setTimeout(()=>{for(let t in this.timer=void 0,this.timerExpiration=void 0,this.purgeStale(),this.expirations){let e=Number(t);this.setTimer(e,e-s());break}},Math.min(a,Math.max(0,e)));i.unref&&i.unref(),this.timerExpiration=t,this.timer=i}cancelTimer(){this.timer&&(clearTimeout(this.timer),this.timerExpiration=void 0,this.timer=void 0)}cancelTimers(){return process.emitWarning('TTLCache.cancelTimers has been renamed to TTLCache.cancelTimer (no "s"), and will be removed in the next major version update'),this.cancelTimer()}clear(){let t=this.dispose!==o.prototype.dispose?[...this]:[];for(let[e,i]of(this.data.clear(),this.expirationMap.clear(),this.cancelTimer(),this.expirations=Object.create(null),t))this.dispose(i,e,"delete")}setTTL(t,e=this.ttl){let i=this.expirationMap.get(t);if(void 0!==i){let e=this.expirations[i];!e||e.length<=1?delete this.expirations[i]:this.expirations[i]=e.filter(e=>e!==t)}if(e&&e!==1/0){this.immortalKeys.delete(t);let i=Math.floor(s()+e);this.expirationMap.set(t,i),this.expirations[i]||(this.expirations[i]=[],this.setTimer(i,e)),this.expirations[i].push(t)}else this.immortalKeys.add(t),this.expirationMap.set(t,1/0)}set(t,e,{ttl:i=this.ttl,noUpdateTTL:s=this.noUpdateTTL,noDisposeOnSet:a=this.noDisposeOnSet}={}){if(!r(i))throw TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(t)){s||this.setTTL(t,i);let r=this.data.get(t),o=!a&&this.data.has(t);r!==e&&(this.data.set(t,e),o&&this.dispose(r,t,"set"))}else this.setTTL(t,i),this.data.set(t,e);for(;this.size>this.max;)this.purgeToCapacity();return this}has(t,{checkAgeOnHas:e=this.checkAgeOnHas,ttl:i=this.ttl,updateAgeOnHas:s=this.updateAgeOnHas}={}){return!!this.data.has(t)&&(e&&0===this.getRemainingTTL(t)?(this.delete(t),!1):(s&&this.setTTL(t,i),!0))}getRemainingTTL(t){let e=this.expirationMap.get(t);return e===1/0?e:void 0!==e?Math.max(0,Math.ceil(e-s())):0}get(t,{updateAgeOnGet:e=this.updateAgeOnGet,ttl:i=this.ttl,checkAgeOnGet:s=this.checkAgeOnGet}={}){let r=this.data.get(t);return s&&0===this.getRemainingTTL(t)?void this.delete(t):(e&&this.setTTL(t,i),r)}delete(t){let e=this.expirationMap.get(t);if(void 0!==e){let i=this.data.get(t);this.data.delete(t),this.expirationMap.delete(t),this.immortalKeys.delete(t);let s=this.expirations[e];return s&&(s.length<=1?delete this.expirations[e]:this.expirations[e]=s.filter(e=>e!==t)),this.dispose(i,t,"delete"),0===this.size&&this.cancelTimer(),!0}return!1}purgeToCapacity(){for(let t in this.expirations){let e=this.expirations[t];if(this.size-e.length>=this.max){delete this.expirations[t];let i=[];for(let t of e)i.push([t,this.data.get(t)]),this.data.delete(t),this.expirationMap.delete(t);for(let[t,e]of i)this.dispose(e,t,"evict")}else{let t=this.size-this.max,i=[];for(let s of e.splice(0,t))i.push([s,this.data.get(s)]),this.data.delete(s),this.expirationMap.delete(s);for(let[t,e]of i)this.dispose(e,t,"evict");return}}}get size(){return this.data.size}purgeStale(){let t=Math.ceil(s());for(let e in this.expirations){if("Infinity"===e||Number(e)>t)return;let i=[...this.expirations[e]||[]],s=[];for(let t of(delete this.expirations[e],i))s.push([t,this.data.get(t)]),this.data.delete(t),this.expirationMap.delete(t);for(let[t,e]of s)this.dispose(e,t,"stale")}0===this.size&&this.cancelTimer()}*entries(){for(let t in this.expirations)for(let e of this.expirations[t])yield[e,this.data.get(e)];for(let t of this.immortalKeys)yield[t,this.data.get(t)]}*keys(){for(let t in this.expirations)for(let e of this.expirations[t])yield e;for(let t of this.immortalKeys)yield t}*values(){for(let t in this.expirations)for(let e of this.expirations[t])yield this.data.get(e);for(let t of this.immortalKeys)yield this.data.get(t)}[Symbol.iterator](){return this.entries()}}module.exports=e})();
|