Report timer values and reset for next iteration

941 views
Skip to first unread message

cla...@trdr.io

unread,
Aug 8, 2015, 11:33:23 AM8/8/15
to metrics-user
Hi, my use case is dump the values (count, min, max and mean) of the timers getting in a fixed period of time, and restart all values for the next iteration (similar to https://github.com/dropwizard/metrics/issues/143#issuecomment-63336229). I know that I can use a SlidingTimeWindowReservoir, but as it keeps all the measurements in-memory which becomes unacceptable at large number of events. 

On the other hand you have made very clear that you won't implement a reset method.

My question is: Is there an easy way to implement this using metrics without keeping all the measurements in memory?
Or is just that metrics is not the right tool for my use case?

Thanks, Claudio.

Marshall Pierce

unread,
Aug 9, 2015, 10:35:42 AM8/9/15
to metric...@googlegroups.com
You can use HdrHistogramResetOnSnapshotReservoir, which offers this functionality. See https://bitbucket.org/marshallpierce/hdrhistogram-metrics-reservoir.
> --
> You received this message because you are subscribed to the Google Groups "metrics-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to metrics-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

cla...@trdr.io

unread,
Aug 9, 2015, 8:12:43 PM8/9/15
to metrics-user
Thanks, Marshall.

I just did a very simple test using HdrHistogramResetOnSnapshotReservoir and I see that the min, max and mean values are reseted after each report, which is great. But I have a couple of questions:

1.- I don't see that the counter of the timer is being reseted (I mean it doesn't go to 0 after a report). Is that expected behavior?

2.- The min value resets to 9223372036854.78 instead of 0.00 which seems to be a bug (Actually if the report is done before doing a track, it shows that value too). Using HdrHistogram 2.1.6 seems to fix this error.

Regards, Claudio.

Marshall Pierce

unread,
Aug 9, 2015, 10:21:38 PM8/9/15
to metric...@googlegroups.com
Answers inline.

> On Aug 9, 2015, at 5:12 PM, cla...@trdr.io wrote:
>
> Thanks, Marshall.
>
> I just did a very simple test using HdrHistogramResetOnSnapshotReservoir and I see that the min, max and mean values are reseted after each report, which is great. But I have a couple of questions:
>
> 1.- I don't see that the counter of the timer is being reseted (I mean it doesn't go to 0 after a report). Is that expected behavior?

Yeah, unfortunately. A timer is basically a histogram + a counter, and I can’t change the counter part via the custom histogram.

>
> 2.- The min value resets to 9223372036854.78 instead of 0.00 which seems to be a bug (Actually if the report is done before doing a track, it shows that value too). Using HdrHistogram 2.1.6 seems to fix this error.

Yep, must be a bug in the version of HdrHistogram that I’m using. I’ll update the dependency.
Reply all
Reply to author
Forward
0 new messages