Free, Automatic Twisted Error Reporting
When you have a Twisted server running somewhere in the cloud, there really aren’t that many options for automatic notifications when there’s an error. If you’re using Rails, then there are a number of options to do this sort of thing (New Relic, Airbrake, etc). Many of these will work for WSGI applications, but there isn’t much in the way of automatic error reporting for Python otherwise.
I’ve gotten used to using Airbrake with Rails, so I wanted to figure out how to integrate a Python application with it. It turns out, there’s been at least one attempt, but it’s synchronous (which could potentially stall a Twisted application if it can’t make a connection to the Airbrake server).
Enter txairbrake. It’s written specifically for Twisted applications and is non-blocking (using
twisted.web.client.getPage). It’s also dead simple to use:
Any uncaught exceptions will then be reported to the Airbrake server, where you can set up email notifications.
Additionally, if you’re tight on cash and don’t want to shell out tons of money to Airbrake, consider setting up Errbit instead. It’s free, Airbrake API compliant, and you can run it for free on Heroku. If you go this route,
just pass a new constructor argument of
airbrakeHost to the
AirbrakeLogObserver with the location of your Errbit server.
There, now you have free, automatic error reporting from within a Twisted application.