0

Graphite Functions Summarize, Highest Average, etc

Posted junio 29th, 2012 in Blog and tagged , , , by mateo
In this post we are going to review the main graphite functions that I use in my everyday work and some tricks that I found really useful. But first, we need to explain, what is Graphite ?
According to the  developers:
Graphite consists of a storage backend and a web-based visualization frontend. Client applications send streams of numeric time-series data to the Graphite backend (called carbon), where it gets stored in fixed-size database files similar in design to RRD. The web frontend provides 2 distinct user interfaces for visualizing this data in graphs as well as a simple URL-based API for direct graph generation.
Graphite’s design is focussed on providing simple interfaces (both to users and applications), real-time visualization, high-availability, and enterprise scalability.

Graphite Functions

Graphite Functions

The graphite functions that we are going to review are: Summarize, Highest Average, Alias by Node and Derivative, but you can find more deep information at the Official Documentation.

Summarize

summarize(seriesList, intervalString, func=’sum’, alignToFrom=False)

This graphite function transform the given metric into a smaller scale of time. For example, if we have the data expressed in minutes, we can use &target=summarize(metric,”1hour”) to group the data by hour. We can summarize using multiples scales of time, for example: 10min, 1h, 7d. The default aggregation metod is sum, but we also can use avg, min and max [&target=summarize(metric, "1hour", "avg")]

Function Summarize

 

Function Summarize 2

Highest Average

highestAverage(seriesList, n)

Many times you have many metrics, and you just want to graph the 5 more relevant metric. In this case the ideal graphite function is highestAverage. With this function  graphite is going to draw the metrics that have the biggest average of the selected ones. For example if we want to graph the 5 metrics with highest average you can use: &target=highestAverage(multiple.metrics.*,5).

In other cases you have similar graphite functions like: highestCurrent, highestMax, lowestAverage, lowestCurrent.

Function Highest Average
Function Highest Average 2

 

Alias by Node

aliasByNode(seriesList, *nodes)

Sometimes you have many metrics and you need to set up an alias for each of them. I f you ever wonder if there is a faster way to do this, Alias by Node is the graphite functions you are looking for. It is as simple as placing you metric between aliasByNode( folder.graphite.*,2) , being 2 the place in the path of the metric that is its name. So, you can use 0 , 1 , 2 , 3 …. as parameters. But, if the name of the metric is in the last place, you can also use -1, -2 and so on.

Function Alias by Node

Function Alias by Node 1

Derivative

derivative(seriesList)

Finally, the cherry on top is the derivative graphite function, it is very useful when you want to study the change of the metric instead of the value of the metric itself.  In other words, the values that are represented in the Y axis, is the amount that the metric has changed in one unit of time, for example, one day. The final tip, if you want to study the porcentual change instead of the absolute change, you can use this function derivative(log(metric),10)

Function Derivative

Function Derivative 1

 

Leave a Reply