Monitoring Akka Streams Kafka (Alpakka) Apps with Prometheus in Kubernetes

Scraping Consumer and Producer Metrics from any Scala or Java App

Jeroen Rosenberg
The Startup
Published in
6 min readJul 4, 2019

--

TL;DR

This post focuses on monitoring your Kafka deployment in Kubernetes with Prometheus. Kafka exposes its metrics through JMX and so it does as well for apps using its Java SDK. To be able to have those metrics pulled in by Prometheus we need a way to extract them using the JMX protocol and expose them. This is where JMX Exporter comes in handy. It’s pretty effective to run this as a sidecar in your Kafka client application pods and have Prometheus scrape them using scrape annotations. For the impatient: all sample code is available here.

In my previous article “Monitoring Kafka in Kubernetes” I mainly focused on monitoring the server side of Kafka, while in this post we’re going to have a look at gathering and plotting its client side metrics.

Why to Monitor Kafka Client Applications

Message passing is becoming more and more a popular choice for sharing data between different apps, making tools like Kafka become the backbone of your architecture. A well-functioning Kafka cluster is able to handle lots of data, but poor performance or a degradation in Kafka cluster health will…

--

--

Jeroen Rosenberg
The Startup

Dev of the Ops. Founder of Amsterdam.scala. Passionate about Agile, Continuous Delivery. Proud father of three.