Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please allow an option for asynchronous calls to capture_exception #1735

Open
mlockett42 opened this issue Nov 11, 2022 · 1 comment
Open
Labels
Enhancement New feature or request Triaged Has been looked at recently during old issue triage

Comments

@mlockett42
Copy link

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.

@antonpirker
Copy link
Member

Hey @mlockett42
That's a really good suggestion. We need to make the SDK support more async processing, to fully support all the async Python projects out there. I put this on our back log. (But please do not hold your breath on it, because we have a lot on our plates right now.)

@antonpirker antonpirker added the Triaged Has been looked at recently during old issue triage label Jan 29, 2024
@sentrivana sentrivana added this to the Better async support milestone Mar 18, 2024
@antonpirker antonpirker removed this from the Better async support milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Triaged Has been looked at recently during old issue triage
Projects
None yet
Development

No branches or pull requests

4 participants