rgroothuijsen commented on a change in pull request #9078:
URL: https://github.com/apache/kafka/pull/9078#discussion_r463845316



##########
File path: 
clients/src/main/java/org/apache/kafka/common/metrics/JmxReporter.java
##########
@@ -272,8 +272,16 @@ public MBeanInfo getMBeanInfo() {
             for (Map.Entry<String, KafkaMetric> entry : 
this.metrics.entrySet()) {
                 String attribute = entry.getKey();
                 KafkaMetric metric = entry.getValue();
+                String metricType = double.class.getName();
+
+                try {
+                    metricType = metric.metricValue().getClass().getName();
+                } catch (NullPointerException e) {

Review comment:
       @abbccdda That's what I figured as well at first, and it passes in unit 
tests, but there's a strange side effect. Upon starting `connect-distributed`, 
a whole bunch of NPEs appear for various metrics. It looks like when I call 
`metricValue()`, it eventually arrives 
[here](https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java#L1811),
 and throws an error because `member` is null. I could also do a null check 
there, though I'm not sure what value the method would return in that case.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to