Skip to content

Commit

Permalink
fix(telemetry): do not set span on parent context if undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Nov 15, 2024
1 parent 8784f66 commit c417a23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export async function trace<T>(
let messageContext;
let dstPropagationMetadata: undefined | string;

if (spanKind === SpanKind.CONSUMER) {
if (spanKind === SpanKind.CONSUMER && parentContext) {
messageContext = span.setSpanOnContext(parentContext);
} else {
messageContext = span.setSpanOnContext(currentContext);
Expand Down

0 comments on commit c417a23

Please sign in to comment.