Skip to content

Commit e685c57

Browse files
authored
chore: update the unclosed span logging for better debugging (#699)
* update the unclosed span logging for better debugging * lint
1 parent 6be3cbc commit e685c57

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/trace/tracer-wrapper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ export class TracerWrapper {
9898
try {
9999
const activeSpan = this.currentSpan;
100100
if (activeSpan && typeof activeSpan.finish === "function") {
101-
logDebug("Detected stale span from previous invocation, finishing it to prevent trace context leakage");
101+
const context = activeSpan.context();
102+
const traceId = context?.toTraceId?.() ?? "unknown";
103+
const spanId = context?.toSpanId?.() ?? "unknown";
104+
logWarning(
105+
`Detected stale span from previous invocation, finishing it to prevent trace context leakage. TraceId: ${traceId}, SpanId: ${spanId}`,
106+
);
102107
activeSpan.finish();
103108
}
104109
} catch (err) {

0 commit comments

Comments
 (0)