|
这个版本仍在开发中,尚未达到稳定状态。要使用最新稳定版,请使用 spring-cloud-stream 5.0.1 ! |
Kafka 指标
Kafka 绑定模块公开了以下指标:
spring.cloud.stream.binder.kafka.offset: 此指标表示有多少消息尚未从给定绑定器的主题中由给定消费组消费。
这些指标是基于 Micrometer 库提供的。
如果类路径上有 Micrometer,且应用程序未提供其他此类 Bean,则绑定器会创建 KafkaBinderMetrics 个 Bean。
该度量包含消费者组信息、主题和主题上的最新偏移量提交的滞后数量。
此度量对于向 PaaS 平台提供自动扩展反馈特别有用。
The metric collection behaviour can be configured by setting properties in the spring.cloud.stream.kafka.binder.metrics namespace,
refer to the kafka binder properties section for more information.
您可以从创建必要的基础设施(如使用者)中排除KafkaBinderMetrics,然后通过在应用程序中提供以下组件来报告指标。
@Component
class NoOpBindingMeters {
NoOpBindingMeters(MeterRegistry registry) {
registry.config().meterFilter(
MeterFilter.denyNameStartsWith(KafkaBinderMetrics.OFFSET_LAG_METRIC_NAME));
}
}
有关如何选择性地抑制仪表的更多详情请参见 此处。