Skip to content

Commit 0e9a60d

Browse files
committed
Turn async ID gathering off by default.
1 parent 3da675e commit 0e9a60d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

integration-tests/profiler/profiler.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,14 @@ describe('profiler', () => {
317317
// see comment on busyCycleTimeNs recomputation below. Ideally a single retry should be enough
318318
// with recomputed busyCycleTimeNs, but let's give ourselves more leeway.
319319
this.retries(9)
320+
const asyncIdWorks = require('semifies')(process.versions.node, '>=22.10.0')
320321
const procStart = BigInt(Date.now() * 1000000)
321322
const proc = fork(path.join(cwd, 'profiler/codehotspots.js'), {
322323
cwd,
323324
env: {
324325
DD_PROFILING_EXPORTERS: 'file',
325326
DD_PROFILING_ENABLED: 1,
327+
DD_PROFILING_ASYNC_ID_ENABLED: asyncIdWorks ? 1 : 0,
326328
BUSY_CYCLE_TIME: (busyCycleTimeNs | 0).toString()
327329
}
328330
})
@@ -368,7 +370,6 @@ describe('profiler', () => {
368370
const threadNameValue = strings.dedup('Main Event Loop')
369371
const nonJSThreadNameValue = strings.dedup('Non-JS threads')
370372

371-
const asyncIdWorks = require('semifies')(process.versions.node, '>=22.10.0')
372373
for (const sample of profile.sample) {
373374
let ts, spanId, rootSpanId, endpoint, threadName, threadId, osThreadId, asyncId
374375
for (const label of sample.label) {

packages/dd-trace/src/profiling/config.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,19 @@ class Config {
181181
this.timelineSamplingEnabled = isTrue(coalesce(options.timelineSamplingEnabled,
182182
DD_INTERNAL_PROFILING_TIMELINE_SAMPLING_ENABLED, true))
183183

184-
// Async ID gathering only works reliably on Node >= 22.10.0
185184
this.asyncIdEnabled = isTrue(coalesce(options.asyncIdEnabled,
186-
DD_PROFILING_ASYNC_ID_ENABLED, this.timelineEnabled && satisfies(process.versions.node, '>=22.10.0')))
185+
DD_PROFILING_ASYNC_ID_ENABLED, false))
186+
if (this.asyncIdEnabled) {
187+
if (!satisfies(process.versions.node, '>=22.10.0')) {
188+
logger.warn('Async ID gathering is enabled, but it only works reliably on Node >= 22.10.0.')
189+
}
190+
if (!this.timelineEnabled) {
191+
logger.warn(
192+
'Async ID gathering is enabled, but timeline is disabled. ' +
193+
'Async IDs are not useful without the timeline view.'
194+
)
195+
}
196+
}
187197

188198
this.codeHotspotsEnabled = isTrue(coalesce(options.codeHotspotsEnabled,
189199
DD_PROFILING_CODEHOTSPOTS_ENABLED,

0 commit comments

Comments
 (0)