I have a springboot app from which i would like to expose the kafka.consumer
metrics to Prometheus via JMX. I can see the metrics here but i just don't know where to set those mBeans(i.e. kafka.consumer:type=consumer-metrics,client-id=([-.\w]+)). I understood reading the spring boot documentation that i need to activate JMX only by doing this setting spring.jmx.enabled=true
but i don't know what to do extra to expose those metrics to Prometheus through JMX.
Asked
Active
Viewed 1,696 times
1

Charles
- 570
- 11
- 29
1 Answers
1
Kafka automatically registers its own MBeans with those names.
If you add the actuator starter, Boot will configure Micrometer to scrape those MBeans.
However, Micrometer has deprecated the JMX scraper and has new KafkaMetrics Objects.
Spring Boot 2.3 now uses those classes to configure Micrometer instead of JMX.

Gary Russell
- 166,535
- 14
- 146
- 179
-
1Can you suggest a simple example on how to see Kafka producer metrics? – Manish Kumar Jul 14 '21 at 06:19
-
The producer metrics are exposed the same way (JMX and Micrometer). – Gary Russell Jul 14 '21 at 13:31