Graphite: show change from previous value

Dave picture Dave · Aug 17, 2012 · Viewed 12.9k times · Source

I am sending Graphite the time spent in Garbage Collection (getting this from jvm via jmx). This is a counter that increases. Is their a way to have Graphite graph the change every minute so I can see a graph that shows time spent in GC by minute?

Answer

dannyla picture dannyla · Sep 8, 2012

You should be able to turn the counter into a hit-rate with the Derivative function, then use the summarize function to the counter into the time frame that your after.

&target=summarize(derivative(java.gc_time), "1min") # time spent per minute

derivative(seriesList)

This is the opposite of the integral function. This is useful for taking a 
running totalmetric and showing how many requests per minute were handled.

&target=derivative(company.server.application01.ifconfig.TXPackets)

Each time you run ifconfig, the RX and TXPackets are higher (assuming there is network traffic.) By applying the derivative function, you can get an idea of the packets per minute sent or received, even though you’re only recording the total.

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

Summarize the data into interval buckets of a certain size.
By default, the contents of each interval bucket are summed together. 
This is useful for counters where each increment represents a discrete event and
retrieving a “per X” value requires summing all the events in that interval.

Source: http://graphite.readthedocs.org/en/0.9.10/functions.html