Scrivio Interview library
DesignIntermediate6 min read · updated 13 November 2026

A large shared Kafka cluster needs monitoring that serves two audiences: the platform team that runs it and the application teams that depend on it.

Design the monitoring for a 30-broker Kafka 4.x cluster serving 80 applications: what you collect and how, how you watch clients and consumer lag, how you detect problems that broker metrics miss, and what the dashboards show to the platform team versus the application teams.

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.

Step throughMonitoring pipeline for a shared cluster
  1. Dashboards and alert routingplatform views, team views, alerts to owners
  2. Time-series storePrometheus or compatible long-term store
  3. CollectorsJMX exporter or OTel collector, lag exporter, canaries
  4. 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.

YAML
# jmx_exporter config (agent on each broker): export only what we use
includeObjectNames:
- "kafka.server:type=ReplicaManager,*"
- "kafka.controller:type=KafkaController,*"
- "kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec,*"
- "kafka.server:type=BrokerTopicMetrics,name=BytesOutPerSec,*"
- "kafka.network:type=RequestMetrics,name=TotalTimeMs,request=Produce"
- "kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchConsumer"
- "kafka.server:type=KafkaRequestHandlerPool,*"
- "kafka.network:type=SocketServer,*"
- "kafka.log:type=LogManager,*"
# kafka.log:type=Log,* (per-partition size and offsets) is left out on purpose

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.

Properties
kafka-consumer-groups.sh --bootstrap-server kafka-1:9092 --describe --group billing
# GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID
# billing orders 0 1834201 1834290 89 consumer-1-...
# billing orders 1 1790010 1912333 122323 - <- nobody consuming

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.

Step throughOne canary round
Canary producerBroker 7 (leader of p7)Canary consumerPrometheus
send record with timestamp to partition 7
ack
fetch partition 7
record
availability and end-to-end latency for broker 7

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.

Two sets of dashboards
DashboardPlatform teamApplication team
HealthOffline, under-min-ISR, controller quorumCanary success for their cluster
TrafficBytes in and out per broker and zoneBytes in and out of their topics
SaturationThread idle, p99 request time, diskTheir throttle time and quota use
ConsumersGroups with most lag, rebalance stormsLag and time behind per group
ErrorsAuthorization denials, failed loginsTheir 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.

What to say in the interviewAbout 90 seconds aloud

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/