// Module included in the following assemblies:
//
// metrics/assembly_metrics-kafka-exporter.adoc

[id='ref-metrics-kafka-exporter-{context}']

= Exposing Kafka Exporter metrics

Lag information is exposed by Kafka Exporter as Prometheus metrics for presentation in Grafana. 

Kafka Exporter exposes metrics data for brokers, topics and consumer groups. 
These metrics are displayed on the example `strimzi-kafka-exporter` dashboard.

The data extracted is described here.

.Broker metrics output

[table,stripes=none]
|===
|Name |Information

|`kafka_brokers`
|Number of brokers in the Kafka cluster
|===

.Topic metrics output

[table,stripes=none]
|===
|Name |Information

|`kafka_topic_partitions`
|Number of partitions for a topic
|`kafka_topic_partition_current_offset`
|Current topic partition offset for a broker
|`kafka_topic_partition_oldest_offset`
|Oldest topic partition offset for a broker
|`kafka_topic_partition_in_sync_replica`
|Number of in-sync replicas for a topic partition
|`kafka_topic_partition_leader`
|Leader broker ID of a topic partition
|`kafka_topic_partition_leader_is_preferred`
|Shows `1` if a topic partition is using the preferred broker
|`kafka_topic_partition_replicas`
|Number of replicas for this topic partition
|`kafka_topic_partition_under_replicated_partition`
|Shows `1` if a topic partition is under-replicated
|===

.Consumer group metrics output

[table,stripes=none]
|===
|Name |Information

|`kafka_consumergroup_current_offset`
|Current topic partition offset for a consumer group
|`kafka_consumergroup_lag`
|Current approximate lag for a consumer group at a topic partition
|===

Consumer group metrics are only displayed on the Kafka Exporter dashboard if at least one consumer group has a lag greater than zero.
