// This module is included in:
//
// overview/assembly-metrics-overview.adoc

[id="metrics-overview-tools-{context}"]
= Prometheus

Prometheus can extract metrics data from Kafka components and the Strimzi Operators.

To use Prometheus to obtain metrics data and provide alerts, Prometheus and the Prometheus Alertmanager plugin must be deployed.
Kafka resources must also be deployed or redeployed with metrics configuration to expose the metrics data.

Prometheus scrapes the exposed metrics data for monitoring.
Alertmanager issues alerts when conditions indicate potential problems, based on pre-defined alerting rules. 

Sample metrics and alerting rules configuration files are provided with Strimzi.
The sample alerting mechanism provided with Strimzi is configured to send notifications to a Slack channel.

[id="metrics-overview-grafana_{context}"]
= Grafana

Grafana uses the metrics data exposed by Prometheus to present dashboard visualizations for monitoring.

A deployment of Grafana is required, with Prometheus added as a data source.
Example dashboards, supplied with Strimzi as JSON files, are imported through the Grafana interface to present monitoring data.

[id="metrics-overview-exporter_{context}"]
= Kafka Exporter

Kafka Exporter is an open source project to enhance monitoring of Apache Kafka brokers and clients.
Kafka Exporter is deployed with a Kafka cluster to extract additional Prometheus metrics data from Kafka brokers related to offsets, consumer groups, consumer lag, and topics.
You can use the Grafana dashboard provided to visualize the data collected by Prometheus from Kafka Exporter.

A sample configuration file, alerting rules and Grafana dashboard for Kafka Exporter are provided with Strimzi.

[id="metrics-overview-tracing_{context}"]
= Distributed tracing

Within a Kafka deployment, distributed tracing using Jaeger is supported for:

* MirrorMaker to trace messages from a source cluster to a target cluster
* Kafka Connect to trace messages consumed and produced by Kafka Connect
* Kafka Bridge to trace messages consumed and produced by Kafka Bridge, and HTTP requests from client applications

Template configuration properties are set for the Kafka resources, which describe tracing environment variables.

[discrete]
== Tracing for Kafka clients
Client applications, such as Kafka producers and consumers, can also be set up so that transactions are monitored.
Clients are configured with a tracing profile, and a tracer is initialized for the client application to use.

[id="metrics-overview-cruisecontrol_{context}"]
= Cruise Control

Cruise Control is an open source project for simplifying the monitoring and balancing of data across a Kafka cluster.
Cruise Control is deployed alongside a Kafka cluster to monitor its traffic, propose more balanced partition assignments, and trigger partition reassignments based on those proposals.

Cruise Control collects resource utilization information to model and analyze the workload of the Kafka cluster.
Based on _optimization goals_ that have been defined, Cruise Control generates _optimization proposals_ outlining how the cluster can be effectively rebalanced.
When an _optimization proposal_ is approved, Cruise Control applies the rebalancing outlined in the proposal.

Prometheus can extract Cruise Control metrics data, including data related to optimization proposals and rebalancing operations.
A sample configuration file and Grafana dashboard for Cruise Control are provided with Strimzi.
