From 77e3b227cc356ea2f5b067df70602bce03fccce8 Mon Sep 17 00:00:00 2001 From: Simon Gurcke Date: Wed, 14 Aug 2024 12:19:49 +1000 Subject: [PATCH] Fix capture of last_event_id from Sentry SDK --- apitally/client/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apitally/client/base.py b/apitally/client/base.py index dcae22d..7a3bc6b 100644 --- a/apitally/client/base.py +++ b/apitally/client/base.py @@ -268,20 +268,20 @@ def capture_sentry_event_id(self, server_error: ServerError) -> None: from sentry_sdk.scope import Scope except ImportError: return # pragma: no cover - if not hasattr(Scope, "get_isolation_scope") or not hasattr(Scope, "last_event_id"): + if not hasattr(Scope, "get_isolation_scope") or not hasattr(Scope, "_last_event_id"): # sentry-sdk < 2.2.0 is not supported return # pragma: no cover if Hub.current.client is None: return # sentry-sdk not initialized scope = Scope.get_isolation_scope() - if event_id := scope.last_event_id(): + if event_id := scope._last_event_id: self.sentry_event_ids[server_error] = event_id return async def _wait_for_sentry_event_id(scope: Scope) -> None: i = 0 - while not (event_id := scope.last_event_id()) and i < 100: + while not (event_id := scope._last_event_id) and i < 100: i += 1 await asyncio.sleep(0.001) if event_id: