Skip to content

Fix 'asyncio.CancelledError' capturing for 'AioHttpIntegration' #571

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

Conversation

nikitagashkov
Copy link
Contributor

@nikitagashkov nikitagashkov commented Dec 3, 2019

This PR disables capturing of asyncio.CancelledError in AioHttpIntegration.

aiohttp will raise asyncio.CancelledError if clients interrupt request (ref.) and this behaviour is considered normal.

In the meanwhile, such aborted requests are getting captured:

Screen Shot 2019-12-03 at 5 35 35 PM

@nikitagashkov nikitagashkov force-pushed the bugfix/aiohttp-integration-cancelled-error branch from 8f76bb8 to df8850a Compare December 3, 2019 15:40
events = capture_events()
client = await aiohttp_client(app)

with suppress(ServerDisconnectedError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use pytest.raises here unless you are saying this error does not happen all the time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used suppress to avoid testing aiohttp here.

At the moment, ServerDisconnectedError is always raised, but this behavior can be changed in the future and will cause tests to fail even though sentry-python operates normally.

But, if you'd like to use pytest.raises instead, let me know :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's stick with this

Copy link
Member

@untitaker untitaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor nit left, otherwise g2g

@untitaker untitaker merged commit 029c647 into getsentry:master Dec 4, 2019
@untitaker
Copy link
Member

Thanks!

@nikitagashkov nikitagashkov deleted the bugfix/aiohttp-integration-cancelled-error branch December 4, 2019 12:48
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

Successfully merging this pull request may close these issues.

2 participants