Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Visit the Heroku Blog

    Find news and updates from Heroku in the blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Model Context Protocol
    • Vector Database
    • Heroku Inference
      • Inference Essentials
      • AI Models
      • Inference API
      • Quick Start Guides
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Add-ons
  • All Add-ons
  • Hosted Graphite
Hosted Graphite

This add-on is operated by Hosted Graphite

Application, System, and Infrastructure monitoring via Graphite and Grafana

Hosted Graphite

Last updated June 28, 2024

Table of Contents

  • Why use Graphite?
  • Message format
  • Provisioning the add-on
  • Heroku Auto-Dashboard
  • Heroku-Postgres Metrics
  • Using Hosted Graphite with various languages
  • Using with Ruby
  • Using with Python
  • Using with PHP
  • Using with Java
  • Using with Node.js
  • Dashboards
  • Troubleshooting
  • Migrating between plans
  • Removing the add-on
  • Support
  • Additional resources

Hosted Graphite is an add-on for providing application performance metrics.

Hosted Graphite Add-On

Graphite is one of the most widely-used and well-tested metric platforms, used by small developers and large companies alike. Hosted Graphite has improved upon standard Graphite and offers aggregation, alerting, data storage, team access, and additional integrations and features that provide customers with a robust and well-rounded monitoring solution.

Additionally, Hosted Graphite supports sending custom metrics from any programming language, has deployable agents that will return system metrics from your running servers/instances, and has integrations with many popular technologies like AWS, Azure, and GCP that allow you to monitor multiple services under a single pane of glass.

Why use Graphite?

Graphite is excellent for measuring large amounts of time-series data, in a situation where you might not necessarily know what’s important. It’s a versatile system that allows you to measure thousands of metrics concurrently, and then combine, manipulate, and transform the data into meaningful graphs. Some good examples might be to measure performance data from hundreds of servers, perhaps grouping some of your data by whether the machine is in production or just a development machine. It also allows you to time specific blocks, functions, or functional areas of your code to find performance bottlenecks and tweak ‘em.

Hosted Graphite by MetricFire takes away the burden of self-hosting your own monitoring solution, allowing you more time and freedom to work on your most important tasks. You can measure, analyze, and visualize large amounts of data from your applications and infrastructure without the hassles of setting up your own servers, worrying about scaling, storing data, alerting, or maintenance. Hosted Graphite also has many supported APIs, integrations, and plugins that can help you get data in, and return it in a way that is useful for you. Anytime you have questions about our product and services, our knowledgeable support team will respond quickly and give you useful advice.

Message format

Hosted Graphite messages are sent in the following format:

apikey.metric.path value timestamp

Where: - 'apikey’ is your Hosted Graphite API key - ‘metric.path’ is the name of the metrics you want to track, dot separated (e.g. ‘request.time’) - ‘value’ is the data you want to send. We accept numeric data only, numeral or decimal - ‘timestamp’ is optional and if left unspecified, Graphite will fix a unix timestamp to your data at the point of ingestion

Provisioning the add-on

Hosted Graphite can be attached to a Heroku application via the CLI:

A list of all plans available can be found here.

$ heroku addons:create hostedgraphite -a <app-name>
-----> Adding hostedgraphite to sharp-mountain-4005... done, v18 (free)

The default plan is ‘Intro’, and once the Hosted Graphite Add-On has been added, a HOSTEDGRAPHITE_APIKEY setting will be available in the app configuration, which contains your Hosted Graphite API Key used to send metric data to the service. This can be confirmed using the heroku config:get command.

$ heroku config:get HOSTEDGRAPHITE_APIKEY -a <app-name>
deadbeef-dead-beef-fade-feedbeefdead

After installing the Hosted Graphite add-on, your application’s log drains will be forwarded to your Hosted Graphite account and your app’s dyno/router data will be displayed on an automatically created Grafana dashboard named ‘Heroku’. Make sure that log-runtime metrics are enabled for your Heroku app:

$ heroku labs:enable log-runtime-metrics -a <app-name>
$ heroku restart -a <app-name>

Environment setup

After provisioning the add-on it may be necessary to locally replicate the config vars so your development environment can operate against the service.

Though less portable it’s also possible to set local environment variables using export HOSTEDGRAPHITE_APIKEY=value.

Use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a .env file. To view all of your app’s config vars, type heroku config. Use the following command to add the HOSTEDGRAPHITE_APIKEY values retrieved from heroku config to your .env file.

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

Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env file with: echo .env >> .gitignore.

Heroku Auto-Dashboard

A Heroku Dashboard will be automatically created when you enable the Heroku Add-On, or configure Log-Drain metrics to your Hosted Graphite account:

Hosted Graphite Heroku Dashboard

Using Heroku’s Log-Runtime and Drain metrics, we retrieve and process Heroku’s syslog information for your Dynos including:

CPU Load average - 1/5/15-minute averages

Memory and Swap - Resident memory, disk cache, swap, total memory, and cumulative totals for pages written to/read from disk.

HTTP Router metrics - The number of requests broken down by HTTP method and status codes, data transferred, and connect/service times.

Heroku-Postgres Metrics

If you use the Postgres add-on in your Heroku app at the standard or premium plan level, these metrics will also be automatically forwarded to your Hosted Graphite account. They are prefixed with: heroku.{name-of-app}.heroku-postgres.{instance-name} and report dyno (server) metrics for CPU load and memory. Additionally, you will receive more specific db (database) metrics such as size, tables, active/waiting-connections, tmp-disk-available/used, read/write-iops, and more!

Additionally, Hosted Graphite provides a Heroku Postgres dashboard that is available in the Dashboard Library, and can be generated with the click of a button!

Heroku Postgres Dashboard

Hosted Graphite will also collect metrics automatically from your App’s Heroku Redis and Heroku Kafka Add-Ons!

Using Hosted Graphite with various languages

In the following code snippets, the HOSTEDGRAPHITE_APIKEY is automatically pulled from the local environment, and refers to the value returned from the heroku config:get HOSTEDGRAPHITE_APIKEY command listed in the provisioning section.

Calculations such as summing or averaging data can be configured on the graph via the Hosted Graphite dashboard.

Data can be sent to Hosted Graphite using both TCP and UDP methods. In these examples the code sends a hypothetical measurement of a web request which took 1444ms. The value sent is numeric, and doesn’t require that you give a specific type measurement. See the Hosted Graphite Language Guide for more details.

TCP Connection

If you’re sending very low volumes of data and are adamant that every single packet needs to be received and measured, TCP is the way to go. There is a slightly larger overhead than UDP due to the nature of the connection, but still should not have any noticeable impact on your application. However, for 99% of users, UDP is the most appropriate option. Send a test metric via TCP through your terminal using the netcat utility:

$ echo "YOUR-API-KEY.test.testing 1.2" | nc carbon.hostedgraphite.com 2003

UDP Connection

If you’re sending any volume of metric data, UDP is preferred due to it’s low overhead, and asynchronous data transmission. With UDP there is a small chance that some packets never arrive at the destination, but in practice very little is lost - certainly not enough that would have any measurable impact on your graphs. Send a test metric via UDP through your terminal using the netcat utility:

$ echo "YOUR-API-KEY.test.udp.metric 1.2" | nc -uw0 carbon.hostedgraphite.com 2003

HTTP Connection

Make a POST for your metrics to the following URL: https://www.hostedgraphite.com/api/v1/sink Here’s an example using curl on linux, which lets you provide the API key in the URL:

$ curl https://YOUR-API-KEY@www.hostedgraphite.com/api/v1/sink --data-binary "test.http.metric 1.2"

StatsD Connection

StatsD is commonly used as a pre-aggregation service and sends metrics via UDP by default. First, you need to enable StatsD in your account through Add-Ons => Hosted StatsD. The following simple example shows how to send a single counter metric to Hosted Graphite’s StatsD endpoint using the netcat utility:

$ echo "YOUR-API-KEY.test.statsd.metric:1.2|c" | nc -u -w1 statsd.hostedgraphite.com 8125

Using with Ruby

TCP Connection

require 'socket'

apikey = ENV['HOSTEDGRAPHITE_APIKEY']
conn   = TCPSocket.new 'carbon.hostedgraphite.com', 2003
conn.puts apikey + ".request.time 1444\n"
conn.close

UDP Connection

require 'socket'

apikey = ENV['HOSTEDGRAPHITE_APIKEY']
sock   = UDPSocket.new
sock.send apikey + ".request.time 1444\n", 0, "carbon.hostedgraphite.com", 2003

Using with Python

TCP Connection

import socket
import os

apikey = os.environ['HOSTEDGRAPHITE_APIKEY']
conn   = socket.create_connection(("carbon.hostedgraphite.com", 2003))
conn.send("%s.request.time 1444\n" % apikey)
conn.close()

UDP Connection

import socket
import os

apikey = os.environ['HOSTEDGRAPHITE_APIKEY']
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto("%s.request.time 1444\n" % apikey, ("carbon.hostedgraphite.com", 2003))

Using with PHP

TCP Connection

<?
$apikey = getenv('HOSTEDGRAPHITE_APIKEY');
$conn   = fsockopen("carbon.hostedgraphite.com", 2003);
fwrite($conn, $apikey . ".request.time 1444\n");
fclose($conn);
?>

UDP Connection

<?
$apikey  = getenv('HOSTEDGRAPHITE_APIKEY');
$sock    = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$message = $apikey . ".request.time 1444\n";
socket_sendto($sock, $message, strlen($message), 0, "carbon.hostedgraphite.com", 2003);
?>

Using with Java

TCP Connection

String apikey = System.getenv("HOSTEDGRAPHITE_APIKEY");
Socket conn   = new Socket("carbon.hostedgraphite.com", 2003);
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
dos.writeBytes(apikey + ".request.time 1444\n");
conn.close();

UDP Connection

String apikey         = System.getenv("HOSTEDGRAPHITE_APIKEY");
DatagramSocket sock   = new DatagramSocket();
InetAddress addr      = InetAddress.getByName("carbon.hostedgraphite.com");
byte[] message        = apikey + ".request.time 1444\n".getBytes()
DatagramPacket packet = new DatagramPacket(message, message.length, addr, 2003);
sock.send(packet);
sock.close();

Using with Node.js

TCP Connection

var net    = require('net');
var apikey = process.env.HOSTEDGRAPHITE_APIKEY;

var socket = net.createConnection(2003, "carbon.hostedgraphite.com", function() {
   socket.write(apikey + ".request.time 1444\n');
   socket.end();
});

UDP Connection

var dgram  = require('dgram');
var apikey = process.env.HOSTEDGRAPHITE_APIKEY;

var message = new Buffer(apikey + ".request.time 1444\n");
var client = dgram.createSocket("udp4");
client.send(message, 0, message.length, 2003, "carbon.hostedgraphite.com", function(err, bytes) {
    client.close();
});

Dashboards

For full details on the Heroku, Grafana, and Graphite features available within the Hosted Graphite Add-On please see the docs at https://docs.hostedgraphite.com/.

The Hosted Graphite dashboards allow you to view all of your created metrics, and create highly customizable graphs to display your data.

The Hosted Graphite account and dashboards can be accessed via the CLI:

$ heroku addons:open hostedgraphite
Opening hostedgraphite for sharp-mountain-4005...

or by visiting the Heroku Dashboard and selecting the application in question. Select Hosted Graphite from the Add-ons menu in the Resources tab:

Hosted Graphite Account

Then simply navigate to Primary Dashboards from the Hosted Graphite landing page, and it will open the hosted Grafana portion of the add-on:

Hosted Grafana

From here you can create new dashboards and panels to display your metric data:

Create dashboards

Troubleshooting

Reference the Hosted Graphite Heroku docs for more details and troubleshooting steps. If the docs are unable to provide the answers you need, you can reach out to Hosted Graphite support through the in-app chat feature.

Migrating between plans

Application owners should carefully manage the migration timing to ensure proper application function during the migration process.

Use the ‘heroku addons:upgrade’ command to migrate to a new plan.

$ heroku addons:upgrade hostedgraphite:newplan -a <app-name>
-----> Upgrading hostedgraphite:newplan to sharp-mountain-4005... done, v18 ($49/mo)
       Your plan has been updated to: hostedgraphite:newplan

Removing the add-on

Hosted Graphite can be removed via the CLI.

This will destroy all associated data and cannot be undone!

$ heroku addons:destroy hostedgraphite -a <app-name>
-----> Removing hostedgraphite from sharp-mountain-4005... done, v20 (free)

Support

Hosted Graphite support can be submitted via one of the Heroku Support channels. You can also contact the Hosted Graphite team directly by starting a new conversation through the in-app chat feature. Any non-support related issues or product feedback is welcome - just mail us at sales@hostedgraphite.com.

Additional resources

Additional resources and information are available at:

  • Hosted Graphite docs
  • MetricFire

Keep reading

  • All Add-ons

Feedback

Log in to submit feedback.

Zara 4 HostedHooks

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices