KafkaStreamsBinderMetrics throws ClassCastException
Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/814 Fixing an erroneous cast.
This commit is contained in:
@@ -89,7 +89,7 @@ public class KafkaStreamsBinderMetrics {
|
||||
ToDoubleFunction toDoubleFunction(Metric metric) {
|
||||
return (o) -> {
|
||||
if (metric.metricValue() instanceof Number) {
|
||||
return (Double) metric.metricValue();
|
||||
return ((Number) metric.metricValue()).doubleValue();
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
|
||||
@@ -106,6 +106,7 @@ public class KafkaStreamsBinderWordCountFunctionTests {
|
||||
final MeterRegistry meterRegistry = context.getBean(MeterRegistry.class);
|
||||
Thread.sleep(100);
|
||||
assertThat(meterRegistry.get("stream.metrics.commit.total").gauge().value()).isEqualTo(1.0);
|
||||
assertThat(meterRegistry.get("app.info.start.time.ms").gauge().value()).isNotNaN();
|
||||
Assert.isTrue(LATCH.await(5, TimeUnit.SECONDS), "Failed to call customizers");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user