title: How to expose Kafka metrics from SpringBoot application through JMX to Prometheus?
body: <p>I have a springboot app from which i would like to expose the <code>kafka.consumer</code> metrics to Prometheus via JMX. I can see the metrics <a href="https://kafka.apache.org/documentation/#consumer_monitoring" rel="nofollow noreferrer">here</a> 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 <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-jmx" rel="nofollow noreferrer">documentation</a> that i need to activate JMX only by doing this setting <code>spring.jmx.enabled=true</code> but i don't know what to do extra to expose those metrics to Prometheus through JMX.</p>