dd-trace 5.107.0 → 5.109.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 +22 -1
- package/package.json +6 -5
- package/packages/datadog-instrumentations/src/ai.js +43 -48
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js-context-methods.js +18 -0
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +111 -0
- package/packages/datadog-instrumentations/src/aws-sdk.js +3 -1
- package/packages/datadog-instrumentations/src/electron.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/aws-durable-execution-sdk-js.js +31 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +1 -0
- package/packages/datadog-instrumentations/src/http/client.js +12 -2
- package/packages/datadog-instrumentations/src/ioredis.js +0 -1
- package/packages/datadog-instrumentations/src/iovalkey.js +1 -2
- package/packages/datadog-instrumentations/src/next.js +34 -0
- package/packages/datadog-instrumentations/src/openai.js +77 -18
- package/packages/datadog-instrumentations/src/redis.js +0 -1
- package/packages/datadog-instrumentations/src/vitest.js +60 -1
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/checkpoint.js +31 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/client.js +55 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/context.js +114 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/handler.js +128 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/index.js +19 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +224 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +43 -0
- package/packages/datadog-plugin-aws-sdk/src/base.js +1 -7
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +100 -37
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +44 -27
- package/packages/datadog-plugin-bullmq/src/filter.js +35 -0
- package/packages/datadog-plugin-bullmq/src/producer.js +84 -4
- package/packages/datadog-plugin-fs/src/index.js +1 -0
- package/packages/datadog-plugin-redis/src/index.js +1 -2
- package/packages/datadog-plugin-vitest/src/index.js +4 -1
- package/packages/dd-trace/src/aiguard/channels.js +0 -1
- package/packages/dd-trace/src/aiguard/index.js +11 -49
- package/packages/dd-trace/src/aiguard/integrations/evaluate.js +46 -0
- package/packages/dd-trace/src/aiguard/integrations/openai.js +66 -0
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +78 -0
- package/packages/{datadog-instrumentations/src/helpers/ai-messages.js → dd-trace/src/aiguard/messages/openai.js} +85 -193
- package/packages/dd-trace/src/aiguard/messages/vercel-ai.js +185 -0
- package/packages/dd-trace/src/appsec/channels.js +1 -0
- package/packages/dd-trace/src/appsec/downstream_requests.js +114 -60
- package/packages/dd-trace/src/appsec/iast/index.js +3 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +54 -12
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +5 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +29 -4
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +21 -12
- package/packages/dd-trace/src/appsec/reporter.js +1 -1
- package/packages/dd-trace/src/config/generated-config-types.d.ts +4 -0
- package/packages/dd-trace/src/config/supported-configurations.json +31 -2
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +2 -0
- package/packages/dd-trace/src/dogstatsd.js +15 -8
- package/packages/dd-trace/src/exporters/agentless/index.js +7 -5
- package/packages/dd-trace/src/exporters/agentless/intake.js +43 -0
- package/packages/dd-trace/src/exporters/agentless/writer.js +5 -4
- package/packages/dd-trace/src/openfeature/flagging_provider.js +8 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +27 -2
- package/packages/dd-trace/src/plugins/index.js +3 -0
- package/packages/dd-trace/src/profiling/config.js +2 -0
- package/packages/dd-trace/src/profiling/profilers/events.js +26 -4
- package/packages/dd-trace/src/profiling/profilers/space.js +3 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +12 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +12 -0
- package/vendor/dist/@datadog/sketches-js/index.js +1 -1
- package/vendor/dist/protobufjs/index.js +1 -1
- package/vendor/dist/protobufjs/minimal/index.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/openai-ai-guard.js +0 -284
|
@@ -7,6 +7,7 @@ const log = require('../../log')
|
|
|
7
7
|
const { entityId } = require('../common/docker')
|
|
8
8
|
const tracerVersion = require('../../../../../package.json').version
|
|
9
9
|
const Writer = require('./writer')
|
|
10
|
+
const { computeIntakeUrl } = require('./intake')
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Agentless exporter for APM trace intake.
|
|
@@ -15,6 +16,7 @@ const Writer = require('./writer')
|
|
|
15
16
|
*/
|
|
16
17
|
class AgentlessExporter {
|
|
17
18
|
#timer
|
|
19
|
+
#config
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* @param {object} config - Configuration object
|
|
@@ -24,13 +26,13 @@ class AgentlessExporter {
|
|
|
24
26
|
* @param {object} [config.tags] - Tags including runtime-id
|
|
25
27
|
*/
|
|
26
28
|
constructor (config) {
|
|
27
|
-
this
|
|
29
|
+
this.#config = config
|
|
28
30
|
const site = config.site ?? 'datadoghq.com'
|
|
29
31
|
|
|
30
32
|
try {
|
|
31
|
-
// Agentless traffic carries the Datadog API key, so the intake is always
|
|
32
|
-
//
|
|
33
|
-
this._url = new URL(
|
|
33
|
+
// Agentless traffic carries the Datadog API key, so the intake is always an https endpoint
|
|
34
|
+
// derived from the site; never config.url (the agent's cleartext http) or the key leaks.
|
|
35
|
+
this._url = new URL(computeIntakeUrl(site))
|
|
34
36
|
} catch (err) {
|
|
35
37
|
log.error('Invalid site for agentless exporter. site=%s. Error: %s', site, err.message)
|
|
36
38
|
this._url = null
|
|
@@ -89,7 +91,7 @@ class AgentlessExporter {
|
|
|
89
91
|
export (spans) {
|
|
90
92
|
this._writer.append(spans)
|
|
91
93
|
|
|
92
|
-
const { flushInterval } = this
|
|
94
|
+
const { flushInterval } = this.#config
|
|
93
95
|
|
|
94
96
|
if (flushInterval === 0) {
|
|
95
97
|
try {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// Per-site hosts for the agentless JSON span intake. Regional data centers serve it from
|
|
4
|
+
// browser-intake-* hosts rather than public-trace-http-intake.logs.<site>, so a single template
|
|
5
|
+
// silently drops spans on us3/us5/ap1/ap2. Mirrors dd-trace-py's AgentlessTraceWriter.INTAKE_URLS
|
|
6
|
+
// (DataDog/dd-trace-py#18514).
|
|
7
|
+
const INTAKE_URLS = {
|
|
8
|
+
'datadoghq.com': 'https://public-trace-http-intake.logs.datadoghq.com',
|
|
9
|
+
'datadoghq.eu': 'https://public-trace-http-intake.logs.datadoghq.eu',
|
|
10
|
+
'us3.datadoghq.com': 'https://trace.browser-intake-us3-datadoghq.com',
|
|
11
|
+
'us5.datadoghq.com': 'https://trace.browser-intake-us5-datadoghq.com',
|
|
12
|
+
'ap1.datadoghq.com': 'https://browser-intake-ap1-datadoghq.com',
|
|
13
|
+
'ap2.datadoghq.com': 'https://browser-intake-ap2-datadoghq.com',
|
|
14
|
+
'uk1.datadoghq.com': 'https://browser-intake-uk1-datadoghq.com',
|
|
15
|
+
'datad0g.com': 'https://public-trace-http-intake.logs.datad0g.com',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Path of the JSON span intake on every intake host.
|
|
19
|
+
const INTAKE_PATH = '/api/v2/spans'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the agentless intake origin for a Datadog site.
|
|
23
|
+
*
|
|
24
|
+
* Unknown sites fall back to the browser-intake naming: strip the TLD, dash-join the rest, then
|
|
25
|
+
* reattach the TLD, e.g. 'us2.ddog-gov.com' -> 'https://browser-intake-us2-ddog-gov.com'.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} [site] - The Datadog site, e.g. 'us3.datadoghq.com'. Defaults to 'datadoghq.com'.
|
|
28
|
+
* @returns {string} The intake origin, without a path.
|
|
29
|
+
*/
|
|
30
|
+
function computeIntakeUrl (site = 'datadoghq.com') {
|
|
31
|
+
const normalized = site.toLowerCase()
|
|
32
|
+
const known = INTAKE_URLS[normalized]
|
|
33
|
+
if (known !== undefined) {
|
|
34
|
+
return known
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const lastDot = normalized.lastIndexOf('.')
|
|
38
|
+
const prefix = lastDot === -1 ? '' : normalized.slice(0, lastDot)
|
|
39
|
+
const tld = lastDot === -1 ? normalized : normalized.slice(lastDot + 1)
|
|
40
|
+
return `https://browser-intake-${prefix.replaceAll('.', '-')}.${tld}`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = { INTAKE_URLS, INTAKE_PATH, computeIntakeUrl }
|
|
@@ -7,6 +7,7 @@ const tracerVersion = require('../../../../../package.json').version
|
|
|
7
7
|
|
|
8
8
|
const BaseWriter = require('../common/writer')
|
|
9
9
|
const { AgentlessJSONEncoder } = require('../../encode/agentless-json')
|
|
10
|
+
const { computeIntakeUrl, INTAKE_PATH } = require('./intake')
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Writer for agentless APM trace intake.
|
|
@@ -28,7 +29,7 @@ class AgentlessWriter extends BaseWriter {
|
|
|
28
29
|
|
|
29
30
|
if (!url) {
|
|
30
31
|
try {
|
|
31
|
-
this._url = new URL(
|
|
32
|
+
this._url = new URL(computeIntakeUrl(site))
|
|
32
33
|
} catch (err) {
|
|
33
34
|
log.error(
|
|
34
35
|
'Invalid site value for agentless intake: %s. Cannot construct URL. Error: %s',
|
|
@@ -121,7 +122,7 @@ class AgentlessWriter extends BaseWriter {
|
|
|
121
122
|
this.#apiKeyMissing = false
|
|
122
123
|
|
|
123
124
|
const options = {
|
|
124
|
-
path:
|
|
125
|
+
path: INTAKE_PATH,
|
|
125
126
|
method: 'POST',
|
|
126
127
|
headers: {
|
|
127
128
|
'Content-Type': 'application/json',
|
|
@@ -140,7 +141,7 @@ class AgentlessWriter extends BaseWriter {
|
|
|
140
141
|
|
|
141
142
|
request(data, options, (err, res, statusCode) => {
|
|
142
143
|
if (err) {
|
|
143
|
-
this
|
|
144
|
+
this.#logRequestError(err, statusCode, count)
|
|
144
145
|
done()
|
|
145
146
|
return
|
|
146
147
|
}
|
|
@@ -156,7 +157,7 @@ class AgentlessWriter extends BaseWriter {
|
|
|
156
157
|
* @param {number} statusCode - HTTP status code (if available)
|
|
157
158
|
* @param {number} count - Number of traces that were being sent
|
|
158
159
|
*/
|
|
159
|
-
|
|
160
|
+
#logRequestError (err, statusCode, count) {
|
|
160
161
|
if (statusCode === 401 || statusCode === 403) {
|
|
161
162
|
log.error(
|
|
162
163
|
'Authentication failed sending %d trace(s) (status %s). Verify DD_API_KEY is valid.',
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { DatadogNodeServerProvider } = require('@datadog/openfeature-node-server')
|
|
4
3
|
const { channel } = require('dc-polyfill')
|
|
5
4
|
const log = require('../log')
|
|
6
5
|
const { EXPOSURE_CHANNEL } = require('./constants/constants')
|
|
7
6
|
const EvalMetricsHook = require('./eval-metrics-hook')
|
|
8
7
|
const SpanEnrichmentHook = require('./span-enrichment-hook')
|
|
9
8
|
|
|
9
|
+
// Bundler-opaque require for the optional peer chain
|
|
10
|
+
// `@datadog/openfeature-node-server` -> `@openfeature/server-sdk` ->
|
|
11
|
+
// `@openfeature/core`. Same shape as `helpers/rewriter/compiler.js`.
|
|
12
|
+
// Refs: https://github.com/DataDog/dd-trace-js/issues/8635
|
|
13
|
+
// eslint-disable-next-line camelcase, no-undef
|
|
14
|
+
const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
|
|
15
|
+
const { DatadogNodeServerProvider } = runtimeRequire(['@datadog/openfeature', 'node', 'server'].join('-'))
|
|
16
|
+
|
|
10
17
|
/**
|
|
11
18
|
* OpenFeature provider that integrates with Datadog's feature flagging system.
|
|
12
19
|
* Extends DatadogNodeServerProvider to add tracer integration and configuration management.
|
|
@@ -442,6 +442,28 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
+
/**
|
|
446
|
+
* Updates repository-root-dependent state when a worker receives the root from
|
|
447
|
+
* the coordinator process after plugin configuration.
|
|
448
|
+
*
|
|
449
|
+
* @param {string|undefined} repositoryRoot - Repository root discovered by the coordinator process.
|
|
450
|
+
* @param {Array<{ pattern: string, owners: string[] }>|null|undefined} codeOwnersEntries
|
|
451
|
+
* Parsed CODEOWNERS entries discovered by the coordinator process.
|
|
452
|
+
* @returns {void}
|
|
453
|
+
*/
|
|
454
|
+
_setRepositoryRoot (repositoryRoot, codeOwnersEntries) {
|
|
455
|
+
if (codeOwnersEntries !== undefined) {
|
|
456
|
+
this.codeOwnersEntries = codeOwnersEntries
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (!repositoryRoot || repositoryRoot === this.repositoryRoot) return
|
|
460
|
+
|
|
461
|
+
this.repositoryRoot = repositoryRoot
|
|
462
|
+
if (codeOwnersEntries === undefined) {
|
|
463
|
+
this.codeOwnersEntries = getCodeOwnersFileEntries(this.repositoryRoot)
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
445
467
|
/**
|
|
446
468
|
* Returns request error tags from the test session span for propagation to module, suite and test spans.
|
|
447
469
|
* @returns {Record<string, string>}
|
|
@@ -610,6 +632,8 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
610
632
|
const workerTestFramework = WORKER_EXPORTER_TO_TEST_FRAMEWORK[exporter]
|
|
611
633
|
this.shouldSkipGitMetadataExtraction = workerTestFramework &&
|
|
612
634
|
TEST_FRAMEWORKS_TO_SKIP_GIT_METADATA_EXTRACTION.has(workerTestFramework)
|
|
635
|
+
const shouldDeferCodeOwnersEntries = workerTestFramework === 'vitest'
|
|
636
|
+
const shouldDeferRepositoryRoot = workerTestFramework === 'vitest'
|
|
613
637
|
|
|
614
638
|
this.testEnvironmentMetadata = getTestEnvironmentMetadata(
|
|
615
639
|
this.constructor.id,
|
|
@@ -635,9 +659,10 @@ module.exports = class CiPlugin extends Plugin {
|
|
|
635
659
|
[GIT_COMMIT_HEAD_MESSAGE]: commitHeadMessage,
|
|
636
660
|
} = this.testEnvironmentMetadata
|
|
637
661
|
|
|
638
|
-
this.repositoryRoot = repositoryRoot ||
|
|
662
|
+
this.repositoryRoot = repositoryRoot ||
|
|
663
|
+
(shouldDeferRepositoryRoot ? process.cwd() : getRepositoryRoot() || process.cwd())
|
|
639
664
|
|
|
640
|
-
this.codeOwnersEntries = getCodeOwnersFileEntries(this.repositoryRoot)
|
|
665
|
+
this.codeOwnersEntries = shouldDeferCodeOwnersEntries ? null : getCodeOwnersFileEntries(this.repositoryRoot)
|
|
641
666
|
|
|
642
667
|
this.ciProviderName = ciProviderName
|
|
643
668
|
|
|
@@ -8,6 +8,7 @@ const plugins = {
|
|
|
8
8
|
get '@azure/event-hubs' () { return require('../../../datadog-plugin-azure-event-hubs/src') },
|
|
9
9
|
get '@azure/functions' () { return require('../../../datadog-plugin-azure-functions/src') },
|
|
10
10
|
get '@modelcontextprotocol/sdk' () { return require('../../../datadog-plugin-modelcontextprotocol-sdk/src') },
|
|
11
|
+
get '@aws/durable-execution-sdk-js' () { return require('../../../datadog-plugin-aws-durable-execution-sdk-js/src') },
|
|
11
12
|
get 'durable-functions' () { return require('../../../datadog-plugin-azure-durable-functions/src') },
|
|
12
13
|
get '@azure/service-bus' () { return require('../../../datadog-plugin-azure-service-bus/src') },
|
|
13
14
|
get '@cucumber/cucumber' () { return require('../../../datadog-plugin-cucumber/src') },
|
|
@@ -55,6 +56,7 @@ const plugins = {
|
|
|
55
56
|
get express () { return require('../../../datadog-plugin-express/src') },
|
|
56
57
|
get fastify () { return require('../../../datadog-plugin-fastify/src') },
|
|
57
58
|
get 'find-my-way' () { return require('../../../datadog-plugin-find-my-way/src') },
|
|
59
|
+
get fs () { return require('../../../datadog-plugin-fs/src') },
|
|
58
60
|
get 'global:fetch' () { return require('../../../datadog-plugin-fetch/src') },
|
|
59
61
|
get graphql () { return require('../../../datadog-plugin-graphql/src') },
|
|
60
62
|
get grpc () { return require('../../../datadog-plugin-grpc/src') },
|
|
@@ -97,6 +99,7 @@ const plugins = {
|
|
|
97
99
|
get net () { return require('../../../datadog-plugin-net/src') },
|
|
98
100
|
get next () { return require('../../../datadog-plugin-next/src') },
|
|
99
101
|
get 'node:dns' () { return require('../../../datadog-plugin-dns/src') },
|
|
102
|
+
get 'node:fs' () { return require('../../../datadog-plugin-fs/src') },
|
|
100
103
|
get 'node:http' () { return require('../../../datadog-plugin-http/src') },
|
|
101
104
|
get 'node:http2' () { return require('../../../datadog-plugin-http2/src') },
|
|
102
105
|
get 'node:https' () { return require('../../../datadog-plugin-http/src') },
|
|
@@ -86,6 +86,7 @@ class Config {
|
|
|
86
86
|
|
|
87
87
|
this.timelineEnabled = options.DD_PROFILING_TIMELINE_ENABLED
|
|
88
88
|
this.timelineSamplingEnabled = options.DD_INTERNAL_PROFILING_TIMELINE_SAMPLING_ENABLED
|
|
89
|
+
this.allocationProfilingEnabled = options.DD_PROFILING_ALLOCATION_ENABLED
|
|
89
90
|
this.codeHotspotsEnabled = options.DD_PROFILING_CODEHOTSPOTS_ENABLED
|
|
90
91
|
this.cpuProfilingEnabled = options.DD_PROFILING_CPU_ENABLED
|
|
91
92
|
this.heapSamplingInterval = options.DD_PROFILING_HEAP_SAMPLING_INTERVAL
|
|
@@ -139,6 +140,7 @@ class Config {
|
|
|
139
140
|
|
|
140
141
|
get systemInfoReport () {
|
|
141
142
|
const report = {
|
|
143
|
+
allocationProfilingEnabled: this.allocationProfilingEnabled,
|
|
142
144
|
asyncContextFrameEnabled: this.asyncContextFrameEnabled,
|
|
143
145
|
codeHotspotsEnabled: this.codeHotspotsEnabled,
|
|
144
146
|
cpuProfilingEnabled: this.cpuProfilingEnabled,
|
|
@@ -66,12 +66,11 @@ class GCDecorator {
|
|
|
66
66
|
constructor (stringTable) {
|
|
67
67
|
this.stringTable = stringTable
|
|
68
68
|
this.reasonLabelKey = stringTable.dedup('gc reason')
|
|
69
|
+
this.kindLabelKey = stringTable.dedup('gc type')
|
|
69
70
|
this.kindLabels = []
|
|
70
71
|
this.reasonLabels = []
|
|
71
72
|
this.flagObj = {}
|
|
72
73
|
|
|
73
|
-
const kindLabelKey = stringTable.dedup('gc type')
|
|
74
|
-
|
|
75
74
|
// Create labels for all GC performance flags and kinds of GC
|
|
76
75
|
for (const [key, value] of Object.entries(constants)) {
|
|
77
76
|
if (key.startsWith('NODE_PERFORMANCE_GC_FLAGS_')) {
|
|
@@ -79,20 +78,43 @@ class GCDecorator {
|
|
|
79
78
|
} else if (key.startsWith('NODE_PERFORMANCE_GC_')) {
|
|
80
79
|
// It's a constant for a kind of GC
|
|
81
80
|
const kind = key.slice(20).toLowerCase()
|
|
82
|
-
this.kindLabels[value] = labelFromStr(stringTable, kindLabelKey, kind)
|
|
81
|
+
this.kindLabels[value] = labelFromStr(stringTable, this.kindLabelKey, kind)
|
|
83
82
|
}
|
|
84
83
|
}
|
|
84
|
+
|
|
85
|
+
// V8's young-generation collector emits GC events with kind 2, but Node.js
|
|
86
|
+
// doesn't expose a matching NODE_PERFORMANCE_GC_* constant for it, so we map it
|
|
87
|
+
// explicitly. The collector was renamed from Minor Mark-Compact to Minor
|
|
88
|
+
// Mark-Sweep in the V8 version that shipped with Node 22. See equivalent
|
|
89
|
+
// mapping in runtime_metrics.js.
|
|
90
|
+
const minorMarkGCKind = 2
|
|
91
|
+
if (this.kindLabels[minorMarkGCKind] === undefined) {
|
|
92
|
+
const { NODE_MAJOR } = require('../../../../../version')
|
|
93
|
+
const minorGCLabel = NODE_MAJOR >= 22 ? 'minor_mark_sweep' : 'minor_mark_compact'
|
|
94
|
+
this.kindLabels[minorMarkGCKind] = labelFromStr(stringTable, this.kindLabelKey, minorGCLabel)
|
|
95
|
+
}
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
decorateSample (sampleInput, item) {
|
|
88
99
|
const { kind, flags } = item.detail
|
|
89
|
-
sampleInput.label.push(this.
|
|
100
|
+
sampleInput.label.push(this.getKindLabel(kind))
|
|
90
101
|
const reasonLabel = this.getReasonLabel(flags)
|
|
91
102
|
if (reasonLabel) {
|
|
92
103
|
sampleInput.label.push(reasonLabel)
|
|
93
104
|
}
|
|
94
105
|
}
|
|
95
106
|
|
|
107
|
+
getKindLabel (kind) {
|
|
108
|
+
let kindLabel = this.kindLabels[kind]
|
|
109
|
+
if (kindLabel === undefined) {
|
|
110
|
+
// Gracefully handle GC kinds we don't have a label for (e.g. a value
|
|
111
|
+
// introduced by a future Node.js/V8 version).
|
|
112
|
+
kindLabel = labelFromStr(this.stringTable, this.kindLabelKey, `unknown_${kind}`)
|
|
113
|
+
this.kindLabels[kind] = kindLabel
|
|
114
|
+
}
|
|
115
|
+
return kindLabel
|
|
116
|
+
}
|
|
117
|
+
|
|
96
118
|
getReasonLabel (flags) {
|
|
97
119
|
if (flags === 0) {
|
|
98
120
|
return null
|
|
@@ -13,12 +13,14 @@ class NativeSpaceProfiler {
|
|
|
13
13
|
#mapper
|
|
14
14
|
#oomMonitoring
|
|
15
15
|
#pprof
|
|
16
|
+
#allocationProfilingEnabled = false
|
|
16
17
|
#samplingInterval = 512 * 1024
|
|
17
18
|
#started = false
|
|
18
19
|
|
|
19
20
|
constructor (options = {}) {
|
|
20
21
|
// TODO: Remove default value. It is only used in testing.
|
|
21
22
|
this.#samplingInterval = options.heapSamplingInterval || 512 * 1024
|
|
23
|
+
this.#allocationProfilingEnabled = options.allocationProfilingEnabled
|
|
22
24
|
this.#oomMonitoring = options.oomMonitoring || {}
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -31,7 +33,7 @@ class NativeSpaceProfiler {
|
|
|
31
33
|
|
|
32
34
|
this.#mapper = mapper
|
|
33
35
|
this.#pprof = require('@datadog/pprof')
|
|
34
|
-
this.#pprof.heap.start(this.#samplingInterval, STACK_DEPTH)
|
|
36
|
+
this.#pprof.heap.start(this.#samplingInterval, STACK_DEPTH, this.#allocationProfilingEnabled)
|
|
35
37
|
if (this.#oomMonitoring.enabled) {
|
|
36
38
|
const strategies = this.#oomMonitoring.exportStrategies
|
|
37
39
|
this.#pprof.heap.monitorOutOfMemory(
|
|
@@ -13,6 +13,18 @@ const serverless = {
|
|
|
13
13
|
serviceName: identityService,
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
+
client: {
|
|
17
|
+
'aws-durable-execution-sdk-js': {
|
|
18
|
+
opName: () => 'aws.durable.invoke',
|
|
19
|
+
serviceName: identityService,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
internal: {
|
|
23
|
+
'aws-durable-execution-sdk-js': {
|
|
24
|
+
opName: () => 'aws.durable.execute',
|
|
25
|
+
serviceName: identityService,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
module.exports = serverless
|
|
@@ -13,6 +13,18 @@ const serverless = {
|
|
|
13
13
|
serviceName: identityService,
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
+
client: {
|
|
17
|
+
'aws-durable-execution-sdk-js': {
|
|
18
|
+
opName: () => 'aws.durable.invoke',
|
|
19
|
+
serviceName: identityService,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
internal: {
|
|
23
|
+
'aws-durable-execution-sdk-js': {
|
|
24
|
+
opName: () => 'aws.durable.execute',
|
|
25
|
+
serviceName: identityService,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
module.exports = serverless
|