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
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")]
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.
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.
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)