Hosted Graphite provides a Heroku add-on! Installing the add-on is as simple as issuing the command:

$ heroku addons:add hostedgraphite
-----> Adding hostedgraphite to sharp-mountain-4005... done, v1


Once installed, this add-on will make a new application configuration key available, called HOSTEDGRAPHITE_APIKEY. Confirm the key by issuing the command:

$ heroku config:get HOSTEDGRAPHITE_APIKEY


In your local development environment, it will be necessary to replicate this configuration. Since the Foreman tool will look in the .env file for development environment variables, use the following command to copy HOSTEDGRAPHITE_APIKEY from the heroku config (Do not check the file .env into source control).

$ heroku config -s | grep HOSTEDGRAPHITE_APIKEY >> .env
$ more .env

Automated Dashboards


 Automated Heroku Dashboards


Using Heroku’s log-runtime-metrics we retrieve and process Heroku’s syslog information for your Dynos including:

  • Load average - 1 / 5 / 15 minute averages
  • Memory and Swap - Resident memory, disk cache, swap, total memory, and cumulative totals for pages written to and read from disk.
  • HTTP metrics - The number of requests broken down by HTTP method and status codes, data transferred, and connect and service times.

The following commands will configure the Heroku drains to send metrics into your Hosted Graphite account (the app-name will be included in the metric prefix):

heroku labs:enable log-runtime-metrics -a <app-name>
heroku restart -a <app-name>
heroku drains:add<app-name>/logs/\?apikey=<api_key> -a <app-name>


This prevents individual dyno metric duplication and stores them in the format:


Sending Custom Metrics

That’s it! You can now begin to send metric messages to Hosted Graphite from your Heroku app. For full documentation on our Heroku plugin, please visit the Hosted Graphite on Heroku documentation page.


Accessing the API Key within your app

Now that the add-on has been setup, the Hosted Graphite API Key will be available via the environment variable HOSTEDGRAPHITE_APIKEY. See the appropriate language snippet below for an example on how to access this variable in your app.



See also: Sending Metrics with Ruby



apikey = os.environ['HOSTEDGRAPHITE_APIKEY']

See also: Sending Metrics with Python



String apikey = System.getenv("HOSTEDGRAPHITE_APIKEY");

See also: Sending Metrics with Java



$apikey = getenv('HOSTEDGRAPHITE_APIKEY');

See also: Sending Metrics with PHP



var apikey = process.env.HOSTEDGRAPHITE_APIKEY;

See also: Sending Metrics with Node.js



  • If I have trouble with my metrics, should I remove and re-add the Hosted Graphite plugin?
    No! Removing the Hosted Graphite plugin permanently deletes your metrics from Hosted Graphite. If you’re having trouble and can’t find help in these docs or our FAQ, then just get in touch. We’re happy to help.