From d6df1d3cb52f1e91e618cd3d205f0e9c78d434d1 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 11 May 2026 09:51:32 +0200 Subject: [PATCH] fix: Set transaction source for unsampled streamed spans --- sentry_sdk/scope.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 06aad5857f..4e90b636ff 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -849,6 +849,10 @@ def transaction(self, value: "Any") -> None: def set_transaction_name(self, name: str, source: "Optional[str]" = None) -> None: """Set the transaction name and optionally the transaction source.""" self._transaction = name + + if source: + self._transaction_info["source"] = source + if self._span: if isinstance(self._span, NoOpStreamedSpan): return @@ -865,9 +869,6 @@ def set_transaction_name(self, name: str, source: "Optional[str]" = None) -> Non if source: self._span.containing_transaction.source = source - if source: - self._transaction_info["source"] = source - @_attr_setter def user(self, value: "Optional[Dict[str, Any]]") -> None: """When set a specific user is bound to the scope. Deprecated in favor of set_user."""