Skip to content

Klag: Kafka Consumer Lag Exporter

Know when your consumers fall behind, before it becomes a problem.

Consumer lag is the gap between what Kafka has produced and what your consumers have processed. Left unmonitored, growing lag means stale downstream data, memory pressure, and silent failures when consumer groups die. Klag continuously monitors every consumer group and ships the metrics to your observability stack.

Lag velocity

Know if lag is growing or shrinking, and catch problems before they escalate.

Time-based lag

See lag in seconds/minutes, with time-to-close estimates, instead of raw message counts.

Hot partition detection

Find partitions with uneven load causing bottlenecks, via statistical outliers.

Group state tracking

Alert on Rebalancing, Dead, or Empty consumer-group states.

Data loss prevention

Alert before lag exceeds retention and messages are lost forever.

Request batching

Safely monitor large clusters without overwhelming brokers.

Terminal window
docker run -e KAFKA_BOOTSTRAP_SERVERS=kafka:9092 \
-e METRICS_REPORTER=prometheus \
-p 8888:8888 \
themoah/klag:latest

Metrics land at http://localhost:8888/metrics. See the Quick Start for native image, Helm, and Docker env-file options.

Klag exposes an opt-in, read-only MCP endpoint so SRE and dev agents can query lag, find lagging groups, and run composite diagnose checks, served from an in-memory snapshot, never touching your brokers.


Inspired by kafka-lag-exporter (archived 2024). Read the introductory blog post.