getsentry / getsentry/sentry-python

Please allow an option for asynchronous calls to capture_exception

Đang mở
#1,735 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Errors Feature Python
Ngôn ngữ chính
Python
Star
2.2k
Fork
669
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
213

Mô tả

### Problem Statement

I have an asynchronous Python app which continual polls various rest api's with httpx

Something like
```
try:
async with httpx.AsyncClient() as client:
result = await client.post(url)
# Do some processing on result
except Exception as exc:
capture_exception(exc)
logger.error("There was an error exc = {0}".format(exc))
```

Because my application is async and busy (polling lot's of APIs and getting data) the synchronous capture_exception call causes an issue because it blocks the applications only thread. This is made worse by the fact that an rest api may start returning errors on every call causing capture_exception to block a lot of things.

### Solution Brainstorm

If there was an async version of capture_exception that would make life much better

eg
```
try:
async with httpx.AsyncClient() as client:
result = await client.post(url)
# Do some processing on result
except Exception as exc:
await capture_exception_async(exc)
logger.error("There was an error exc = {0}".format(exc))
```
While capture_exception_async other asynchronous tasks can still run. Is wasn't able to find anything on this by Googling so I assume it just does not exist at the moment.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.