johnnychhsu commented on code in PR #15483:
URL: https://github.com/apache/kafka/pull/15483#discussion_r1517905708


##########
clients/src/main/java/org/apache/kafka/common/metrics/KafkaMetric.java:
##########
@@ -20,6 +20,37 @@
 import org.apache.kafka.common.MetricName;
 import org.apache.kafka.common.utils.Time;
 
+/**
+ * An implementation of {@link Metric} interface.
+ * <p>
+ * A KafkaMetric is a named metric for monitoring purpose. The metric value 
can be a {@link Measurable} or a {@link Gauge}.
+ * <pre>
+ * <b>metricName</b> The name of the metric
+ * <b>lock</b> A lock used for reading the metric value in case of race 
condition
+ * <b>time</b> The POSIX time in milliseconds the metric is being taken
+ * <b>metricValueProvider</b> The metric collecting implementation that 
implements {@link MetricValueProvider}
+ * <b>config</b> The metric configuration which is a {@link MetricConfig}
+ * </pre>
+ * <p>
+ * Usage looks something like this:
+ *
+ * <pre>{@code
+ * // set up metrics:
+ *
+ * Map<String, String> tags = new HashMap<>();
+ * tags.put("key1", "value1");
+ *
+ * MetricConfig config = new MetricConfig().tags(metricTags);
+ * Time time = new SystemTime();
+ * metricName = new MetricName(&quot;message-size-max&quot;, 
&quot;producer-metrics&quot;);
+ *
+ * KafkaMetric m = new KafkaMetric(new Object(),

Review Comment:
   thanks for the comment! yes that makes sense to me, I think I missed the 
point.
   Just updated and added doc for public methods, thanks! 



-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to