kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkr...@apache.org
Subject git commit: KAFKA-1251 Missed one per-node metric.
Date Fri, 28 Mar 2014 04:01:39 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 23d7fc470 -> e287e02b1


KAFKA-1251 Missed one per-node metric.


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/e287e02b
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/e287e02b
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/e287e02b

Branch: refs/heads/trunk
Commit: e287e02b12ca3ca00184fabf07a7dc0a52571a23
Parents: 23d7fc4
Author: Jay Kreps <jay.kreps@gmail.com>
Authored: Thu Mar 27 21:00:33 2014 -0700
Committer: Jay Kreps <jay.kreps@gmail.com>
Committed: Thu Mar 27 21:00:33 2014 -0700

----------------------------------------------------------------------
 .../kafka/clients/producer/internals/Sender.java    | 16 +++++++++-------
 .../org/apache/kafka/common/network/Selector.java   |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/e287e02b/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java
b/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java
index d89813e..c92bfbc 100644
--- a/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java
+++ b/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java
@@ -867,14 +867,16 @@ public class Sender implements Runnable {
 
         public void recordLatency(int node, long latency, long nowNs) {
             this.requestTimeSensor.record(latency, nowNs);
-            String nodeTimeName = "server." + node + ".latency";
-            Sensor nodeRequestTime = this.metrics.getSensor(nodeTimeName);
-            if (nodeRequestTime == null) {
-                nodeRequestTime = this.metrics.sensor(nodeTimeName);
-                nodeRequestTime.add("node-" + node + ".latency-avg", new Avg());
-                nodeRequestTime.add("node-" + node + ".latency-max", new Max());
+            if (node >= 0) {
+                String nodeTimeName = "server." + node + ".latency";
+                Sensor nodeRequestTime = this.metrics.getSensor(nodeTimeName);
+                if (nodeRequestTime == null) {
+                    nodeRequestTime = this.metrics.sensor(nodeTimeName);
+                    nodeRequestTime.add("node-" + node + ".latency-avg", new Avg());
+                    nodeRequestTime.add("node-" + node + ".latency-max", new Max());
+                }
+                nodeRequestTime.record(latency, nowNs);
             }
-            nodeRequestTime.record(latency, nowNs);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/kafka/blob/e287e02b/clients/src/main/java/org/apache/kafka/common/network/Selector.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/network/Selector.java b/clients/src/main/java/org/apache/kafka/common/network/Selector.java
index 02c0606..5d93965 100644
--- a/clients/src/main/java/org/apache/kafka/common/network/Selector.java
+++ b/clients/src/main/java/org/apache/kafka/common/network/Selector.java
@@ -447,7 +447,7 @@ public class Selector implements Selectable {
                     sensor.add("node-" + node + ".requests-sent-per-second",
                                "The average number of requests sent per second.",
                                new Rate(new Count()));
-                    sensor.add("connection-" + node + ".request-size-avg", "The average size
of all requests in the window..", new Avg());
+                    sensor.add("node-" + node + ".request-size-avg", "The average size of
all requests in the window..", new Avg());
                     sensor.add("node-" + node + ".request-size-max", "The maximum size of
any request sent in the window.", new Max());
                 }
                 sensor.record(bytes);


Mime
View raw message