Skip to content

Commit b4be7aa

Browse files
committed
.
1 parent b9e765f commit b4be7aa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sentry_sdk/scope.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,14 @@ def set_client(
489489
If `None` the client of the scope will be replaced by a :py:class:`sentry_sdk.NonRecordingClient`.
490490
491491
"""
492-
self.client = client if client is not None else NonRecordingClient()
492+
if client is not None:
493+
self.client = client
494+
# We need a client to set the initial global attributes on the global
495+
# scope since they mostly come from client options, so populate them
496+
# as soon as a client is set
497+
sentry_sdk.get_global_scope()._set_global_attributes()
498+
else:
499+
self.client = NonRecordingClient()
493500

494501
def fork(self) -> "Scope":
495502
"""

0 commit comments

Comments
 (0)