This article was contributed by the Customer Solutions Architecture team
Part of Heroku Developer Support, CSA helps Enterprise customers optimize and scale their applications on Heroku.
Monitoring Heroku Apps
Last updated 19 October 2020
Table of Contents
Monitoring will help you spot issues in advance and respond to incidents quickly. This article describes the primary monitoring tools you’ll need to monitor all aspects of your Heroku apps and instructions on how to use them most effectively.
Logging tools collect and store your Heroku app and database logs. During an incident, you can use logs to help identify what is happening and narrow down a fix. After an incident, you can refer to logs in your root cause analysis.
Set up a logging tool by installing a Heroku add-on. The Logging category includes several logging tools, with different features and retention periods, so compare the add-on’s features to your needs.
Once you’ve chosen and installed an add-on, it is a good idea to set up the following:
- Make sure you’re under the log volume quota for the logging tool and plan you selected. If you’re exceeding the quota, upgrade your plan with the provider, set up log filtering, or tune the logging settings in your app.
- Learn the search functionality of your logging tool before an incident so you can dig into issues when they occur
- Tag your app logs with request IDs so you can gather all logs for a specific request
- Set up log-based alerts for platform errors that may not show up in other tools. Start with R14/R15 memory errors and H10 app crashes.
- Consider different logging libraries for your app’s language to generate structured logs, i.e. structlog for Python
Heroku retains a small number of recent log lines, but you will need to use a tool like those covered in this section to retain and search past logs.
If you have an existing logging tool that is not a Heroku add-on, you can set up a log drain to send logs to that tool. If you use Heroku Shield, you can use Private Space Logging to drain all logs from a Space to an outside tool.
Application performance monitoring (APM)
Application Performance Monitoring (APM) tools show details about app performance, helping identify parts of your app that may be causing slowness. Use data from an APM tool to guide your performance efforts and optimize slow endpoints.
After you’ve provisioned the add-on and configured your app to use it, you can:
- Identify your slowest endpoints and look for opportunities to optimize them. Consider turning slow endpoints into background jobs or adopting a caching strategy.
- Examine request queuing time. If queue time spikes during higher traffic, check your app’s concurrency settings. See guidance for Node and Ruby apps.
- Look at performance of external services, like external API’s and databases. If an external service slows web requests, consider backgrounding the work.
Learn more about acting on insights from your APM tool.
Error monitoring tools capture exceptions or errors thrown by your app, whether they originate from your code, dependencies, or a framework. With error monitoring, you can view an error’s stack trace and drill down to its root cause. During an incident, seeing the errors your app is throwing can help you troubleshoot more quickly.
After installing an add-on, add its library to your app to capture errors. See documentation for each add-on for details.
Once you’ve installed the error monitoring tool and its library:
- Configure the tool to alert you to spikes in errors. Send those alerts to an alert management tool to page your team
- Integrate the tool with GitHub to tie new errors to specific deploys
Platform monitoring tools capture dyno metrics, Postgres metrics, Redis metrics, and router metrics from the Heroku platform, and present them in visual dashboards. You can use these tools to surface issues such as a dyno running out of memory or a rapid increase in database load.
Enable log-runtime-metrics to expose dyno-level metrics to your platform monitoring tools via your Heroku logs.
Once you have the tool installed, review and set alerts on key metrics:
- Review Heroku metrics that your chosen tool natively supports. Librato summarizes the Heroku metrics that it surfaces by default.
- Set alerts on key system metrics like memory use, dyno load, web response time, and error rate
See Monitoring Heroku Postgres for tips on using a platform monitoring tool to monitor your database.
Heroku threshold alerting
Heroku threshold alerting notifies you when error rate or response time gets too high. Generally, Heroku recommends response times of 500ms or less. Threshold alerting provides near-real-time notice of a performance issue, so you can resolve it before it causes downtime.
Set up threshold alerting for an app by enabling it in the Heroku Dashboard.
When setting up threshold alerting:
- Set response time threshold and sensitivity low enough to catch issues in their early stages, but high enough to avoid false alarms
- Send alerts to an alert management tool via the tool’s e-mail integration, to page your team if there is an issue. If you don’t have an alert monitoring tool, send alerts to a team-wide distribution list.
Uptime monitoring tools measure your app’s availability from an end user’s perspective. These tools may detect issues that other tools can’t, like an invalid DNS record, CDN issue, or slow response times in a certain region.
When using an uptime monitoring tool:
- Configure the tool to check app availability from different regions
- Use your publicly-facing URL to ensure the uptime check catches DNS or CDN issues
- Integrate with an alert management tool to page your team if there is an issue
Heroku notifications for apps and databases
Heroku sends e-mail notifications for certain app and database events, including:
- Heroku Postgres, Heroku Redis, and Apache Kafka on Heroku notifications including upcoming maintenance and maintenance status
- End of life for a Heroku Stack used by the app
- Heroku Connect errors that need user intervention
You will receive notifications via e-mail if you are a collaborator on an app or admin on the team containing the app. To manage Heroku Connect alerts, go to
Settings -> Manage Connection -> Access in the Connect dashboard.
Non-urgent notifications are easy to ignore and forget. Ensure that you read the emails and follow their instructions.
Heroku Status provides updates on platform incidents and maintenance events. Maintenance alerts allow your team to prepare in advance. Incident alerts inform your team of issues that may impact your app, database, or Heroku tooling.
Subscribe to Heroku Status alerts to receive an e-mail or SMS notification when they occur.
When setting up status notifications:
- Send critical incidents to an alert management tool, using the alert management tool’s e-mail integration. Choose “Critical incidents only” to page your team only when the incident could directly impact your production app
- Send status notifications to a team distribution list, so all team members are in the loop
Alert management tools notify your team of alerts from your monitoring tools.
You can choose who is “on call” to receive alerts and choose who else to notify if that person is unavailable.
Once you’ve set up a tool:
- Send alerts from your monitoring tools to the alert management tool, using a pre-built integration or e-mail
- Set up an alerting policy for your team, specifying who gets notified when
- Make sure your alerting policy includes backup team members to respond if the primary team member is unavailable
Database performance impacts app performance. See guidance for monitoring your Heroku Postgres database.