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



##########
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:
       @rgroothuijsen this could be a bug on the DistributedHerder side. Seems 
that `DistributedHerder#herderMetrics` is initialized [too 
early](https://github.com/apache/kafka/blob/8e211eb72f9a45897cc37fed394a38096aa47feb/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java#L216).
 Could you give a try moving it later in the constructor, [maybe after 
config](https://github.com/apache/kafka/blob/8e211eb72f9a45897cc37fed394a38096aa47feb/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java#L249),
 to check if the same exception happens again?




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