zentol commented on code in PR #19649: URL: https://github.com/apache/flink/pull/19649#discussion_r865640970
########## flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/metrics/KafkaMetricMutableWrapper.java: ########## @@ -34,7 +34,12 @@ public KafkaMetricMutableWrapper(Metric metric) { @Override public Double getValue() { - return (Double) kafkaMetric.metricValue(); + final Object metricValue = kafkaMetric.metricValue(); + // Previously KafkaMetric supported KafkaMetric#value that always returned a Double value. + // Since this method has been deprecated and is removed in future releases we have to + // manually check if the returned value is Double. Internally, KafkaMetric#value also + // returned 0.0 for all not "measurable" values, so we restored the original behavior. + return metricValue instanceof Double ? (Double) metricValue : 0.0; Review Comment: It does restore the original behavior so I'm fine with not doing that, but we do have the option now to expose more kafka metrics. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org