I don’t know of an easier way to deploy a Django app than letting Heroku do the work. That said, how do you stay on top of your app’s performance, errors, and stability post-launch? Running an app on Heroku is a blissful experience, but it presents some monitoring challenges that aren’t present when you control the hardware.
In this post, I’ll walk through a free-to-start, low-effort approach that gives you great visibility of the health of your Django app on Heroku. All of the services below either
Focus | Service |
---|---|
Uptime | Uptime Robot |
Application Performance Monitoring | Scout |
Logging | |
Exception Monitoring | Rollbar |
Custom Metrics | HostedGraphite |
Resource usage | Heroku Application Metrics |
Monitoring coverage areas
- Uptime – is the app reachable from around the globe?
- Application Performance Monitoring – when performance goes bad, dive to
the the line-of-code causing the issue. - Logging – view your application and Heroku logs.
- Exception Monitoring – aggregate, view, and close exceptions.
- Custom Metrics – track key performance indicators that are specific to your app.
- Resource usage – track memory usage and CPU load.
I’ll cover each area in detail below.
Uptime
Is my Django app up? Whether you are hosting a personal blog or on the stability team for Netflix, you need this. I don’t believe there is a free Heroku
Application Performance Monitoring
When it comes to tracking down performance issues, application performance monitoring (APM) gives the most value with the least effort. These services have libraries that trace the execution of your code, SQL queries, external HTTP requests and more, pointing to the line-of-code when there is a performance problem. Adding this instrumentation yourself would be painful.
The Scout Heroku Addon is an easy-to-configure APM option for Django apps. Once the addon is provisioned and scout-apm
Logging
Heroku’s log history only goes back 1500 lines, which could just be a couple of seconds of logs for a production Django app. This means you have to send your log stream somewhere for meaningful data retention and querying.
Exception Monitoring
Exception Monitoring tools make it easy to track exceptions down to a line-of-code, saving you valuable development time hunting down bugs. They also aggregate similar errors together to decrease noise when things are going wrong.
Rollbar is an easy-to-configure, reliable option for monitoring Django exceptions. Scout also integrates with Rollbar, giving you a single pane of glass for both performance and errors.
Custom Metrics
Your app has personal indicators that indicate its health (and the health of your business). For example, a shopping cart app may track the number of times an item has been added to its cart.
If you aren’t on Heroku, StatsD is a great generic option. While it is possible to configure StatsD on Heroku, it is involved. A simpler option for custom metrics is HostedGraphite.
Resource Usage
There’s no need to use another service to monitor basic metrics like memory usage and CPU load. If you are using Hobby dynos or higher, you get high-level resource usage metrics and alerting for free within your Heroku dashboard. Just enable application metrics.
doug+scoutapp@scripted.com