0

I'm using Graphite with Codahale to record metrics from my java server. I have a block code that looks something like that:

public void foo() {
  try (Timer.Context ignored = myTimer.start()) {
    // Some code
  }
}

When I look at today's event count (each timer is also a counter) I see that we're around the hundred of hit counts a minute, which means a a few thousands an hour. When I widen the date range to include yesterday as well, I see that the results are in the millions range and I could not figure out why.

The results are shown after nonNegativeDerivative operation on the metric

Today's results:

Today

With yesterday's results:

enter image description here

Avi
  • 21,182
  • 26
  • 82
  • 121
  • Graphs above do not look like counter graphs. Counters are usually monotonically increasing and you need to apply nonNegativeDerivative() function in Graphite to get an exact number of calls per minute (per your metric interval). – deniszh Mar 07 '17 at 14:50
  • You're right, that's after applying nonNegatvieDerivative(). Editing. – Avi Mar 07 '17 at 15:00
  • Then I suspect what your problem is. You're should apply sum of derivatives (**sumSeries(nonNegativeDerivative(...))**) and not derivative of sums - http://www.jilles.net/perma/2013/08/22/how-to-do-graphite-derivatives-correctly/ – deniszh Mar 07 '17 at 15:04

2 Answers2

3

If using nonNegativeDerivative() - please apply derivative first, and then sumSeries() - not vise versa. Please check http://www.jilles.net/perma/2013/08/22/how-to-do-graphite-derivatives-correctly/

Also, you need to set up correct aggregation (sum) for counters like described in http://obfuscurity.com/2012/05/A-Precautionary-Tale-for-Graphite-Users

deniszh
  • 774
  • 1
  • 5
  • 14
2

you do not want to use sum on dropwizard counters. You want to use "last" they are incrementing decrementing gauges. You also want perSecond() and hitcount(10s) instead of the derivative.

http://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.perSecond