Skip to content

Commit 91a9403

Browse files
committed
use set_user on the scope instead of adding it via the segment attributes
1 parent 3fc8875 commit 91a9403

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

sentry_sdk/integrations/pyramid.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,17 @@ def sentry_patched_call_view(
8181
if integration is None:
8282
return old_call_view(registry, request, *args, **kwargs)
8383

84-
current_scope = sentry_sdk.get_current_scope()
8584
_set_transaction_name_and_source(
86-
current_scope, integration.transaction_style, request
85+
sentry_sdk.get_current_scope(), integration.transaction_style, request
8786
)
8887

88+
scope = sentry_sdk.get_isolation_scope()
89+
8990
if should_send_default_pii() and has_span_streaming_enabled(client.options):
90-
current_span = current_scope.streamed_span
9191
user_id = authenticated_userid(request)
92+
if user_id:
93+
scope.set_user({"id": user_id})
9294

93-
if user_id and type(current_span) is StreamedSpan:
94-
current_span._segment.set_attribute("user.id", user_id)
95-
96-
scope = sentry_sdk.get_isolation_scope()
9795
scope.add_event_processor(
9896
_make_event_processor(weakref.ref(request), integration)
9997
)

0 commit comments

Comments
 (0)