How can I set the dropwizard metrics reset timer?

We process messages that periodically appear. We use codahale "Timer" dropwizard metrics to measure the time it takes to process them.

I found that someone had the same problem here : "The problem with the exponentially decaying tank is that if new data does not appear, it will continue to give the same numbers all the time. For example, let's say you update the timer from 5 and 7 (then do not put anything), then no matter when you see (even after x hours), the timer will still show the average value of 6, which is not representative of the last 5 minutes in any way. Therefore it only works in if the data is all the time post are falling. "

As you can see with the blue line: enter image description here

But there is no reason to solve it. And they say this will not be implemented: https://github.com/dropwizard/metrics/issues/399

How can I reset to correctly use these timers or how should I visualize it so that it doesn't get embarrassed?

+3
source share
1 answer

Usage SlidingTimeWindowReservoir will cover most use cases. But, as indicated in this comment , depending on the number of events, a problem may arise: it saves all measurements in a window in memory, which becomes unacceptable with a large number of events

Can we do better? Let's continue the search. If we are lucky, we will find this blog post . This accurately describes your kind of problem. There is a link to their simple dirty solution. Also a suggestion for using an HdrHistogram .

Also on the metrics mailing list there are several messages specifically about this problem. For example, specify Marshall Pierce / hdrhistogram-metrics-reservoir . What is an HdrHistogram and why it is used to measure latency, check the project description.

And finally, after a few more digging, you can also find the vladimir-bukhtoyarov / metrics-core-hdr project . This is using an HdrHistogram as well.

So there are two similar libraries that use the same data structure and claim to solve the problem you are facing.

+7
source

All Articles