diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 5aac2f6ac9..722f671a12 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -279,12 +279,9 @@ def get_global_scope(cls): return _global_scope - @classmethod - def _merge_scopes(cls, additional_scope=None, additional_scope_kwargs=None): + def _merge_scopes(self, additional_scope=None, additional_scope_kwargs=None): # type: (Optional[Scope], Optional[Dict[str, Any]]) -> Scope """ - .. versionadded:: 2.0.0 - Merges global, isolation and current scope into a new scope and adds the given additional scope or additional scope kwargs to it. """ @@ -302,6 +299,8 @@ def _merge_scopes(cls, additional_scope=None, additional_scope_kwargs=None): if current_scope is not None: final_scope.update_from_scope(current_scope) + final_scope.update_from_scope(self) + if additional_scope is not None: if callable(additional_scope): additional_scope(final_scope) @@ -1042,7 +1041,7 @@ def capture_event(self, event, hint=None, scope=None, **scope_kwargs): :returns: An `event_id` if the SDK decided to send the event (see :py:meth:`sentry_sdk.client._Client.capture_event`). """ - scope = Scope._merge_scopes(scope, scope_kwargs) + scope = self._merge_scopes(scope, scope_kwargs) return Scope.get_client().capture_event(event=event, hint=hint, scope=scope)