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

Not right behaviour in case of CancelledErorr #34

Open
Mixser opened this issue Nov 21, 2022 · 0 comments
Open

Not right behaviour in case of CancelledErorr #34

Mixser opened this issue Nov 21, 2022 · 0 comments

Comments

@Mixser
Copy link

Mixser commented Nov 21, 2022

Hi,

Description

We are faced with a strange number of the 500 errors in our metrics (which are collected by aiodogstatsd.contrib.aiohttp middleware) and that number was different from what we at ALB logs. The reason for this - is that when the connection is aborted before we processed it, the CancelledError would be raised -- and it will be counted as a 500 error, but this is not true -- user will not receive any response in that case.

Expected behavior

In the case of CancelledError it would be great to have the option to separate it from other errors and have an option to skip it from the metrics

 try:
     response = await handler(request)
     response_status = response.status
 except web.HTTPException as e:
     response_status = e.status
     raise e
except CancelledError: 
      response_status = ... # some code, that will indicate that is `CancelledError`
 finally:
     if _proceed_collecting(..., collect_canceled=True/False):   # allow to mute CancelledError metric
         ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant