From 5bd55c2e9e39210a72bf7e03c217f73358c5a6c6 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Mon, 2 Feb 2026 11:01:48 +0100 Subject: [PATCH 1/2] fix(span-streaming): Always preserialize attributes We were not preserializing attributes set directly on span creation. --- sentry_sdk/traces.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/traces.py b/sentry_sdk/traces.py index 1c58e4a1cb..e68750c589 100644 --- a/sentry_sdk/traces.py +++ b/sentry_sdk/traces.py @@ -39,7 +39,11 @@ def __init__( trace_id: "Optional[str]" = None, ): self.name: str = name - self._attributes: "Attributes" = attributes or {} + if attributes: + for attribute, value in attributes.items(): + self.set_attribute(attribute, value) + else: + self._attributes: "Attributes" = {} self._trace_id = trace_id From 6550d4d72ab112babed7e383db953abca2ff6f35 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Mon, 2 Feb 2026 11:14:48 +0100 Subject: [PATCH 2/2] fx --- sentry_sdk/traces.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sentry_sdk/traces.py b/sentry_sdk/traces.py index e68750c589..a63a9bebb0 100644 --- a/sentry_sdk/traces.py +++ b/sentry_sdk/traces.py @@ -39,11 +39,10 @@ def __init__( trace_id: "Optional[str]" = None, ): self.name: str = name + self._attributes: "Attributes" = {} if attributes: for attribute, value in attributes.items(): self.set_attribute(attribute, value) - else: - self._attributes: "Attributes" = {} self._trace_id = trace_id