[英]How does the metrics.num.samples kafka setting affect how records-lag-max is calculated?
When retrieving the consumer metrics via the kafka consumer API the records-lag-max is returning 0 occasionally even though describing the consumer group using the kafka-consumer-groups.sh tool shows that the consumer is lagging.通过 kafka 消费者 API 检索消费者指标时,即使使用 kafka-consumer-groups.sh 工具描述消费者组显示消费者滞后,records-lag-max 偶尔也会返回 0。 The metrics.sample.window.ms is set to 30s by default and the metrics.num.samples set to 2 by default.
metrics.sample.window.ms 默认设置为 30s,metrics.num.samples 默认设置为 2。 How does the metrics.num.samples affect this calculation of records-lag-max?
metrics.num.samples 如何影响records-lag-max 的计算?
i dont think it has any effect.我不认为它有任何影响。
records-lag-* is driven by latest-offset field of the fetch response struct, which tells the client where the "edge" of a partition is on the broker. records-lag-* 由 fetch 响应结构的 latest-offset 字段驱动,它告诉客户端分区的“边缘”在代理上的位置。 the client then compares that offset to the latest offset returned in the actual fetch response to figure out how many records it is "behind" the broker.
然后,客户端将该偏移量与实际获取响应中返回的最新偏移量进行比较,以确定它在代理“后面”有多少条记录。
these metrics update every time a fetch response is received from broker(s), and if you query them before any such fetch responses have arrived you may see 0.每次从代理收到获取响应时,这些指标都会更新,如果您在任何此类获取响应到达之前查询它们,您可能会看到 0。
on the other hand kafka-consumer-groups shows you not where any particular consumer "is" (latest offsets delivered to that consumer), but what offsets that consumer last checkpointed to kafka.另一方面,kafka-consumer-groups 不会向您显示任何特定消费者“在哪里”(交付给该消费者的最新偏移量),而是该消费者上次检查点到 kafka 的偏移量。 consumers checkpoint offsets periodically (typically once every 30-60 seconds) and so describing a consumer group can show non-0 lag where the metrics on the consumers themselves (which are updated more frequently) will show 0.
消费者检查点定期偏移(通常每 30-60 秒一次),因此描述消费者组可以显示非 0 滞后,而消费者本身的指标(更新更频繁)将显示 0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.