-
Notifications
You must be signed in to change notification settings - Fork 571
Closed
Labels
Description
Problem Statement
The ai_track decorator currently only works for synchronous functions. If you do something like this:
@ai_track("My async AI pipeline")
async def trigger_ai_async(request):
with sentry_sdk.start_transaction(
op="ai-inference", name="The result of the async AI inference"
):
return HttpResponse(b"Hello, world. You're at the metrics trigger.")You get the following error:
ValueError: The view mysite.urls.trigger_ai_async didn't return an HttpResponse object. It returned an unawaited coroutine instead. You may need to add an 'await' into your view.
Solution Brainstorm
We should update the ai_track to support sync and async functions/coroutines like the trace decorator does:
https://github.com/getsentry/sentry-python/blob/potel-base/sentry_sdk/tracing.py#L1248-L1274
Metadata
Metadata
Assignees
Labels
Projects
Status
No status