You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Baggage.serialize(include_third_party=True) leaves a trailing comma when there are no third-party items #8120
Baggage.serialize(include_third_party=True) in sentry_sdk/tracing_utils.py appends self.third_party_items unconditionally. When there are no third-party items it is "", so ",".join(items) ends with an empty member.
This is reachable from the Celery integration: _update_celery_task_headers calls combined.serialize(include_third_party=True) when it merges incoming and Sentry baggage, so the common Sentry -> Celery -> Sentry case (incoming baggage with only sentry- items) sends the outgoing baggage header with the stray comma.
Expected Result
No trailing comma when there are no third-party items:
Under the W3C Baggage spec the trailing comma is an empty list-member. Sentry's own parser tolerates it, but a strict W3C / OpenTelemetry baggage parser on a downstream service can reject or mishandle the header.
Proposed fix: only append third_party_items when it is non-empty (if include_third_party and self.third_party_items:). I have this ready with a test in #8119 and am happy to adjust the approach.
Activity
linear-code commentedon Oct 26, 2026
PY-3039