[英]How to expose Kafka metrics from SpringBoot application through JMX to Prometheus?
I have a springboot app from which i would like to expose the kafka.consumer
metrics to Prometheus via JMX.我有一个 springboot 应用程序,我想通过 JMX 将
kafka.consumer
指标公开给 Prometheus。 I can see the metrics here but i just don't know where to set those mBeans(ie kafka.consumer:type=consumer-metrics,client-id=([-.\w]+)).我可以在这里看到指标,但我只是不知道在哪里设置这些 mBean(即 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.我了解阅读 spring 引导文档,我只需要通过执行此设置
spring.jmx.enabled=true
来激活 JMX,但我不知道该怎么做才能通过 JMX 向 Prometheus 公开这些指标。
Kafka automatically registers its own MBeans with those names. Kafka 使用这些名称自动注册自己的 MBean。
If you add the actuator starter, Boot will configure Micrometer to scrape those MBeans.如果添加执行器启动器,Boot 将配置 Micrometer 以抓取这些 MBean。
However, Micrometer has deprecated the JMX scraper and has new KafkaMetrics Objects.但是,Micrometer 已弃用 JMX 刮板并具有新的 KafkaMetrics 对象。
Spring Boot 2.3 now uses those classes to configure Micrometer instead of JMX. Spring Boot 2.3 现在使用这些类来配置 Micrometer 而不是 JMX。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.