From dev-return-79360-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Mon Mar 18 23:07:35 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 0FE6218077A for ; Tue, 19 Mar 2019 00:07:34 +0100 (CET) Received: (qmail 18462 invoked by uid 500); 18 Mar 2019 23:07:33 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 18437 invoked by uid 99); 18 Mar 2019 23:07:33 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Mar 2019 23:07:33 +0000 From: GitBox To: dev@zookeeper.apache.org Subject: [GitHub] [zookeeper] eolivelli commented on a change in pull request #856: ZOOKEEPER-3319: Add metrics for follower and observer Message-ID: <155295045328.10857.17093030376231034545.gitbox@gitbox.apache.org> Date: Mon, 18 Mar 2019 23:07:33 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit eolivelli commented on a change in pull request #856: ZOOKEEPER-3319: Add metrics for follower and observer URL: https://github.com/apache/zookeeper/pull/856#discussion_r266676199 ########## File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/Request.java ########## @@ -305,4 +305,25 @@ public void setException(KeeperException e) { public KeeperException getException() { return e; } + + public void logLatency(ServerMetrics metric, String key, long currentTime) { + if (hdr != null) { + /* Request header is created by leader. If there is clock drift + * latency might be negative. Headers use wall time, not + * CLOCK_MONOTONIC. + */ + long latency = currentTime - hdr.getTime(); + if (latency > 0) { + if (key != null) { + metric.add(key, latency); Review comment: ......Maybe it's better to overload logLatency(), one with key parameter, one w/o parameter, instead of checking null. What do you think? Yes it may be a good idea, can you try? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services