Heroku Monitoring - Everything You Need To Know

November 16, 2020

Heroku Monitoring with Hosted Graphite

Hosted Graphite is a full-scale framework that provides infrastructure and application management using a suite of open-source monitoring software. The platform helps you use either Prometheus- or Graphite-as-a-Service and have your stats shown on aesthetically-pleasing Grafana dashboards.

Hosted Graphite runs a Heroku addon that does your Heroku monitoring directly in the Heroku platform. Check out the HG Heroku monitoring tool here. You can install HG in your Heroku app, and get automatic dashboards for the most important Heroku KPI. Check out our automatic Heroku dashboards here:

Image of Hosted Graphite's auto generated Heroku Dashboard.

To try out the HG Heroku Monitoring tool, get on to the listing and install the addon. You can speak to our support team directly in-app through the intercom chat!

Heroku monitoring with Hosted Graphite

Today, you have a few tools to choose from in the Heroku addon marketplace. HG Heroku Monitoring brings the flexibility of hosted open source tools to Heroku. HG Heroku Monitoring is a platform built on the open source Prometheus, Graphite, and Grafana - so regardless of what you’re trying to monitor, you can easily pull it into your HG Heroku Monitoring dashboard. 

The platform is great for monitoring your Heroku app directly, but you can also pull in data sources from outside of Heroku, such as AWS. You can monitor infrastructure, application, systems and business metrics directly from within your HG Heroku Monitoring dashboard.

Here’s an example of a Heroku dashboard built with HG Heroku Monitoring:

A screenshot of Hosted Graphite's dashboards with sample panels


How do I get started?

The Heroku Listing

The easiest way to get started is to install the HG Heroku Monitoring tool directly from the Heroku marketplace. It’s as easy as one click between you and your new dashboards:

Screenshot of Hosted Graphite in Heroku's add on page


From the Hosted Graphite Website

You can also install the Heroku add-on through the Hosted Graphite app, on the Hosted Graphite website. Get into the Hosted Graphite 14-day free trial here, and start monitoring your Heroku app immediately.


Once you're in the app, go into the add-ons section. In the add-ons section, you can see the Heroku add-on:

Screenshot of Hosted Graphite's add on page


To run your Heroku monitoring, grab the API key from your HG add ons page:

Image of Hosted Graphite's API key through the add on tab


Read the instructions on the page to see how to apply your API key.

Monitoring a basic application

We’ve built a simple app called “metricfire_demo”. We’re going to monitor “metricfire_demo” using the Heroku add-on from the Hosted Graphite app

Applying the API key from the previous section, the picture below shows the performance:

Screenshot of terminal being used to apply API key


Next to our Heroku environment variables, we need to add our API key. Execute the configuration Heroku set HOSTEDGRAPHITE APIKEY = YOUR API KEY.

$ heroku drains: add https://webhooks.hostedgraphite.com/heroku/metricfire-demo/logs/?apikey = YOUR API KEY


You may also search the picture below for the output of the HOSTEDGRAPHITE APIKEY

Screenshot of Hosted Graphite's API key output being displayed


Our app can now submit metrics to our Hosted Graphite account. Let's confirm the Metric Treemap metrics. We go to Metrics > Metric Treemap from our dashboard, as in the picture below.


Screenshot of Hosted Graphite's Metric Treemap in Metrics tab


We can see that the Treemap has a Heroku portion, meaning that our Heroku addition works. Let us add StatsD on our app before setting up our Grafana graph. Ultimately we’ll monitor which button is pressed at whatever time.

16 from django.shortcuts import render
15 from django.http import  HttpResponseRedirect
14 import statsd
13 c = statsd.ststsClient("statsd.hostedgraphite.com", 8125, prefix=**)
12
11
10 def home(request):
9  context = {
8  }
7 return render(request, "dashboard/index.html", context)
6
5 def login(request):
4     c.incr("demo.metric.login_button", 1)
3     return HttpResponseRedirect("/", status=200)
2
1 def badpage(request):
17     c.incr("demo.metric.support_button", 1)
1     return HttpResponseRedirect("/", status=404)
~
~
~
~


Implementing StatsD with Hosted Graphite

On our Hosted Graphite account, add a new dashboard to Grafana. You can see the behaviour of our app below. In this app, if we push a button that doesn't work, we get a 404. Let's monitor how many 404s come up in a simulated use of this app:

Screenshot of terminal being monitored for 404 errors

First, as in the picture below, we can see the number of resources and bytes used. 

Screenshot of Hosted Graphite's Metric Treemap in Metrics Tab


Next, we'll add to our 404 panel our StatsD metrics. We want to watch the buttons on our page to see which send a 404. On querying StatsD metrics on our 404 screens, please check the image below.

Screenshot of Hosted Graphite's metrics being gueried


I adjusted my views to display bars: green are 404s, the login button is yellow and the help button is blue. If our basic app was a frequently-used location, we would now be able to see which buttons are being pushed, and how frequently.

Screen shot of Hosted Graphite Panels used to monitor 404s and services


Screenshot of Hosted Graphite's queries customized for monitoring


If you want to check it out, continue to the free trial of MetricFire and start submitting metrics for your Heroku submission. 

You can also get onto the HG Heroku Monitoring listing and get your Heroku monitoring automatically! When you get into the HG Heroku app you can talk to our team directly through the support chat!


Related Posts

No items found.

See why thousands of engineers trust Hosted Graphite with their monitoring

START A FREE TRIAL