Skip to content

Commit 0edc902

Browse files
feat(tracing): Add __repr__ to Baggage
The default `__repr__` does not show what is in the `Baggage`, making it extremely difficult to debug code involving `Baggage` objects. Add a `__repr__` which includes the serialized `Baggage` to improve debuggability.
1 parent c227e11 commit 0edc902

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sentry_sdk/tracing_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@ def strip_sentry_baggage(header):
638638
)
639639
)
640640

641+
def __repr__(self):
642+
return f"<Baggage {self.serialize()}>"
643+
641644

642645
def should_propagate_trace(client, url):
643646
# type: (sentry_sdk.client.BaseClient, str) -> bool

0 commit comments

Comments
 (0)