Frage

I am using Codahale Metrics in my application and I would like to know if there is any way to measure the number of events in the past X minutes/hours. I know that a Timer provides a one, five and fifteen minute rate but I am looking for the total count in a window of time.

Also, I have tried using a Histogram with a SlidingWindowReservoir but it doesn't expose the functionality I am looking for. It exposes percentile information.

Is there any way to achieve this using Codahale Metrics? If not, is it there a way to extend it to support this? If not, any other good library to achieve it?

War es hilfreich?

Lösung

You can use histogram of SlidingTimeWindowReservoir:

offersMinuteHistogram = new SlidingTimeWindowReservoir(1, TimeUnit.MINUTES);

offersMinuteHistogram.getSnapshot().getValues().length  

This lenght is number of updates of histogram at last minute.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top