# Potential Issue in Consumer Lag Calculation on Kafka Metrics Overview Dashboard

**URL:** <https://discuss.elastic.co/t/potential-issue-in-consumer-lag-calculation-on-kafka-metrics-overview-dashboard/378164>\
**Category:** Kibana\
**Created:** [May 15, 2025, 7:29am UTC](https://discuss.elastic.co/t/potential-issue-in-consumer-lag-calculation-on-kafka-metrics-overview-dashboard/378164 "2025-05-15T07:29:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mudboyzh](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mudboyzh](https://discuss.elastic.co/u/Mudboyzh)\
**Post date:** [May 15, 2025, 7:29am UTC](https://discuss.elastic.co/t/potential-issue-in-consumer-lag-calculation-on-kafka-metrics-overview-dashboard/378164/1 "2025-05-15T07:29:06Z")

</div>

I noticed that the **Consumer Lag** calculation in the **[Metrics Kafka] Overview** dashboard (8.16.0) provided by the Kafka Integration might be incorrect.

I also have a Kafka UI set up for comparison, and the consumer lag values displayed on the dashboard are significantly lower than those shown in the Kafka UI for each topic.

Upon investigation, I found that the logic behind the lens groups data by topic and then takes the **maximum** value. However, the consumer lag metrics collected by the Elastic Agent are actually recorded **per topic and partition**.

Therefore, the correct consumer lag for a topic should be the **sum of the consumer lag values across all partitions** at the time of collection, rather than simply using the maximum value.

It seems that this logic cannot be implemented using **Lens**. I attempted to recreate the calculation using **TSVB** , but I'm unsure whether my approach is accurate or if there's a better way to achieve the correct calculation.

Any suggestions or guidance would be greatly appreciated. Thanks.

- Default lens of consumer lag in the dashboard.  

- The metric of consumer lag  

- Recreating with TSVB
