Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/629#discussion_r221145623
--- Diff: src/java/main/org/apache/zookeeper/server/ServerStats.java ---
@@ -53,10 +54,13 @@ public ServerStats(Provider provider) {
synchronized public long getMinLatency() {
return minLatency == Long.MAX_VALUE ? 0 : minLatency;
}
-
- synchronized public long getAvgLatency() {
+
+ synchronized public double getAvgLatency() {
if (count != 0) {
- return totalLatency / count;
+ //be account to four decimal places
+ double avgLatency = totalLatency / (double)count;
+ BigDecimal bg = new BigDecimal(avgLatency);
--- End diff --
For us, we call mntr to export metrics to the reporting system, and it's
being periodically called in other tools as well, but still it's not called
that often (< 20/min), so should be fine.
---