【发布时间】:2019-04-04 00:39:41
【问题描述】:
目前我正在使用 Spring Boot 2.1、Spring Kafka (2.2.0) 和 Micrometer (1.1.0)。
我创建了一个简单的示例项目,其中包含:
- Spring Boot 2 应用向 Kafka 主题发布随机 Hello World 消息
- 使用来自 Kafka 主题的 Hello World 消息的 Spring Boot 2 应用
- 用于启动 Kafka 代理和 Zookeeper 实例的 docker-compose 文件(均为官方 Confluent Docker 映像)
我的目标是让作为 micrometer 1.1.0 的一部分发布的 Kakfa 消费者指标发挥作用。
生产和使用 Hello World 消息的工作非常好,(kafka)指标也暴露了http://host:port/actuator/metrics,但是当 我请求一个特定的 Kafka 指标,例如:
http://host:port/actuator/metrics/kafka.consumer.records.consumed.total
统计值COUNT 是NaN。
{
name: "kafka.consumer.records.consumed.total",
description: "The total number of records consumed.",
baseUnit: "records",
measurements: [
{
statistic: "COUNT",
value: "NaN"
}
],
availableTags: [
{
tag: "client.id",
values: [
"spring-kafka-consumer-hello-world-app"
]
}
]
}
我是否忽略了我的 Spring Boot 应用程序或 Kafka 代理上的一些配置?我希望你能指出我正确的方向。
你可以找到我的示例项目here。
【问题讨论】:
标签: spring-boot spring-kafka micrometer