From c3c2f681f5c5a647ecf0c89901cf41240b6350d4 Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Tue, 6 Dec 2022 16:43:18 +0100 Subject: [PATCH] Create an empty DSC in case there is no baggage header --- tracing.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tracing.go b/tracing.go index 314f8b49..5a70c07b 100644 --- a/tracing.go +++ b/tracing.go @@ -699,6 +699,13 @@ func ContinueFromHeaders(trace, baggage string) SpanOption { if baggage != "" { s.updateFromBaggage([]byte(baggage)) } + // In case a sentry-trace header is present but no baggage header, + // create an empty, frozen DynamicSamplingContext. + if trace != "" && baggage == "" { + s.dynamicSamplingContext = DynamicSamplingContext{ + Frozen: true, + } + } } }