zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkal...@apache.org
Subject [zookeeper] branch master updated: ZOOKEEPER-3401: Fix metric PROPOSAL_ACK_CREATION_LATENCY
Date Tue, 28 May 2019 13:55:28 GMT
This is an automated email from the ASF dual-hosted git repository.

nkalmar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new bb94aa4  ZOOKEEPER-3401: Fix metric PROPOSAL_ACK_CREATION_LATENCY
bb94aa4 is described below

commit bb94aa44de61bfb2ecd5bbd12b4eb390c2cf39c1
Author: Jie Huang <jiehuang@fb.com>
AuthorDate: Tue May 28 15:55:11 2019 +0200

    ZOOKEEPER-3401: Fix metric PROPOSAL_ACK_CREATION_LATENCY
    
    Author: Jie Huang <jiehuang@fb.com>
    
    Reviewers: Enrico Olivelli <eolivelli@apache.org>, Norbert Kalmar <nkalmar@apache.org>
    
    Closes #957 from jhuan31/ZOOKEEPER-3401
---
 .../org/apache/zookeeper/server/quorum/AckRequestProcessor.java    | 7 +++++--
 .../org/apache/zookeeper/server/quorum/LearnerMetricsTest.java     | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/AckRequestProcessor.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/AckRequestProcessor.java
index 8e7e472..9d4188d 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/AckRequestProcessor.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/AckRequestProcessor.java
@@ -18,6 +18,7 @@
 
 package org.apache.zookeeper.server.quorum;
 
+import org.apache.zookeeper.server.ServerMetrics;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,10 +43,12 @@ class AckRequestProcessor implements RequestProcessor {
      */
     public void processRequest(Request request) {
         QuorumPeer self = leader.self;
-        if(self != null)
+        if(self != null) {
+            request.logLatency(ServerMetrics.getMetrics().PROPOSAL_ACK_CREATION_LATENCY);
             leader.processAck(self.getId(), request.zxid, null);
-        else
+        } else {
             LOG.error("Null QuorumPeer");
+        }
     }
 
     public void shutdown() {
diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerMetricsTest.java
b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerMetricsTest.java
index 8895f1f..85bbe31 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerMetricsTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/LearnerMetricsTest.java
@@ -81,7 +81,7 @@ public class LearnerMetricsTest extends QuorumPeerTestBase {
         Assert.assertEquals(8L, values.get("learner_proposal_received_count"));
         Assert.assertEquals(8L, values.get("cnt_proposal_latency"));
         Assert.assertThat((long)values.get("min_proposal_latency"), greaterThan(0L));
-        Assert.assertEquals(8L, values.get("cnt_proposal_ack_creation_latency"));
+        Assert.assertEquals(10L, values.get("cnt_proposal_ack_creation_latency"));
         Assert.assertThat((long)values.get("min_proposal_ack_creation_latency"), greaterThan(0L));
 
         // there are five learners, each received two commits, one for leader election, one
for the create request


Mime
View raw message