Morepath

Installing Airbrake in a Morepath application

Morepath

The pybrake package makes it quick and easy to monitor your Morepath app’s performance. It only takes a few minutes to start collecting real performance data so let’s jump right in!

Key Features

  • Support for Airbrake Performance Monitoring
  • Simple to install and configure
  • Add extra context to errors before they are sent
  • Set error severity and control notification thresholds

Installation & Configuration

Set up the Pybrake’s middleware and project config for your web application

Step 1: Install the latest version of pybrake

Airbrake for Morepath uses our official Python notifier pybrake. To install run:

pip install -U pybrake

Step 2: Configure the Airbrake Morepath middleware

First, import the Morepath middleware from the pybrake package

from pybrake.middleware.morepath import init_app
"""
The pybrake provides middleware for error notification and APM.

:param app: Required the application instance to register error notifier and 
            APM to Morepath application, example as below one.
:param sqlEngine: SQLALCHEMY engine instance if you want to monitor query 
                    stats, default value will be None
"""

Next, configure pybrake parameters and register middleware into your application before application run

App.init_settings({
    "PYBRAKE": {
        "project_id": 99999,
        "project_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    }
})
morepath.commit(App)
app = App()
app = init_app(app, engine)

Now you are ready to start reporting errors and performance monitoring to Airbrake from your Morepath app. Please look into sample example to get more idea.


Additional Settings

Please visit our Pybrake overview for details on useful features like:


Troubleshoot

If you have any questions or concerns, please address them here.