Ruby Language Metrics (Private Beta)
Last updated 04 May 2018
Table of Contents
To provide more visibility into the Ruby runtime, the Ruby language metrics feature surfaces additional language-specific time series metrics within Application Metrics. Ruby metrics include free and allocated heap object counts and number of free memory slots.
This feature is currently in private beta. If you would like to be flagged in, or have questions or feedback, you can reach us at firstname.lastname@example.org.
Ruby language metrics are available for all paid dynos (Hobby and above) and Private Spaces.
If your app is in JRuby, you will not be able to use these metrics as your app is running on top of the Java Virtual Machine (JVM). You will, however, be able to export and view JVM metrics. For more information, see the JVM Runtime Metrics document.
For general information on metrics display settings, please refer to the language runtime metrics parent document.
If you haven’t already, please contact us with the names of your apps to be flagged into the private beta.
You can continue with the rest of the steps, but will not see any ruby metrics in your application’s dashboard until your applications are flagged into the private beta and restarted.
Add the metrics buildpack
The next step is to add the
heroku/metrics buildpack to your application. This can be done through the CLI or the dashboard
Adding the buildpack via the CLI
To add the buildpack using the command line interface (CLI), run the following:
$ heroku buildpacks:add -i 1 heroku/metrics
Adding the buildpack via the Dashboard
From the Settings tab for your app add the buildpack like so:
Add the Barnes gem to your application
Add the barnes gem to the Gemfile:
$ bundle install
In your application code require the barnes library and start Barnes. If you’re using a forking webserver you’ll need to call start in each worker. For puma that looks like this:
require 'barnes' on_worker_boot do # worker specific setup Barnes.start end
Commit & Push
To finish up commit the changes and push to Heroku like so:
$ git add -A . $ git commit -am "Enable Heroku Ruby Metrics" $ git push heroku master
It may take a few minutes for these metrics to become available after the steps above are completed.
Heap Objects Count
Max and average allocated and freed heap object counts are displayed on a log scale, with freed shown as mirrored below the y-axis baseline. Metrics reflect the selected time interval, with the default being the most recent one.
Free Memory Slots
The Free Memory Slots plot displays the minimum, maximum and average available free memory slots for the selected time interval. The most recent interval is shown as the default.
Disabling Metrics Collection
To disable Ruby metrics collection, simply toggle off the Enhanced Language Metrics toggle via the Metrics Preferences panel, or using this CLI command:
$ heroku labs:disable "runtime-heroku-metrics" -a "my-app-name"