AIOHTTP

(New in version : 0.6.1 )

Import name: sentry_sdk.integrations.aiohttp.AioHttpIntegration

The AIOHTTP integration adds support for the AIOHTTP-Server Web Framework. A Python version of 3.7 or greater is required.

  1. Install sentry-sdk from PyPI:

     $ pip install --upgrade 'sentry-sdk==0.7.2'
    
  2. Initialize the SDK before starting the server:

    import sentry_sdk
    from sentry_sdk.integrations.aiohttp import AioHttpIntegration
        
    sentry_sdk.init(
        dsn="___PUBLIC_DSN___",
        integrations=[AioHttpIntegration()]
    )
    
    from aiohttp import web
    
    async def hello(request):
        return web.Response(text="Hello, world")
    
        app = web.Application()
    app.add_routes([web.get('/', hello)])
    
    web.run_app(app)
    

Behavior

  • The Sentry Python SDK will install the AIOHTTP integration for all of your apps.

  • All exceptions leading to an Internal Server Error are reported.

  • The AIOHTTP integration currently does not attach the request body. See the relevant GitHub issue.

  • Logging with any logger will create breadcrumbs when the Logging integration is enabled (done by default).

In this guide