Monday 1 May 2023

Calculate Kafka Consumer lag programmatically

In this blog we will discuss how to programmatically calculate offset lag in a kafka consumer group for a topic partition. Below is an example of  which is a command line tool to calculate offset lag for a consumer group.

Kafka consumer group Command output
Sometimes we don’t have access to the production Kafka environment. For such scenarios we can calculate offset Lag programmatically for a consumer group.