14

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?

Dave
  • 13,518
  • 7
  • 42
  • 51

1 Answers1

21

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

dannyla
  • 1,960
  • 14
  • 13
  • can I somehow get per second values using something like the above ? – milosgajdos Jan 09 '13 at 01:42
  • the question is how do I do it if the storage-schema is set to store 1 data point every let's say 30seconds. – milosgajdos Jan 14 '13 at 17:38
  • 13
    Also, if your data has empty values, `derivative()` won't work too well without help. You should add `keepLastValue`, e.g.: `derivative(keepLastValue())` – gak Jul 25 '13 at 00:25
  • 1
    If your graph groups multiple data series, you might consider using `nonNegativeDerivative()` instead of `derivative()`, it will filter out the otherwise massive spikes when the process is restarted (i.e. reset to 0). Refer [http://www.jilles.net/perma/2013/08/22/how-to-do-graphite-derivatives-correctly/](http://www.jilles.net/perma/2013/08/22/how-to-do-graphite-derivatives-correctly/) – Justin Rowe Nov 23 '15 at 15:42