rcrowley / go-metrics

Go port of Coda Hale's Metrics library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

timer percentiles get stuck if update isn't called

newhook opened this issue · comments

I'm using a timer to record request latency percentiles. The problem is if there are no requests (meaning no calls to Update) the percentiles get "stuck" (meaning they latch on the last set of percentiles). Looking at the code this is because ExpDecaySample.update is the only thing that updates the samples (there is nothing that "ticks" the samples).

Is this deliberate?

I believe the java impl doesn't have this issue because the dataset is rescaled when fetched.

https://github.com/dropwizard/metrics/blob/4.0-development/metrics-core/src/main/java/com/codahale/metrics/ExponentiallyDecayingReservoir.java

@mihasya

Are there any plans/interest for addressing this? Happy to contribute a PR if so