From d53c8fa10486a145b1a620936f2519a53d088092 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Mon, 18 Jul 2022 18:46:32 +0300 Subject: [PATCH] fix: avoid sending empty Baggage header According to W3C Working Draft spec, the Baggage header must contain at least one value, an empty value is invalid. --- sentry_sdk/tracing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index dd4b1a730d..d8d522d2d4 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -308,7 +308,9 @@ def iter_headers(self): yield "tracestate", tracestate if self.containing_transaction and self.containing_transaction._baggage: - yield "baggage", self.containing_transaction._baggage.serialize() + baggage = self.containing_transaction._baggage.serialize() + if baggage: + yield "baggage", baggage @classmethod def from_traceparent(