We can monitor the resource usage of our dynos from the command line using the log-runtime-metrics
plugin. This will give us visibility into the CPU and memory usage of our dynos. With this data, we'll be able to determine if our dynos are correctly sized, detect problems earlier, and determine whether we need to scale our application.
Let's open up a terminal; we'll be completing this recipe with the CLI by performing the following steps:
First, we'll need to install the
log-runtime-metrics
plugin via the CLI. We can do this easily throughheroku labs
:$ heroku labs:enable log-runtime-metrics
Now that the runtime metrics plugin is installed, we'll need to restart our dynos for it to take effect:
$ heroku restart
Now that the plugin is installed and running, our dynos' resource usage will be printed to our logs. Let's view them now:
$ heroku logs heroku[web.1]: source=web.1 dyno=heroku.21 sample#load_avg_1m=0.00 sample#load_avg_5m=0.00...