Try to use
SmoothlyDecayingRollingCounter. In general it works as described by
Marshall Pierce, but do zeroing of obsolete chunks a little bit better(smoothly).
<dependency>
<groupId>com.github.metrics-core-addons</groupId>
<artifactId>metrics-core-hdr</artifactId>
<version>1.4.0</version>
</dependency>
// constructs the counter which divided by 10 chunks with 60 seconds time window.
WindowCounter counter = new SmoothlyDecayingRollingCounter(Duration.ofSeconds(60), 10);
registry.register("my-counter", new MetricsCounter(counter));
// ...
counter.add(42);
среда, 25 мая 2016 г., 0:15:04 UTC+3 пользователь gg написал: