3

我正在使用 Spring boot 2、Kafka 2.1.4,并且我想在 spring boot actuator 的 actuator/metrics 端点中公开 kafka Producer 指标

pom.xml

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>${boot.version}</version>
</dependency>
<dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</artifactId>
            <version>${micrometer.version}</version>
</dependency>
<dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus
                        </artifactId>
            <version>${micrometer.version}</version>
</dependency>

在我的属性文件中看起来像这样 #application.properties

    management.endpoints.web.exposure.include=*
    management.endpoint.health.show-details=always
    management.endpoint.metrics.enabled=true
    management.endpoint.prometheus.enabled=true
    management.metrics.export.prometheus.enabled=true

结果没有kafka生产者指标只有Jvm和Tomcat

http://localhost:8080/actuator/metrics

   0   "jvm.memory.max"
   1   "jvm.threads.states"
   2   "jvm.gc.memory.promoted"
   3   "tomcat.cache.hit"
   4   "tomcat.servlet.error"
   5   "tomcat.cache.access"
   6   "jvm.memory.used"
   7   "jvm.gc.max.data.size"
   8   "jvm.gc.pause"
   9   "jvm.memory.committed"
   10  "system.cpu.count"
   11  "logback.events"
   12  "tomcat.global.sent"
   13  "jvm.buffer.memory.used"
   14  "tomcat.sessions.created"
   15  "jvm.threads.daemon"
   16  "system.cpu.usage"
   17  "jvm.gc.memory.allocated"
   18  "tomcat.global.request.max"
   19  "tomcat.global.request"
   20  "tomcat.sessions.expired"
   21  "jvm.threads.live"
   22  "jvm.threads.peak"
   23  "tomcat.global.received"
   24  "process.uptime"
   25  "tomcat.sessions.rejected"
   26  "process.cpu.usage"
   27  "tomcat.threads.config.max"
   28  "jvm.classes.loaded"
   29  "jvm.classes.unloaded"
   30  "tomcat.global.error"
   31  "tomcat.sessions.active.current"
   32  "tomcat.sessions.alive.max"
   33  "jvm.gc.live.data.size"
   34  "tomcat.servlet.request.max"
   35  "tomcat.threads.current"
   36  "tomcat.servlet.request"
   37  "jvm.buffer.count"
   38  "jvm.buffer.total.capacity"
   39  "tomcat.sessions.active.max"
   40  "tomcat.threads.busy"
   41  "process.start.time"
4

0 回答 0