Quick revision
The short answer
Collect broker and controller JMX metrics with the Prometheus JMX exporter or an OpenTelemetry collector, using an allowlist so per-partition series do not explode, plus host metrics for disk, network, CPU and page cache. Compute consumer lag for every group from the broker side by comparing committed offsets with log end offsets, run synthetic canary producers and consumers that touch every broker to catch failures metrics miss, and collect client metrics through Micrometer or KIP-714 push. The platform team sees cluster health, saturation and capacity, while each application team sees its own topics, groups, lag, throttling and errors, with alerts routed to the owning team.
What to remember
In this answer, we designed one monitoring pipeline with two views. Brokers, controllers and hosts are scraped through the JMX exporter or an OpenTelemetry collector with an allowlist, lag is computed for every group from the broker side, canaries test the cluster the way a client does, and applications contribute client metrics through Micrometer or KIP-714. The platform team sees health, saturation and capacity, application teams see their own topics, groups and errors, and alerts go to whoever owns the resource.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Collect broker and controller JMX metrics with the Prometheus JMX exporter or an OpenTelemetry collector, using an allowlist so per-partition series do not explode, plus host metrics for disk, network, CPU and page cache. Compute consumer lag for every group from the broker side by comparing committed offsets with log end offsets, run synthetic canary producers and consumers that touch every broker to catch failures metrics miss, and collect client metrics through Micrometer or KIP-714 push. The platform team sees cluster health, saturation and capacity, while each application team sees its own topics, groups, lag, throttling and errors, with alerts routed to the owning team.
Why this question is asked
A shared Kafka cluster has two groups of people asking different questions. The platform team asks whether the cluster is healthy and how much room is left. An application team asks why its consumer is behind or why its sends are slow. A design that serves only the first group makes the platform team a help desk; one that serves only the second hides the causes. Interviewers ask this to see whether we can design monitoring as a product with users, not as a pile of graphs. In this answer, we will sketch the overall pipeline, collect broker and host metrics safely, compute lag from the broker side, add synthetic canaries, bring in client metrics, and design the two sets of dashboards and alert routing.
1One Pipeline, Two Audiences
All signals flow through one pipeline: sources on the brokers, controllers, hosts and clients, a collection layer, a time-series store such as Prometheus or a compatible long-term store, and on top of that dashboards and alerts. The two audiences differ only in the top layer, in what they see and which alerts reach them. Keeping one pipeline means both groups look at the same numbers, which ends the arguments about whose graph is right.
- Dashboards and alert routingplatform views, team views, alerts to owners
- Time-series storePrometheus or compatible long-term store
- CollectorsJMX exporter or OTel collector, lag exporter, canaries
- Sources30 brokers, 3 controllers, hosts, 80 applications
4 layers, from the top down. Step through them one at a time.
2Collecting Broker, Controller and Host Metrics
Brokers and controllers expose their metrics through JMX. We collect them with the Prometheus JMX exporter running as a Java agent inside each process, or with an OpenTelemetry collector reading JMX, and we always use an allowlist. Without one, every per-partition and per-client metric is exported: a cluster of 30 brokers with a few thousand replicas each easily produces millions of series, and the monitoring system falls over before the cluster does.
The option name for the allowlist changed between exporter releases, so check your version. Next to JMX, a host agent such as the node exporter collects disk use per log directory, disk I/O, network throughput, CPU and memory, including how much is used by the page cache, because many Kafka problems show up first at the host level.
3Consumer Lag From the Broker Side
Consumer lag is the number of records between a group's committed offset and the end of the log, per partition. A consumer can report its own lag, but a consumer that has crashed or hangs reports nothing, which is exactly when lag matters most. So we compute lag from the broker side with a lag exporter (tools such as Burrow, KMinion or a Kafka lag exporter) that regularly reads every group's committed offsets and every partition's log end offset and subtracts them.
The exporter does the same subtraction for every group all the time and publishes lag per group and topic, plus a time-based estimate of how far behind the group is. Notice that the dash in the consumer column is the case a client-side metric would never report: the partition is not assigned and nothing is reading it.
4Synthetic Canaries: Catching What Metrics Miss
Some failures leave every broker metric healthy. A broken listener, a DNS record pointing to an old address, an expired certificate or a wrong ACL stops clients from connecting, but the brokers see no traffic and so report nothing wrong. To catch these we act like a client ourselves. A canary is a small producer and consumer, run per cluster from outside the brokers, writing to a canary topic whose partitions are spread so that each broker leads at least one. It sends a timestamped record to every partition every few seconds, reads them back, and reports success rate and end-to-end latency per broker.
5 messages in order. Play them, or step through them one at a time.
If broker 7's listener or certificate breaks, this round fails even though broker 7's own metrics look fine.
5Client Metrics From the Applications
Client metrics show what applications actually feel: send latency, error and retry rates, throttle time, rebalance counts. Spring Kafka makes this easy because Spring Boot registers Micrometer listeners on the producer and consumer factories, so the Kafka client metrics appear under the application's normal metrics endpoint with tags such as the client id. We ask every team to scrape them into the same store and to set a stable, meaningful client.id.
Since Kafka 3.7, clients can also push their metrics to the brokers (KIP-714), which lets the platform team see client metrics even for applications it does not monitor. Brokers only accept and forward them when a plugin that receives client telemetry is configured, so without such a plugin nothing is collected; check what your distribution provides.
6What Each Audience Sees
The platform team's dashboards answer one question: is the cluster healthy and how much room is left. Application teams' dashboards answer: is my data flowing and if not, is it me or the platform. Both are built from the same series, filtered differently.
| Dashboard | Platform team | Application team |
|---|---|---|
| Health | Offline, under-min-ISR, controller quorum | Canary success for their cluster |
| Traffic | Bytes in and out per broker and zone | Bytes in and out of their topics |
| Saturation | Thread idle, p99 request time, disk | Their throttle time and quota use |
| Consumers | Groups with most lag, rebalance storms | Lag and time behind per group |
| Errors | Authorization denials, failed logins | Their send errors and retries |
Alerts follow ownership. Each consumer group and topic has an owning team in the platform catalogue, so a lag alert for group billing goes to the billing team, not to the platform on-call. The platform on-call gets cluster-level alerts and canary failures. That routing keeps the platform team from becoming the first responder for every slow consumer.
7Follow-up questions
Why compute lag on the broker side when consumers expose records-lag-max?
Because a consumer that is down or stuck exports nothing, so client-side lag disappears exactly when it is most needed. The broker side always knows the committed offset and the log end offset, so it can show lag for every group, including dead ones.
How many partitions does the canary topic need?
Enough that every broker leads at least one partition, so 30 or more for 30 brokers, with replication factor 3. After adding brokers or a reassignment we check that each broker still leads one, otherwise a broker could break without the canary noticing.
What does the platform team do with client metrics?
It uses them to spot misbehaving clients, such as producers with tiny batches, frequent reconnects or high throttle times, and to separate client problems from broker problems when a team reports slowness.
8Conclusion
In this answer, we designed one monitoring pipeline with two views. Brokers, controllers and hosts are scraped through the JMX exporter or an OpenTelemetry collector with an allowlist, lag is computed for every group from the broker side, canaries test the cluster the way a client does, and applications contribute client metrics through Micrometer or KIP-714. The platform team sees health, saturation and capacity, application teams see their own topics, groups and errors, and alerts go to whoever owns the resource.
Open with
I would build one pipeline and two views. Brokers and controllers export JMX through the Prometheus JMX exporter or an OpenTelemetry collector, with an allowlist so per-partition and per-client series do not explode, and a host agent adds disk, network, CPU and page cache.
Then, if they want more
For consumer lag I would not rely on the consumers, because a dead consumer reports nothing. A lag exporter on the broker side compares each group's committed offsets with the log end offsets for every group and publishes lag and time behind.
Then I would add synthetic canaries: a small producer and consumer per cluster, writing to a topic where every broker leads a partition, measuring availability and end-to-end latency. They catch things broker metrics miss, like a broken listener, DNS, an expired certificate or an ACL change.
Applications export client metrics through Micrometer, which Spring Kafka wires up, and since 3.7 clients can push metrics to brokers under KIP-714 if the brokers run a receiving plugin. For dashboards, the platform team sees cluster health, controller quorum, saturation and capacity. Each application team sees its topics, groups, lag, throttling and errors.
Alerts follow ownership from the topic catalogue, so a lag alert for a group goes to the team that owns it, and the platform on-call gets cluster and canary alerts.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Kafka 3.7
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Design the monitoring for a 30-broker Kafka 4.x cluster serving 80 applications: what...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/341c6768c7/