简体   繁体   English

使用度量 spring_cloud_stream_binder_kafka_offset 来计算 kafka 滞后

[英]Using metric spring_cloud_stream_binder_kafka_offset for kafka lag

I have an application consuming kafka messages for a long time without any restart.我有一个应用程序长时间使用 kafka 消息而没有重新启动。 Also I have a dash that monitors the consumer lag by the property " spring_cloud_stream_binder_kafka_offset ".另外,我有一个破折号,它通过属性“ spring_cloud_stream_binder_kafka_offset ”监视消费者滞后。

When I had to restart it recently, I realized that some topics that I haven't sent messages for more than a month, started reporting some "strange values" on the same metric.当我最近不得不重新启动它时,我意识到我已经一个多月没有发送消息的某些主题开始报告相同指标的一些“奇怪值”。 I ran the following command to check the lags on the topic and then I realized this topic with "strange values" the column current-offset was empty "-", but i'm sure that this messages were processed in the past.我运行以下命令来检查该主题的滞后,然后我意识到该主题具有“奇怪的值”,列 current-offset 为空“-”,但我确定这些消息过去已处理过。

kafka-consumer-groups --bootstrap-server <server> --group group-test --describe --offsets --command-config 
GROUP团体 TOPIC话题 PARTITION划分 CURRENT-OFFSET电流偏移 LOG-END-OFFSET对数结束偏移 LAG落后
group-test小组测试 TEST测试 1 1 6468 6468 6468 6468 0 0
group-test小组测试 TEST测试 2 2 6396 6396 6396 6396 0 0
group-test小组测试 TEST1测试1 0 0 - —— 88 88 - ——
group-test小组测试 TEST1测试1 1 1 - —— 78 78 - ——

As I know, and I might be wrong, that this information about the current offset is stored inside a kafka topic.据我所知,我可能是错的,有关当前偏移量的信息存储在 kafka 主题中。 This topic also have an expire within 7 days since nothing is consumed.由于没有消耗任何内容,因此该主题也将在 7 天内过期。

My doubt is this: As the current offset has been "cleand up", shouldnt the property " spring_cloud_stream_binder_kafka_offset " reflects somehow this?我的疑问是:由于当前偏移量已被“清理”,属性“ spring_cloud_stream_binder_kafka_offset ”不应该以某种方式反映这一点吗? Because its leading to some misunderstanding about the metric, since I don't have this lag.因为它导致了对指标的一些误解,因为我没有这种滞后。

See offset.retention.minutes .offset.retention.minutes https://kafka.apache.org/documentation/#brokerconfigs_offsets.retention.minutes https://kafka.apache.org/documentation/#brokerconfigs_offsets.retention.minutes

It is 7 days by default, meaning the offsets are retained for 7 days after the last consumer left the group (with recent broker versions - since 2.1 if I recall correctly).默认情况下是 7 天,这意味着偏移量在最后一个消费者离开组后保留 7 天(使用最近的代理版本 - 如果我没记错的话,从 2.1 开始)。

When the offsets are removed, it is as if the group never consumed anything from the topic/partition and, if started again, it will receive all the records in the topic/partition.当偏移量被移除时,就好像该组从未从主题/分区中消费过任何东西,如果再次启动,它将收到主题/分区中的所有记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 spring cloud stream kafka binder 以编程方式将 kafka 主题(多个分区)偏移量重置为任意数字 - spring cloud stream kafka binder resetting a kafka topic(multiple partitions) offset to an arbitrary number programatically 空指针:带有活页夹 kafka 的 Spring Cloud 流 - Null pointer: Spring cloud stream with binder kafka Spring Cloud Stream Kafka活页夹压缩 - Spring Cloud Stream Kafka binder compression Kafka中的JSON错误-Spring Cloud Stream Kafka Binder - Bad JSON in Kafka - Spring Cloud Stream Kafka Binder 使用 Spring Cloud Stream Kafka Binder 时 Kafka Producer 中的错误处理 - Error Handling in Kafka Producer while using Spring Cloud Stream Kafka Binder 将 StateRestoreListener 与 Spring Cloud Kafka Streams 绑定器一起使用 - Using StateRestoreListener with Spring Cloud Kafka Streams binder 使用 Spring Cloud Stream Kafka Binder 批量消费 Kafka 消息及其密钥 - Consuming Kafka messages with its key in batches using Spring Cloud Stream Kafka Binder 使用 Spring Cloud Stream 寻找 Kafka 偏移量 - Seeking to a Kafka Offset with Spring Cloud Stream Spring Cloud Stream Kafka Binder 运行时配置更新 - Spring Cloud Stream Kafka Binder Configuration update at runtime 如何处理 Spring 云 stream kafka 流活页夹中的序列化错误? - How to handle Serialization error in Spring cloud stream kafka streams binder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM