At the moment I'm playing around with Spring Boot 2.1, Spring Kafka (2.2.0) and Micrometer (1.1.0).
I created a simple example project that contains:
- a Spring Boot 2 app publishing random Hello World message to a Kafka topic
- a Spring Boot 2 app consuming the Hello World message from a Kafka topic
- a docker-compose file to spin up a Kafka broker and a Zookeeper instance (both official Confluent Docker images)
My goal is to get the Kakfa consumer metrics working that are released as part of micrometer 1.1.0.
Producing and consuming the Hello World message works perfectly fine also the (kafka) metrics are exposed http://host:port/actuator/metrics but when I request a specific Kafka metric like:
http://host:port/actuator/metrics/kafka.consumer.records.consumed.total
the value of the statistic COUNT
is NaN
.
{
name: "kafka.consumer.records.consumed.total",
description: "The total number of records consumed.",
baseUnit: "records",
measurements: [
{
statistic: "COUNT",
value: "NaN"
}
],
availableTags: [
{
tag: "client.id",
values: [
"spring-kafka-consumer-hello-world-app"
]
}
]
}
Did I overlook some configuration on my Spring Boot app or Kafka broker? I hope you can point me in the right direction.
You can find my example project here.