【问题标题】:Spring Cloud Kafka Streams binder offset metricsSpring Cloud Kafka Streams binder 偏移量指标
【发布时间】:2019-03-16 18:46:36
【问题描述】:

有人可以举例说明如何将 Spring Cloud Kafka Streams 指标 spring.cloud.stream.binder.kafka.offset 用于消费者应用程序吗?

编辑:

经过一段时间的调查,我想补充更多信息。 我正在寻找的指标必须向我展示我的流处理情况。接下来是我的绑定:

@Input(INCOMING_STREAM)
KStream<String, Update> incomingStream();

@Input(INCOMING_MESSAGE)
MessageChannel incomingMessage();

对我来说很奇怪的是,我可以使用建议的方法看到不同的指标,但仅适用于 INCOMING_MESSAGE 频道。有什么方法可以查看来自INCOMING_STREAM 的指标吗?

【问题讨论】:

  • 你的问题不清楚;请进一步解释和/或指向一些参考。
  • 是的,可能不是很清楚((我有带有流侦听器的 Spring Cloud Kafka 应用程序。为了获得更多可见性,我希望看到一些项目等待处理。在官方文档中,我找到下一个:Kafka binder module exposes the following metrics: spring.cloud.stream.binder.kafka.offset: This metric indicates how many messages have not been yet consumed from a given binder’s topic by a given consumer group. 但是对我来说,它是如何使用的不是很清楚。
  • 请提供该文档的链接;我在current docs 中没有看到它。
  • 加里,你可以在这里找到它:docs.spring.io/spring-cloud-stream/docs/current/reference/html/…。但看起来这里还有一个:github.com/spring-cloud/spring-cloud-stream-binder-kafka/blob/…。其中包含我之前发布的消息。

标签: apache-kafka apache-kafka-streams spring-cloud-stream


【解决方案1】:

Spring Cloud Stream 2.0 中的指标基于 Micrometer(这是 Boot 2.0 中使用的默认指标实现)。您可以尝试在您的应用程序中 autowireMeterRegistry 并在那里检索相关指标。请参阅this test 获取一些提示。如果您不想在应用程序中进行更改,也可以尝试设置spring.cloud.stream.bindings.applicationMetrics.destination 属性。有关详细信息,请参阅this blog

【讨论】:

  • @sobychako,我用 Spring Boot 2.4 尝试了你的指令,我配置了 applicationMetrics.destination。但是,我在目标主题上找不到spring.cloud.stream.binder.kafka.offset。你能解释一下吗?
猜你喜欢
  • 2023-03-29
  • 1970-01-01
  • 2018-10-14
  • 1970-01-01
  • 2021-02-24
  • 2020-06-03
  • 2021-02-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多