Customizing Graphite Charts for Clearer Results

So if people couldn’t tell, I’ve been having a lot of success with StatsD, Graphite, and Graphene. One of the problems I faced was data that was too small to gather distinct trends. Here is one example:

While still useful, it is much harder to detect a small change with a chart like this. The jump between highs and lows is greater on this data. This normally occurs when you have smaller sets of data to look at. So we have two options (that I’ve discovered so far). The first is to summarize the data using the summarize function. If you are using graphite, and haven’t checked out their awesome list of functions, you really need to.

Summarize allows you to change the unit in which graphite displays data. Right now we’re showing things per second. But it might be more useful if we knew what was going on every 5 minutes. So lets say this was our url for our graphite graph:

http://stats.example.com/render/?target=example.posts

What we want to do is apply the summary function to the example.posts target:

http://stats.example.com/render/?target=summarize(example.posts, "5min")

And your browser will change the spaces and quotes to be url encoded:

http://stats.example.com/render/?target=summarize(example.posts,%20%225min%22)

Now our graph will look something like this:

Notice the units on the y-axis has changed. Then, if we wanted to measure it per hour, we just change the url to use “1h” instead of “5min”:

Another useful to tool in reading is using a Moving Average. This will take so many units next to each other and average them. So if we say we want to get a moving average of 60 units (so 60 seconds), our url would look something like this:

http://stats.example.com/render/?target=movingAverage(example.posts, 60)

We replace the space with “%20” to URL Encode the function:

http://stats.example.com/render/?target=movingAverage(example.posts,%2060)

Our chart will looks something like this:

Notice the gap now at the beginning, that is because there isn’t 60 points of data to average until the 60th point. This will cause the graph actually shift forward a bit. I personal have found that the moving average is most useful after being compared to the original. So you can have two targets, one with the original, and one with the movingAverage function applied:

http://example.com/render/?target=example.posts&target=movingAverage(example.posts,%2060)

2 thoughts on “Customizing Graphite Charts for Clearer Results

  1. Hi,
    If i want to keep the Y-axis value constant means it should not change after refresh(or after applying the rendering function) also so how i can do that?

    Thanks

    Like

  2. Awesome, just what I was looking for. Now I made one 24h overview dashboard with 1h aggregation and another 6h dashboard with 5 minute aggregation. Much better than what I had before. Thank you!

    Like

Leave a Reply to Jan Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close