Kafka exposes hundreds of metrics, and the usual first dashboard shows most of them. That's how teams end up with a wall of charts and an outage nobody saw coming. Good Kafka monitoring is mostly about choosing: a handful of signals that mean someone must act now, a few that mean something is degrading, and everything else on dashboards for investigation.
This guide lists the signals we start with. Metric names are Apache Kafka's JMX names; Confluent and the managed services expose the same ideas, sometimes under different names.
Replication health
| Metric | Healthy | When it moves |
|---|---|---|
OfflinePartitionsCount (controller) | 0 | Partitions with no leader: producers and consumers on them are stopped. Page. |
UnderMinIsrPartitionCount (broker) | 0 | Fewer in-sync replicas than min.insync.replicas: producers with acks=all are being refused. Page. |
UnderReplicatedPartitions (broker) | 0 | A follower has fallen behind: a broker down, a slow disk, network trouble. Brief spikes during restarts are normal; sustained values are not. |
IsrShrinksPerSec / IsrExpandsPerSec | near 0 | Replicas repeatedly dropping out of and rejoining the ISR usually means a struggling broker or network. |
The controller
ActiveControllerCount summed across the cluster should be exactly 1. Zero means no controller is managing the cluster (no leader
elections, no topic changes); more than one points to a split-brain problem. On KRaft clusters, also watch the controller quorum's health and
metadata log lag.
Brokers: latency and saturation
- Request latency:
TotalTimeMsforProduce,FetchConsumerandFetchFollowerrequests, at the 99th percentile. Its breakdown (request queue, local, remote, response queue times) tells you where time goes: remote time on produce is waiting for followers, which points at replication. - Thread saturation:
RequestHandlerAvgIdlePercentandNetworkProcessorAvgIdlePercent. Sustained low idle means the broker is CPU- or thread-bound; latency will follow. - Throughput:
BytesInPerSec,BytesOutPerSecandMessagesInPerSec, per broker and per topic, for capacity planning and to spot an unbalanced cluster. - The host: disk usage (retention that doesn't fit the disk ends badly), disk latency, network and JVM garbage-collection pauses.
Consumer lag
Lag is the difference between a partition's latest offset and the consumer group's committed offset. It is the metric your users feel, and the most misread:
- Lag that is large but stable is often fine: a batch consumer that catches up on a schedule.
- Lag that keeps growing means the group is consuming slower than producers write. That's the alert.
- Lag in time (how old is the oldest unconsumed message?) is more useful for SLAs than lag in messages, because message rates vary.
Measure lag from outside the consumer (with a lag exporter or the platform's own lag metrics) rather than relying only on the client's
records-lag-max, because a consumer that has crashed reports nothing.
Clients
Producer record-error-rate and record-retry-rate, request latency from the client's side, and consumer group
rebalances. Frequent rebalances, usually from consumers exceeding max.poll.interval.ms or from deployments without cooperative
rebalancing (or, on Kafka 4.x, without the new consumer group protocol from KIP-848), stop consumption each time and show up as saw-tooth lag.
Connect and the rest
For Kafka Connect: connector and task state (a failed task doesn't restart on its own), and per-task throughput and errors. For CDC source connectors, the database side too, for example replication slot lag on PostgreSQL. For Schema Registry: availability and compatibility-check failures, which show producers trying to publish breaking changes.
Managed services
On a managed service, the provider watches the brokers' hardware, and some broker metrics aren't exposed at all. Replication health, throughput against your limits, request latency, consumer lag and client errors still matter, and they are still yours to alert on; most providers publish them through a metrics API you can scrape into your own monitoring.
A starter alert set
Thresholds depend on your cluster and SLAs, so this table describes the conditions rather than numbers:
| Condition | Tier | Goes to |
|---|---|---|
| Any offline partition | Page | Platform team |
| Partitions under min ISR | Page | Platform team |
| Active controller count not equal to 1 | Page | Platform team |
| Consumer lag in time above the pipeline's SLA, and growing | Page | Owning application team |
| Under-replicated partitions for longer than a restart takes | Attention | Platform team |
| Disk usage trending towards full within days | Attention | Platform team |
| Connector task in failed state | Attention | Connector owner |
| Rising producer error or retry rate | Attention | Owning application team |
Collecting the metrics
Apache Kafka publishes metrics over JMX. The usual open-source route is a JMX exporter running as a Java agent on each broker, scraped by Prometheus and drawn in Grafana; commercial tools such as Datadog, New Relic and AppDynamics have their own Kafka integrations. Whichever you use, collect client metrics too, from the applications themselves, because a broker cannot tell you that a consumer is stuck in a retry loop.
How to decide what pages someone
- Does it mean users or data are affected now, or will be within the hour? If not, it is not a page.
- Can the person receiving it do something about it? If not, route it elsewhere.
- Has it fired before without needing action? Then the threshold or the condition is wrong.
Turning signals into runbooks
- For every paging alert, write the first three things to check and the usual causes.
- Keep dashboards per consumer group and per topic, linked from the alert.
- Review alerts monthly: an alert that fired and needed no action should be changed or removed.
- Test the alerts: stop a broker in a test environment and confirm the right people are paged with the right information.
Monitoring also tells you each step of a migration worked; see cutting over without a big bang. For the authentication and authorization failures worth alerting on, see securing Kafka.
Questions we are often asked
Should we alert on lag in messages or in time?
In time, where your tooling can measure it. A thousand messages of lag is nothing on a busy topic and hours of delay on a quiet one; how old the oldest unread message is maps directly to an SLA.
Do the metrics change with KRaft?
Broker metrics stay largely the same. ZooKeeper monitoring is replaced by monitoring the controller quorum, so dashboards and alerts built around ZooKeeper need revisiting when a cluster moves to KRaft, which every cluster must do before upgrading to Kafka 4.0 or later, since 4.0 removed ZooKeeper.
We have hundreds of consumer groups. Do they all need alerts?
Every group should have lag measured and an owner. Paging alerts belong on groups behind an SLA; the rest can sit on dashboards until someone decides they matter.