How to collect Kafka configuration as metrics?
Unlike other distrusted systems (i.e Aerospike), Kafka does not expose its configurations as metrics.
It makes sense in a way, config parameters and metrics are not the same, and most of the time you cannot represent configurations as metrics (
But there are few useful configuration parameters that might be beneficial to collect in order to improve the visibility and alerting over Kafka in particular.
A good example might be
log.retention.ms parameter per topic, which can be integrated into Kafka’s dashboards to extend its visibility, or to integrate it into an alerting query to create smarter alerts or automation based on topic retention.
So how can we do so?
“Kafka Configs Metrics Exporter”
I decided to create a Prometheus exporter to collect those metrics, using Kafka’s
AdminClient to quickly pull all the config parameters that can be represented as metrics, expressly, can be converted into
After deploying the exporter and point it to your desired Kafka cluster, you will be able to query your metrics data source and create amazing graphs and alerts based on it!