Skip to content

Commit 7a2f158

Browse files
committed
more debug
1 parent 61dc634 commit 7a2f158

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/core/src/tracing/idleSpan.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,17 @@ export function startIdleSpan(startSpanOptions: StartSpanOptions, options: Parti
268268
}
269269

270270
const childSpanJSON = spanToJSON(childSpan);
271-
const { timestamp: childEndTimestamp = 0, start_timestamp: childStartTimestamp = 0 } = childSpanJSON;
271+
const { timestamp: childEndTimestamp, start_timestamp: childStartTimestamp } = childSpanJSON;
272+
273+
if (!childStartTimestamp || !childEndTimestamp) {
274+
DEBUG_BUILD &&
275+
logger.log(
276+
'[Tracing] Discarding span since it has no start or end timestamp',
277+
JSON.stringify(childSpan, undefined, 2),
278+
);
279+
280+
return;
281+
}
272282

273283
const spanStartedBeforeIdleSpanEnd = childStartTimestamp <= endTimestamp;
274284

@@ -279,7 +289,11 @@ export function startIdleSpan(startSpanOptions: StartSpanOptions, options: Parti
279289
if (DEBUG_BUILD) {
280290
const stringifiedSpan = JSON.stringify(childSpan, undefined, 2);
281291
if (!spanStartedBeforeIdleSpanEnd) {
282-
logger.log('[Tracing] Discarding span since it happened after idle span was finished', stringifiedSpan);
292+
logger.log(
293+
'[Tracing] Discarding span since it happened after idle span was finished',
294+
stringifiedSpan,
295+
endTimestamp,
296+
);
283297
} else if (!spanEndedBeforeFinalTimeout) {
284298
logger.log('[Tracing] Discarding span since it finished after idle span final timeout', stringifiedSpan);
285299
}

0 commit comments

Comments
 (0)