@@ -351,10 +351,9 @@ describe('profiler', () => {
351
351
// 'local root span id's
352
352
// - samples with spans also must have a 'trace endpoint' label with values 'endpoint-0',
353
353
// 'endpoint-1', or 'endpoint-2'
354
- // - every occurrence of a span must have the same root span, endpoint, and asyncId
354
+ // - every occurrence of a span must have the same root span and endpoint
355
355
const rootSpans = new Set ( )
356
356
const endpoints = new Set ( )
357
- const asyncIds = new Set ( )
358
357
const spans = new Map ( )
359
358
const strings = profile . stringTable
360
359
const tsKey = strings . dedup ( 'end_timestamp_ns' )
@@ -364,13 +363,11 @@ describe('profiler', () => {
364
363
const threadNameKey = strings . dedup ( 'thread name' )
365
364
const threadIdKey = strings . dedup ( 'thread id' )
366
365
const osThreadIdKey = strings . dedup ( 'os thread id' )
367
- const asyncIdKey = strings . dedup ( 'async id' )
368
366
const threadNameValue = strings . dedup ( 'Main Event Loop' )
369
367
const nonJSThreadNameValue = strings . dedup ( 'Non-JS threads' )
370
368
371
- const asyncIdWorks = require ( 'semifies' ) ( process . versions . node , '>=22.10.0' )
372
369
for ( const sample of profile . sample ) {
373
- let ts , spanId , rootSpanId , endpoint , threadName , threadId , osThreadId , asyncId
370
+ let ts , spanId , rootSpanId , endpoint , threadName , threadId , osThreadId
374
371
for ( const label of sample . label ) {
375
372
switch ( label . key ) {
376
373
case tsKey : ts = label . num ; break
@@ -380,12 +377,6 @@ describe('profiler', () => {
380
377
case threadNameKey : threadName = label . str ; break
381
378
case threadIdKey : threadId = label . str ; break
382
379
case osThreadIdKey : osThreadId = label . str ; break
383
- case asyncIdKey :
384
- asyncId = label . num
385
- if ( asyncId === 0 ) {
386
- asyncId = undefined
387
- }
388
- break
389
380
default : assert . fail ( `Unexpected label key ${ strings . dedup ( label . key ) } ${ encoded } ` )
390
381
}
391
382
}
@@ -419,27 +410,11 @@ describe('profiler', () => {
419
410
// 3 of them.
420
411
continue
421
412
}
422
- const spanData = { rootSpanId, endpoint, asyncId }
423
- // Record async ID so we can verify we encountered 9 different values.
424
- // Async ID can be sporadically missing if sampling hits an intrinsified
425
- // function.
426
- if ( asyncId !== undefined ) {
427
- asyncIds . add ( asyncId )
428
- }
413
+ const spanData = { rootSpanId, endpoint }
429
414
const existingSpanData = spans . get ( spanId )
430
415
if ( existingSpanData ) {
431
- // Span's root span, endpoint, and async ID must be consistent
432
- // across samples.
433
- assert . equal ( existingSpanData . rootSpanId , rootSpanId , encoded )
434
- assert . equal ( existingSpanData . endpoint , endpoint , encoded )
435
- if ( asyncIdWorks ) {
436
- // Account for asyncID sporadically missing
437
- if ( existingSpanData . asyncId === undefined ) {
438
- existingSpanData . asyncId = asyncId
439
- } else if ( asyncId !== undefined ) {
440
- assert . equal ( existingSpanData . asyncId , asyncId , encoded )
441
- }
442
- }
416
+ // Span's root span and endpoint must be consistent across samples
417
+ assert . deepEqual ( spanData , existingSpanData , encoded )
443
418
} else {
444
419
// New span id, store span data
445
420
spans . set ( spanId , spanData )
@@ -457,10 +432,9 @@ describe('profiler', () => {
457
432
}
458
433
}
459
434
}
460
- // Need to have a total of 9 different spans, with 9 different async IDs,
461
- // 3 different root spans, and 3 different endpoints.
435
+ // Need to have a total of 9 different spans, with 3 different root spans
436
+ // and 3 different endpoints.
462
437
assert . equal ( spans . size , 9 , encoded )
463
- assert . equal ( asyncIds . size , asyncIdWorks ? 9 : 0 , encoded )
464
438
assert . equal ( rootSpans . size , 3 , encoded )
465
439
assert . equal ( endpoints . size , 3 , encoded )
466
440
} )
0 commit comments