Repository: kafka Updated Branches: refs/heads/trunk bd784aeb2 -> 98952b3cc
KAFKA-1251 Further metric naming standardization. Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/98952b3c Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/98952b3c Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/98952b3c Branch: refs/heads/trunk Commit: 98952b3cc7bb9b08ad553da014c80b79d0bc24d6 Parents: bd784ae Author: Jay Kreps <jay.kr...@gmail.com> Authored: Tue Apr 1 12:47:42 2014 -0700 Committer: Jay Kreps <jay.kr...@gmail.com> Committed: Tue Apr 1 12:48:44 2014 -0700 ---------------------------------------------------------------------- .../kafka/clients/producer/KafkaProducer.java | 18 +++++----- .../clients/producer/internals/Sender.java | 10 +++--- .../apache/kafka/common/network/Selector.java | 36 +++++++++----------- 3 files changed, 29 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/98952b3c/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java ---------------------------------------------------------------------- diff --git a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java index 8c1c575..e6eb5b0 100644 --- a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java +++ b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java @@ -40,7 +40,6 @@ import org.apache.kafka.common.metrics.MetricConfig; import org.apache.kafka.common.metrics.Metrics; import org.apache.kafka.common.metrics.MetricsReporter; import org.apache.kafka.common.metrics.Sensor; -import org.apache.kafka.common.metrics.stats.Rate; import org.apache.kafka.common.network.Selector; import org.apache.kafka.common.record.CompressionType; import org.apache.kafka.common.record.Record; @@ -136,7 +135,6 @@ public class KafkaProducer implements Producer { this.ioThread.start(); this.errors = this.metrics.sensor("errors"); - this.errors.add("message-error-rate", "The average number of errors per second returned to the client.", new Rate()); config.logUnused(); log.debug("Kafka producer started"); @@ -263,15 +261,15 @@ public class KafkaProducer implements Producer { */ private void ensureValidRecordSize(int size) { if (size > this.maxRequestSize) - throw new RecordTooLargeException("The message is " + size - + " bytes when serialized which is larger than the maximum request size you have configured with the " - + ProducerConfig.MAX_REQUEST_SIZE_CONFIG - + " configuration."); + throw new RecordTooLargeException("The message is " + size + + " bytes when serialized which is larger than the maximum request size you have configured with the " + + ProducerConfig.MAX_REQUEST_SIZE_CONFIG + + " configuration."); if (size > this.totalMemorySize) - throw new RecordTooLargeException("The message is " + size - + " bytes when serialized which is larger than the total memory buffer you have configured with the " - + ProducerConfig.TOTAL_BUFFER_MEMORY_CONFIG - + " configuration."); + throw new RecordTooLargeException("The message is " + size + + " bytes when serialized which is larger than the total memory buffer you have configured with the " + + ProducerConfig.TOTAL_BUFFER_MEMORY_CONFIG + + " configuration."); } public List<PartitionInfo> partitionsFor(String topic) { http://git-wip-us.apache.org/repos/asf/kafka/blob/98952b3c/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 c92bfbc..855ae84 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 @@ -506,10 +506,10 @@ public class Sender implements Runnable { */ private void correlate(RequestHeader requestHeader, ResponseHeader responseHeader) { if (requestHeader.correlationId() != responseHeader.correlationId()) - throw new IllegalStateException("Correlation id for response (" + responseHeader.correlationId() - + ") does not match request (" - + requestHeader.correlationId() - + ")"); + throw new IllegalStateException("Correlation id for response (" + responseHeader.correlationId() + + ") does not match request (" + + requestHeader.correlationId() + + ")"); } /** @@ -793,7 +793,7 @@ public class Sender implements Runnable { new Max()); this.errorSensor.add("record-error-rate", "The average per-second number of record sends that resulted in errors", new Rate()); this.recordsPerRequestSensor.add("record-send-rate", "The average number of records sent per second.", new Rate()); - this.recordsPerRequestSensor.add("records-per-request", "The average number of records per request.", new Avg()); + this.recordsPerRequestSensor.add("records-per-request-avg", "The average number of records per request.", new Avg()); this.maxRecordSizeSensor.add("record-size-max", "The maximum record size", new Max()); this.metrics.addMetric("requests-in-flight", "The current number of in-flight requests awaiting a response.", new Measurable() { public double measure(MetricConfig config, long now) { http://git-wip-us.apache.org/repos/asf/kafka/blob/98952b3c/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 5b801e4..558f8b4 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 @@ -408,28 +408,26 @@ public class Selector implements Selectable { this.bytesReceived = this.metrics.sensor("bytes-received", bytesTransferred); this.selectTime = this.metrics.sensor("select-time"); this.ioTime = this.metrics.sensor("io-time"); - bytesTransferred.add("network-ops-per-second", + bytesTransferred.add("network-io-rate", "The average number of network operations (reads or writes) on all connections per second.", new Rate(new Count())); - this.bytesSent.add("bytes-sent-per-second", "The average number of outgoing bytes sent per second to all servers.", new Rate()); - this.bytesSent.add("requests-sent-per-second", "The average number of requests sent per second.", new Rate(new Count())); + this.bytesSent.add("outgoing-byte-rate", "The average number of outgoing bytes sent per second to all servers.", new Rate()); + this.bytesSent.add("request-rate", "The average number of requests sent per second.", new Rate(new Count())); this.bytesSent.add("request-size-avg", "The average size of all requests in the window..", new Avg()); this.bytesSent.add("request-size-max", "The maximum size of any request sent in the window.", new Max()); - this.bytesReceived.add("bytes-received-per-second", "Bytes/second read off all sockets", new Rate()); - this.bytesReceived.add("responses-received-per-second", "Responses received sent per second.", new Rate(new Count())); - this.connectionCreated.add("connections-created-per-second", - "New connections established per second in the window.", - new Rate()); - this.connectionClosed.add("connections-closed-per-second", "Connections closed per second in the window.", new Rate()); - this.selectTime.add("select-calls-per-second", + this.bytesReceived.add("incoming-byte-rate", "Bytes/second read off all sockets", new Rate()); + this.bytesReceived.add("response-rate", "Responses received sent per second.", new Rate(new Count())); + this.connectionCreated.add("connection-creation-rate", "New connections established per second in the window.", new Rate()); + this.connectionClosed.add("connection-close-rate", "Connections closed per second in the window.", new Rate()); + this.selectTime.add("select-rate", "Number of times the I/O layer checked for new I/O to perform per second", new Rate(new Count())); - this.selectTime.add("io-wait-time-avg-ns", + this.selectTime.add("io-wait-time-ns-avg", "The average length of time the I/O thread speant waiting for a socket ready for reads or writes in nanoseconds.", new Avg()); - this.selectTime.add("io-wait-percentage", "The fraction of time the I/O thread spent waiting.", new Rate(TimeUnit.NANOSECONDS)); - this.ioTime.add("io-time-avg-ns", "The average length of time for I/O per select call in nanoseconds.", new Avg()); - this.ioTime.add("io-percentage", "The fraction of time the I/O thread spent doing I/O", new Rate(TimeUnit.NANOSECONDS)); + this.selectTime.add("io-wait-ratio", "The fraction of time the I/O thread spent waiting.", new Rate(TimeUnit.NANOSECONDS)); + this.ioTime.add("io-time-ns-avg", "The average length of time for I/O per select call in nanoseconds.", new Avg()); + this.ioTime.add("io-ratio", "The fraction of time the I/O thread spent doing I/O", new Rate(TimeUnit.NANOSECONDS)); this.metrics.addMetric("connection-count", "The current number of active connections.", new Measurable() { public double measure(MetricConfig config, long now) { return keys.size(); @@ -444,10 +442,8 @@ public class Selector implements Selectable { Sensor sensor = this.metrics.getSensor(name); if (sensor == null) { sensor = this.metrics.sensor(name); - sensor.add("node-" + node + ".bytes-sent-per-second", new Rate()); - sensor.add("node-" + node + ".requests-sent-per-second", - "The average number of requests sent per second.", - new Rate(new Count())); + sensor.add("node-" + node + ".outgoing-byte-rate", new Rate()); + sensor.add("node-" + node + ".request-rate", "The average number of requests sent per second.", new Rate(new Count())); 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()); } @@ -462,8 +458,8 @@ public class Selector implements Selectable { Sensor sensor = this.metrics.getSensor(name); if (sensor == null) { sensor = this.metrics.sensor(name); - sensor.add("node-" + node + ".bytes-received-per-second", new Rate()); - sensor.add("node-" + node + ".responses-received-per-second", + sensor.add("node-" + node + ".incoming-byte-rate", new Rate()); + sensor.add("node-" + node + ".response-rate", "The average number of responses received per second.", new Rate(new Count())); }