import * as Sentry from '@sentry/node';
Sentry.startSpan(
{ name: 'Parent Operation', op: 'task' },
(parentSpan) => {
const parentContext = parentSpan.spanContext();
console.log('Parent Span ID:', parentContext.spanId);
Sentry.startSpan(
{ name: 'Child Operation', op: 'subtask' },
(childSpan) => {
const childContext = childSpan.spanContext();
// Same trace ID
console.log('Same trace:',
parentContext.traceId === childContext.traceId
);
// Different span IDs
console.log('Different spans:',
parentContext.spanId !== childContext.spanId
);
}
);
}
);