Skip to content

Commit e9eefcc

Browse files
author
Luca Forstner
committed
comment
1 parent dfc7cfe commit e9eefcc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/opentelemetry/src/trace.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export function startSpan<T>(options: OpenTelemetrySpanContext, callback: (span:
4747
return handleCallbackErrors(
4848
() => callback(span),
4949
() => {
50+
// Only set the span status to ERROR when there wasn't any status set before, in order to avoid stomping useful span statuses
5051
if (spanToJSON(span).status === undefined) {
5152
span.setStatus({ code: SpanStatusCode.ERROR });
5253
}
@@ -85,6 +86,7 @@ export function startSpanManual<T>(
8586
return handleCallbackErrors(
8687
() => callback(span, () => span.end()),
8788
() => {
89+
// Only set the span status to ERROR when there wasn't any status set before, in order to avoid stomping useful span statuses
8890
if (spanToJSON(span).status === undefined) {
8991
span.setStatus({ code: SpanStatusCode.ERROR });
9092
}

0 commit comments

Comments
 (0)