diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 39d7621b09..410b8c3ad4 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(