Confused about mean reported by metric, what is the snapshot exactly?

52 views
Skip to first unread message

fabien...@gmail.com

unread,
Mar 25, 2016, 10:39:10 AM3/25/16
to metrics-user
Hi,

I used a Timer on a method, let's call it myMethod in the class myClass.

I managed to get two reports of the metrics with only one execution of the method between the two reports.
The result is quite confusing...

Before
    MyClass.myMethod.count    72
    MyClass.myMethod.snapshot.mean    10726
    MyClass.myMethod.snapshot.median    537
   
After
    MyClass.myMethod.count    73
    MyClass.myMethod.snapshot.mean    5548
    MyClass.myMethod.snapshot.median    974

I thought that "snapshot.mean" was a mean computed from the start of my JVM -and that count*mean would be the total time spent in the method), but, here it's clearly not the case since count*mean has reduced.

So, what it exactly the snapshot ?




fabien...@gmail.com

unread,
Mar 29, 2016, 12:31:02 PM3/29/16
to metrics-user
Anyone?

How is it possible that after 72 executions of MyClass.myMethod (my timer is named after the méthod name), the mean time is 10726,
but after one more execution, the mean time is 5548.  
I would mean a negative execution time for the 73th execution ... unless the "mean" given here is not calculated over all the 73 executions but only on a "snapshot".

Anyone can confirm?

Marshall Pierce

unread,
Mar 30, 2016, 1:03:14 PM3/30/16
to metric...@googlegroups.com
Default reservoir for timer is exponentially decaying, which is arguably useful at best. It emits “measurements” that never actually happened, and throws away crucial outlier values, all for the sake of trying to weight recent values more heavily. There are other reservoir implementations in metrics core, though my (clearly biased) opinion is that the correct choice for most usage is one backed with the HdrHistogram data structure, which is available here: 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.

Reply all
Reply to author
Forward
0 new messages