zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eribeiro <...@git.apache.org>
Subject [GitHub] zookeeper pull request #307: ZOOKEEPER-2770 ZooKeeper slow operation log
Date Sat, 21 Oct 2017 15:48:52 GMT
Github user eribeiro commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/307#discussion_r146108372
  
    --- Diff: src/java/main/org/apache/zookeeper/server/ServerStats.java ---
    @@ -148,9 +173,47 @@ synchronized public void resetRequestCounters(){
             packetsReceived = 0;
             packetsSent = 0;
         }
    +    synchronized public void resetNumRequestsAboveThresholdTime() {
    +        numRequestsAboveThresholdTime = 0;
    +    }
         synchronized public void reset() {
             resetLatency();
             resetRequestCounters();
    +        resetNumRequestsAboveThresholdTime();
    +    }
    +
    +    public void checkLatency(final ZooKeeperServer zks, Request request) {
    +        long requestLatency = Time.currentElapsedTime() - request.createTime;
    +        boolean enabledAndAboveThreshold = (requestWarnThresholdMs == 0) ||
    +                (requestWarnThresholdMs > -1 && requestLatency > requestWarnThresholdMs);
    +        if (enabledAndAboveThreshold) {
    +            zks.serverStats().incNumRequestsAboveThresholdTime();
    +            // Try acquiring lock only if not waiting
    +            if(!waitForLoggingWarnThresholdMsg) {
    --- End diff --
    
    nit: space between `if` and `(`


---

Mime
View raw message