jtim
jtim

Reputation: 246

Spring Boot 2.1 Micrometer Kafka consumer metric statistic COUNT is "NaN"

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:

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.

Upvotes: 7

Views: 7434

Answers (1)

Gary Russell
Gary Russell

Reputation: 174574

I just ran it in a debugger and the actuator is looking for an MBean with an object name...

kafka.consumer:type=consumer-fetch-manager-metrics,\
client-id=spring-kafka-consumer-hello-world-app

and we get...

javax.management.InstanceNotFoundException: kafka.consumer:type=consumer-fetch-manager-metrics,client-id=spring-kafka-consumer-hello-world-app

...but the app actually has 3 consumer MBeans with names:

kafka.consumer:type=consumer-fetch-manager-metrics,\
client-id=spring-kafka-consumer-hello-world-app-0

(and -1, -2).

I suggest you open an issue against micrometer.

Upvotes: 1

Related Questions