简体   繁体   English

如何通过 JMX 将 SpringBoot 应用程序中的 Kafka 指标公开给 Prometheus?

[英]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.

相关问题 如何从 Java (Spring boot) 应用程序向 Prometheus 公开指标 - How to expose metrics to Prometheus from a Java (Spring boot) application 如何使用 RedisCacheManager 公开 Prometheus 指标? - How to expose Prometheus metrics with RedisCacheManager? 如何从 spring 启动使用 spring 云尤里卡服务器注册的应用程序公开普罗米修斯指标 - how to expose prometheus metrics from spring boot apps registered with spring cloud eureka server 您如何将指标从 Spring Boot 应用程序导出到 Prometheus? - How do you export metrics from a Spring Boot application into Prometheus? 如何使用 spring boot 2 将 kafka 指标公开到 /actuator/metrics - How to expose kafka metrics to /actuator/metrics with spring boot 2 如何使用JMX访问Mulesoft应用程序指标 - How to access mulesoft application metrics using JMX 如何从 prometheus 获取指标数据并在 java springboot App 中使用? - how to fetch metrics data from prometheus and use it within java springboot App? 升级到 Spring Boot 2 后,如何将缓存指标公开给普罗米修斯? - after upgrade to Spring Boot 2, how to expose cache metrics to prometheus? 在 SpringBoot 中使用 prometheus 自定义指标 - Using prometheus custom metrics with SpringBoot 从 Spring Boot 应用程序为 Prometheus 生成指标 - Generating metrics for Prometheus from Spring Boot application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM