diff --git a/celeryapp/tasks.py b/celeryapp/tasks.py index ca71f2f4c..a4a6ffe07 100644 --- a/celeryapp/tasks.py +++ b/celeryapp/tasks.py @@ -40,7 +40,17 @@ def gui_runner( is_api_call: bool = False, ): page = page_cls(request=SimpleNamespace(user=AppUser.objects.get(id=user_id))) - page.setup_sentry() + + def event_processor(event, hint): + event["request"] = { + "method": "POST", + "url": page.app_url(query_params=query_params), + "data": state, + } + return event + + page.setup_sentry(event_processor=event_processor) + sr = page.run_doc_sr(run_id, uid) sr.is_api_call = is_api_call diff --git a/daras_ai_v2/base.py b/daras_ai_v2/base.py index ecc415d6b..099ae94ec 100644 --- a/daras_ai_v2/base.py +++ b/daras_ai_v2/base.py @@ -179,12 +179,14 @@ def get_tab_url(self, tab: str) -> str: tab_name=MenuTabs.paths[tab], ) - def setup_sentry(self): + def setup_sentry(self, event_processor: typing.Callable = None): with sentry_sdk.configure_scope() as scope: scope.set_extra("base_url", self.app_url()) scope.set_transaction_name( "/" + self.slug_versions[0], source=TRANSACTION_SOURCE_ROUTE ) + if event_processor: + scope.add_event_processor(event_processor) def refresh_state(self): _, run_id, uid = extract_query_params(gooey_get_query_params())