// This assembly is included in the following assemblies:
//
// deploying/deploying.adoc

[id='assembly-metrics-{context}']
= Introducing metrics

[role="_abstract"]
Collecting metrics is essential for understanding the health and performance of your Kafka deployment. 
By monitoring metrics, you can actively identify issues before they become critical and make informed decisions about resource allocation and capacity planning. 
Without metrics, you may be left with limited visibility into the behavior of your Kafka deployment, which can make troubleshooting more difficult and time-consuming. 
Setting up metrics can save you time and resources, and help ensure the reliability of your Kafka deployment.

Metrics can be collected from Strimzi components using Prometheus and visualized in Grafana.
Prometheus collects metrics from running pods in your cluster when configured with appropriate rules. 
Grafana visualizes these metrics on dashboards, providing an intuitive interface for monitoring. 

While the Strimzi operators expose their own Prometheus metrics by default, such as reconciliation counts and durations, JVM data, and resource processing statistics, other Strimzi components and features that support metrics, including OAuth 2.0 integration, require configuration to expose them.

Strimzi provides example Prometheus rules and Grafana dashboards, which you can customize to fit your deployment. 
These tools help visualize metrics and define alerts based on specific conditions.
Additionally, you can configure your deployment to track messages end-to-end by xref:assembly-distributed-tracing-str[setting up distributed tracing].

NOTE: Strimzi provides example installation files for Prometheus and Grafana to help get you started. 
For further support, refer to the Prometheus and Grafana developer communities.

.Supporting documentation for metrics and monitoring tools
For more information on the metrics and monitoring tools, refer to the supporting documentation:

* {PrometheusHome}
* {PrometheusConfig}
* {kafka-exporter-project}
* {GrafanaHome}
* link:http://kafka.apache.org/documentation/#monitoring[Apache Kafka Monitoring^] describes JMX metrics exposed by Apache Kafka

//what is Consumer lag?
include::../../modules/metrics/con_kafka-exporter-lag.adoc[leveloffset=+1]
//Understanding metrics for Cruise Control
include::../../modules/metrics/con-metrics-cruise-control.adoc[leveloffset=+1]
//Example metrics files
include::assembly-metrics-config-files.adoc[leveloffset=+1]
//How to set up Prometheus
include::assembly_metrics-prometheus-setup.adoc[leveloffset=+1]
//How to add Grafana dashboards
include::../../modules/metrics/proc_metrics-grafana-dashboard.adoc[leveloffset=+1]
//How to monitor custom resources managed by Strimzi
include::../../modules/metrics/proc_metrics-custom-resource-monitoring.adoc[leveloffset=+1]
