diff --git a/clients/src/main/java/org/apache/kafka/common/MetricName.java b/clients/src/main/java/org/apache/kafka/common/MetricName.java
index 578c848f103ab..1f5b43104b1b6 100644
--- a/clients/src/main/java/org/apache/kafka/common/MetricName.java
+++ b/clients/src/main/java/org/apache/kafka/common/MetricName.java
@@ -20,7 +20,7 @@
import java.util.Objects;
/**
- * The MetricName
class encapsulates a metric's name, logical group and its related attributes. It should be constructed using metrics.MetricName(...).
+ * The MetricName
class encapsulates a metric's name, logical group and its related attributes. It should be constructed using metrics.metricName(...).
*
* This class captures the following parameters: *
diff --git a/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java b/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java index 13d8db4b0cb13..23644784087c5 100644 --- a/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java +++ b/clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java @@ -48,7 +48,7 @@ * A registry of sensors and metrics. ** A metric is a named, numerical measurement. A sensor is a handle to record numerical measurements as they occur. Each - * Sensor has zero or more associated metrics. For example a Sensor might represent message sizes and we might associate + * Sensor has zero or more associated metrics. For example, a Sensor might represent message sizes, and we might associate * with this sensor a metric for the average, maximum, or other statistics computed off the sequence of message sizes * that are recorded by the sensor. *
@@ -58,9 +58,9 @@ * // set up metrics: * Metrics metrics = new Metrics(); // this is the global repository of metrics and sensors * Sensor sensor = metrics.sensor("message-sizes"); - * MetricName metricName = new MetricName("message-size-avg", "producer-metrics"); + * MetricName metricName = metrics.metricName("message-size-avg", "producer-metrics"); * sensor.add(metricName, new Avg()); - * metricName = new MetricName("message-size-max", "producer-metrics"); + * metricName = metrics.metricName("message-size-max", "producer-metrics"); * sensor.add(metricName, new Max()); * * // as messages are sent we record the sizes