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_r266254342
##########
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:
I can't understand this point.
Is key optional?
I am thinking about the new API, I would like to make it explicit in the new
API what is the behavior of not using the key.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services