diff --git a/sentry/interceptor.py b/sentry/interceptor.py index d016acef..98877091 100644 --- a/sentry/interceptor.py +++ b/sentry/interceptor.py @@ -13,6 +13,7 @@ ) with workflow.unsafe.imports_passed_through(): + import asyncio import sentry_sdk @@ -43,7 +44,7 @@ async def execute_activity(self, input: ExecuteActivityInput) -> Any: if is_dataclass(arg) and not isinstance(arg, type): scope.set_context("temporal.activity.input", asdict(arg)) scope.set_context("temporal.activity.info", activity.info().__dict__) - scope.capture_exception() + await asyncio.to_thread(scope.capture_exception, e) raise e @@ -71,7 +72,7 @@ async def execute_workflow(self, input: ExecuteWorkflowInput) -> Any: scope.set_context("temporal.workflow.info", workflow.info().__dict__) if not workflow.unsafe.is_replaying(): with workflow.unsafe.sandbox_unrestricted(): - scope.capture_exception() + await asyncio.to_thread(scope.capture_exception, e) raise e