Heroku Exec and Language Runtime Metrics GA: Runtime Debugging on Heroku

We’ve all been there — you push your code to production and a leak causes memory usage to grow out of control. To determine the root cause of the problem, you need to be able to monitor, inspect, and debug the production application, collecting detailed data at runtime.

Today we’re making it even easier to debug your applications on Heroku, with the general availability of Language Runtime Metrics, starting with JVM languages, and Heroku Exec. Language metrics surfaces key indicators of an issue, like garbage collection activity, and heap and non-heap memory usage, on a unified timeline in the Heroku Dashboard.

After you’ve identified an issue, you can use Exec to connect to a dyno at runtime, via SSH, for further inspection and remote debugging. When combined with Application Metrics, Language Runtime Metrics and Exec provide a robust set of tools for maintaining production application health.

Runtime Inspection with


SSH to the Dyno

When a problem arises, and you need to collect data at runtime, you can connect to a dyno via SSH with Exec:

$ heroku ps:exec
Establishing credentials... done
Connecting to web.1 on ⬢ ns-pipeline-staging... 
~ $ top

Unlike heroku run bash, which creates a one-off dyno, Exec makes an SSH connection directly to an existing dyno (e.g., web.2). Exec also allows you to copy files off of a dyno, forward traffic on a local port to a dyno, and take advantage of common Java debugging tools.

Connecting a Remote Debugger & Java Tools

While top and ps are great for debugging memory issues, sometimes you need to connect a remote debugger, such as Eclipse, IntelliJ or WebStorm, and step through code. With Exec, you can forward traffic from a local port to a dyno, enabling you to connect your remote debugger.

$ heroku ps:forward 5858

To see an example, check out the video above.

For Java applications, you can use JVM-specific commands to emit jmap and jstack dumps. Exec also offers the ability to connect JConsole and VisualVM to an application with one command.

Monitoring Production Applications with Language Runtime Metrics

Language metrics are displayed within the Application Metrics dashboard so you can easily correlate language runtime health to overall application health.


Language runtime metrics uses the prometheus agent, which provides a lightweight method for gathering data. The additional metrics collection has minimal impact on application performance. The initial release supports JVM languages, with additional languages in progress.

We’d Love Your Feedback

Exec and Language Runtime Metrics are now generally available and we have plans to extend our language-specific metrics and tools support beyond Java. If you have feedback on either product, or want to share tools you would like us to support in the future, please let us know!

Leave a Reply

Your email address will not be published. Required fields are marked *