Browse Source

fix(sentry-sdk): Use existing scope in thread (#76624)

If the scope is forked, tags set in the forked scope will not be set on
the event started on the original scope.
Tony Xiao 6 months ago
parent
commit
71ca69dbcb
2 changed files with 6 additions and 6 deletions
  1. 2 2
      src/sentry/utils/concurrent.py
  2. 4 4
      src/sentry/utils/snuba.py

+ 2 - 2
src/sentry/utils/concurrent.py

@@ -241,8 +241,8 @@ class ThreadedExecutor(Executor[T]):
         task = PriorityTask(
         task = PriorityTask(
             priority,
             priority,
             (
             (
-                sentry_sdk.Scope.get_isolation_scope().fork(),
-                sentry_sdk.Scope.get_current_scope().fork(),
+                sentry_sdk.Scope.get_isolation_scope(),
+                sentry_sdk.Scope.get_current_scope(),
                 callable,
                 callable,
                 future,
                 future,
             ),
             ),

+ 4 - 4
src/sentry/utils/snuba.py

@@ -1097,8 +1097,8 @@ def _bulk_snuba_query(snuba_requests: Sequence[SnubaRequest]) -> ResultSet:
                     _snuba_query,
                     _snuba_query,
                     [
                     [
                         (
                         (
-                            sentry_sdk.Scope.get_isolation_scope().fork(),
-                            sentry_sdk.Scope.get_current_scope().fork(),
+                            sentry_sdk.Scope.get_isolation_scope(),
+                            sentry_sdk.Scope.get_current_scope(),
                             snuba_request,
                             snuba_request,
                         )
                         )
                         for snuba_request in snuba_requests_list
                         for snuba_request in snuba_requests_list
@@ -1110,8 +1110,8 @@ def _bulk_snuba_query(snuba_requests: Sequence[SnubaRequest]) -> ResultSet:
             query_results = [
             query_results = [
                 _snuba_query(
                 _snuba_query(
                     (
                     (
-                        sentry_sdk.Scope.get_isolation_scope().fork(),
-                        sentry_sdk.Scope.get_current_scope().fork(),
+                        sentry_sdk.Scope.get_isolation_scope(),
+                        sentry_sdk.Scope.get_current_scope(),
                         snuba_requests_list[0],
                         snuba_requests_list[0],
                     )
                     )
                 )
                 )