From c417a23bb28d9effa42115e954b18cc41c1fc043 Mon Sep 17 00:00:00 2001 From: Manuel Astudillo Date: Thu, 14 Nov 2024 22:25:04 +0100 Subject: [PATCH] fix(telemetry): do not set span on parent context if undefined --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index fda5c356c1..4efa2e3467 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -341,7 +341,7 @@ export async function trace( let messageContext; let dstPropagationMetadata: undefined | string; - if (spanKind === SpanKind.CONSUMER) { + if (spanKind === SpanKind.CONSUMER && parentContext) { messageContext = span.setSpanOnContext(parentContext); } else { messageContext = span.setSpanOnContext(currentContext);