Klag


Kafka Consumer Lag Exporter — Know when your consumers fall behind, before it becomes a problem.
Inspired by kafka-lag-exporter (archived 2024). Built with Vert.x and Micrometer.
Migrating from kafka-lag-exporter? See the migration guide (metric/label/config mapping + drop-in dashboard tips).
📖 Documentation lives at klag.dev
Full guides — configuration, Kafka ACLs, Helm/Strimzi deployment, integrations,
metrics reference, and development — are at klag.dev.
AI agents: a machine-readable corpus is at klag.dev/llms.txt.
The docs source lives in website/ (Astro + Starlight).
🤖 Install with your AI agent
In Claude Code: /plugin marketplace add themoah/klag → /plugin install klag@klag → /klag:install.
It detects Docker/Kubernetes/ArgoCD/Strimzi, deploys, verifies metrics, and can wire up the MCP
endpoint (/klag:connect, /klag:diagnose). Copilot, Codex, Cursor, OpenCode and others:
klag.dev/agent-setup.
Scales to large clusters: Monitors thousands of consumer groups in ~50MB heap. Request batching with configurable delays prevents overwhelming brokers — fetch offsets for 500+ groups without spiking cluster CPU.
Why Klag?
Consumer lag is the gap between what Kafka has produced and what your consumers have processed. Left unmonitored, growing lag leads to stale downstream data, memory pressure as consumers struggle to catch up, and silent failures when groups die without alerts. Klag continuously monitors all consumer groups and exposes metrics to your observability stack.
Key Features
| Feature | Why It Matters |
|---|
| Lag velocity | Know if lag is growing or shrinking — catch problems before they escalate |
| Time-based lag estimation | See lag in seconds/minutes, not just message counts |
| Hot partition detection | Find partitions with uneven load causing bottlenecks |
| Consumer group state tracking | Alert on Rebalancing, Dead, or Empty states |
| Data loss prevention | Alert before lag exceeds retention and data is lost |
| Request batching | Safely monitor large clusters without overwhelming brokers |
| AI-native | Opt-in read-only MCP endpoint for SRE/dev agents |
Sinks: Prometheus, Datadog, OTLP (Grafana Cloud, New Relic, etc.), StatsD/DogStatsD. See integrations.
How Klag compares
Klag, Burrow, and KMinion all monitor Kafka consumer lag. They differ in what they measure and where they send it.
| Feature | Klag | Burrow | KMinion |
|---|
| Lag in messages | ✅ | ✅ | ✅ |
| Consumer group state | ✅ | ✅ | ✅ |
| Lag velocity (growing/shrinking) | ✅ | ⚠️ status only | ❌ |
| Time-based lag + time-to-catch-up | ✅ | ❌ | ❌ |
| Hot partition detection | ✅ | ❌ | ❌ |
| Data loss / retention alerting | ✅ | ❌ | ❌ |
| Lag status rules + notifiers | ❌ | ✅ | ❌ |
| Prometheus / Datadog / OTLP native | ✅ | ⚠️ exporter / ❌ / ❌ | ✅ / ❌ / ❌ |
| AI agent endpoint (MCP) | ✅ | ❌ | ❌ |
| Read-only ACLs (DESCRIBE only) | ✅ | ✅ | ⚠️ writes for e2e |
Quick Start
docker run -e KAFKA_BOOTSTRAP_SERVERS=kafka:9092 \
-e METRICS_REPORTER=prometheus \
-p 8888:8888 \
themoah/klag:latest