Skip to content

Commit

Permalink
more sentry debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Feb 29, 2024
1 parent eadda21 commit b7f1823
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion celeryapp/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion daras_ai_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit b7f1823

Please sign in to comment.