Integration / Apache Kafka Interview questions
How does Kafka report and expose broker and consumer metrics for monitoring?
Kafka brokers, producers, and consumers all expose a large set of runtime metrics via JMX (Java Management Extensions) by default, covering everything from request latency and throughput to under-replicated partition counts and consumer lag — the same interface most JVM applications use for observability, not a Kafka-specific mechanism.
# run with a JMX exporter agent to expose metrics for Prometheus scraping -javaagent:/opt/jmx_prometheus_javaagent.jar=7071:/opt/kafka-metrics.yml
A few metrics matter especially for day-to-day health checks: UnderReplicatedPartitions (non-zero means some replica has fallen behind and durability is degraded), RequestHandlerAvgIdlePercent (a broker running consistently low signals it's saturated), and consumer-side lag (covered separately via kafka-consumer-groups.sh --describe, since it isn't a simple JMX broker metric). Because raw JMX isn't directly scrapable by tools like Prometheus, most production setups run a JMX-to-Prometheus exporter agent alongside each broker/client JVM, feeding metrics into standard dashboards (Grafana) and alerting pipelines rather than relying on manual JMX console inspection.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
