Pyramid

(New in version 0.5.0 )

Import name: sentry_sdk.integrations.pyramid.PyramidIntegration

The Pyramid integration adds support for the Pyramid Web Framework.

  1. Install sentry-sdk from PyPI:

     $ pip install --upgrade sentry-sdk==0.5.5
    
  2. To configure the SDK, initialize it with the integration before or after your app has been created:

     import sentry_sdk
    
     from sentry_sdk.integrations.pyramid import PyramidIntegration
    
     sentry_sdk.init(
         dsn="___PUBLIC_DSN___",
         integrations=[PyramidIntegration()]
     )
    
     from pyramid.config import Configurator
    
     with Configurator() as config:
         ...
    

Behavior

  • The Pyramid integration will be installed for all of your apps. It hooks into Pyramid itself, not any of your apps specifically.

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

  • Request data is attached to all events: HTTP method, URL, headers, formdata, JSON payloads. Raw bodies and multipart file uploads are excluded. Personally identifiable information (such as user ids, usernames, cookies, authorization headers, ip addresses) is excluded unless send_default_pii is set to True.

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

Options

The following keyword arguments can be passed to PyramidIntegration():

  • transaction_style:

    config.add_route("myroute", "/myurl/{id}")
    config.add_view(myfunction, route_name="myroute")
    

    In the above code, the transaction would be set to:

    • /myurl/{id} if you set transaction_style="route_pattern"
    • myroute if you set transaction_style="route_name"

    The default is "route_name".

In this guide