Skip to content

Monitoring guide

How to monitor Heroku

Heroku runs your app on dynos behind its router. The router’s error codes and the dynos’ memory tell you most of what goes wrong.

3 min read9 sectionsUpdated

On this page

Why Heroku needs its own monitoring

Heroku’s router gives every request 30 seconds before it returns an H12 timeout, and dynos that use more memory than their size start swapping (R14) and then get killed (R15). Most Heroku incidents are one of those two, triggered by a slow query, a memory leak or a traffic spike.

Heroku shows application metrics (response time, throughput, memory, errors) on many dyno types and can alert on some of them; logs are streamed but not kept unless you add a log drain or add-on.

What typically goes wrong

  • H12 request timeouts from slow endpoints or slow database queries.
  • R14 memory quota exceeded, then crashes, from leaks or large payloads.
  • H10 app crashed after a bad deploy or missing config var.
  • Postgres connection limits reached as dynos scale up.
  • Dynos sleeping on plans that idle, making the first request slow.

What to monitor

SignalHow to measure itAlert when
Uptime of the main pages and APIHTTP check every minute from several regions, with a keyword assertionTwo regions fail in a row
Router errors (H10, H12, H13)Log drain parsed for `code=H`Any H10, or H12 over 0.5% of requests
Dyno memoryRuntime metrics in logs or metricsAbove 90% of quota
Response timeTraces from the appp95 above 2 s
Database healthPostgres metrics and slow query logConnections over 80% of the plan limit

Set it up, step by step

  1. Add a log drain. Send logs to your backend so router and runtime errors are kept and searchable.
  2. Check uptime from outside. Monitor the main pages and one API endpoint every minute.
  3. Instrument the app. Use OpenTelemetry for your language to see slow endpoints and queries.
  4. Alert on H-errors and memory. These are the early signs of the next outage.
  5. Watch add-ons. Postgres and Redis limits are reached long before Heroku itself fails.

Route alerts to the people who can act on them (Slack for warnings, a phone call for outages), and put the checks behind a status page so users see what you see.

Heroku specifics

An H12 is always a symptom: the request took too long. Find which endpoint and which query with traces, then move slow work to a background worker. See 504 Gateway Timeout for the same pattern elsewhere and Node.js memory leaks for R14 causes.

Frequently asked questions

What is a Heroku H12 error?

A request timeout: the app did not respond within 30 seconds, so the router returned an error.

What causes R14 errors?

The dyno used more memory than its size allows, usually a leak or loading too much data at once.

How long does Heroku keep logs?

Only a short buffer; add a log drain to keep them.

Check it now, free

  • Azure monitoring for applications: Monitor applications on Azure: App Service, AKS and Azure SQL metrics that matter, collecting Azure Monitor metrics with the OpenTelemetry Collector.
  • How to monitor Fly.io: How to monitor apps on Fly.io: multi-region uptime checks, machine health, the built-in Prometheus metrics, Postgres clusters, OpenTelemetry traces and alerts.
  • Redis monitoring: metrics that matter: Monitor Redis with INFO: memory and evictions, hit rate, clients, latency, persistence and replication, with thresholds and the alerts to set.
  • PHP "Allowed memory size exhausted": how to fix it: Fix PHP Fatal error: Allowed memory size exhausted. Read the error correctly, raise memory_limit for the right SAPI and stop loading big data into arrays.
  • RabbitMQ monitoring: queues, consumers and alarms: Monitor RabbitMQ: queue depth and message rates, unacknowledged messages, consumer counts, memory and disk alarms, and connection churn, with commands.
  • Service level indicators (SLIs): Save an SLI once from uptime checks, API latency or errors. See it over the last hour, day, week and month, and build SLOs and SLAs on it.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.