I am using codahale metrics (now dropwizard metrics) to monitor a few 'events' happening in my system. I am using the counters
metrics to keep track of number of time the 'event' happened.
I checked the values printed by the reporter for my counter metrics and it seems like the value keeps on increasing (and never goes down). This seems logical as I am always using metrics.inc() function whenever my 'event' occurs.
What I really want is to get count of my 'event' happening between two reporting times
, for this I need to reset my counter every time I report my metrics, but I couldn't find any option in counter metrics to do that. Is there a way or general practice followed by codahale users to produce such metrics?
Current Behavior (reporting time 10 sec):
00:00:00 0
00:00:10 2 // event happened twice
00:00:20 2 // event did not occur
00:00:30 5 // event occured three times`
Expected metrics:
00:00:00 0
00:00:10 2
00:00:20 0
00:00:30 3
To sum up or calculate count(total) per arbitrary interval:
hitcount(perSecond(your.count), '1day')
Afaik it does all the black magic inside. Including but not limited to summarize(scaleToSeconds(nonNegativeDerivative(your.count),1), '1day')
and also there should be scaling according to carbon's retention periods (one or many) that fall into chosen aggregation interval.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With