zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anmolnar <...@git.apache.org>
Subject [GitHub] zookeeper pull request #580: ZOOKEEPER-3098: Add additional server metrics
Date Thu, 09 Aug 2018 18:43:59 GMT
Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/580#discussion_r209038790
  
    --- Diff: src/java/main/org/apache/zookeeper/server/ServerStats.java ---
    @@ -127,36 +129,45 @@ public String toString(){
             sb.append("Mode: " + getServerState() + "\n");
             return sb.toString();
         }
    -    // mutators
    -    synchronized void updateLatency(long requestCreateTime) {
    -        long latency = Time.currentElapsedTime() - requestCreateTime;
    -        totalLatency += latency;
    -        count++;
    -        if (latency < minLatency) {
    -            minLatency = latency;
    +
    +    /**
    +     * Update request statistic. This should only be called from a request
    +     * that originated from that machine.
    +     */
    +    public void updateLatency(Request request, long currentTime) {
    --- End diff --
    
    Why do you need to pass `currentTime` here?
    For testing?


---

Mime
View raw message