Skip to content

Commit 62601a6

Browse files
Update assemblies and modules Docs for Metrics Reporter integration (strimzi#11329)
Signed-off-by: OwenCorrigan76 <owencorrigan76@gmail.com>
1 parent f528b15 commit 62601a6

8 files changed

Lines changed: 134 additions & 30 deletions

documentation/assemblies/metrics/assembly-metrics-config-files.adoc

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,20 @@ metrics
3939
│ ├── prometheus-rules.yaml <7>
4040
│ ├── prometheus.yaml <8>
4141
│ └── strimzi-pod-monitor.yaml <9>
42-
├── kafka-bridge-metrics.yaml <10>
43-
├── kafka-connect-metrics.yaml <11>
44-
├── kafka-cruise-control-metrics.yaml <12>
45-
├── kafka-metrics.yaml <13>
46-
├── kafka-mirror-maker-2-metrics.yaml <14>
47-
└── oauth-metrics.yaml <15>
42+
├── strimzi-metrics-reporter
43+
| ├── grafana-dashboards <10>
44+
| | ├── strimzi-kafka.json
45+
| | ├── strimzi-kraft.json
46+
| └── kafka-metrics.yaml <11>
47+
├── kafka-bridge-metrics.yaml <12>
48+
├── kafka-connect-metrics.yaml <13>
49+
├── kafka-cruise-control-metrics.yaml <14>
50+
├── kafka-metrics.yaml <15>
51+
├── kafka-mirror-maker-2-metrics.yaml <16>
52+
└── oauth-metrics.yaml <17>
4853

4954
--
50-
<1> Example Grafana dashboards for the different Strimzi components.
55+
<1> Grafana dashboards for components using the JMX Exporter.
5156
<2> Installation file for the Grafana image.
5257
<3> Kube-state-metrics deployment and configuration files for custom resource monitoring.
5358
<4> Additional configuration to scrape metrics for CPU, memory and disk volume usage, which comes directly from the Kubernetes cAdvisor agent and kubelet on the nodes.
@@ -56,19 +61,28 @@ metrics
5661
<7> Alerting rules examples for use with Prometheus Alertmanager (deployed with Prometheus).
5762
<8> Installation resource file for the Prometheus image.
5863
<9> PodMonitor definitions translated by the Prometheus Operator into jobs for the Prometheus server to be able to scrape metrics data directly from pods.
59-
<10> Kafka Bridge resource with metrics enabled.
60-
<11> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for Kafka Connect.
61-
<12> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for Cruise Control.
62-
<13> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for Kafka.
63-
<14> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for MirrorMaker 2.
64-
<15> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for OAuth 2.0.
64+
<10> Grafana dashboards for components using the Strimzi Metrics Reporter.
65+
<11> Resource for deploying and configuring Strimzi Metrics Reporter based Kafka.
66+
<12> Kafka Bridge resource with metrics enabled.
67+
<13> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for Kafka Connect.
68+
<14> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for Cruise Control.
69+
<15> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for Kafka.
70+
<16> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for MirrorMaker 2.
71+
<17> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for OAuth 2.0.
6572

6673
NOTE: The Prometheus JMX Exporter collects Java Management Extensions (JMX) from Kafka components and converts them into Prometheus metrics.
6774
You do not require `jmxOptions` configuration in the custom resource of the component for the Prometheus JMX Exporter to function.
6875
`jmxOptions` is only required if you need direct access to JMX from Kafka components.
6976

70-
//Example Prometheus metrics files
71-
include::../../modules/metrics/ref-prometheus-metrics-config.adoc[leveloffset=+1]
77+
Strimzi uses the {StrimziMetricsReporter} or the {JMXExporter} to expose metrics through an HTTP endpoint, which can be scraped by the Prometheus server.
78+
79+
Strimzi provides example custom resource configuration YAML files with relabeling rules.
80+
When deploying Prometheus metrics configuration, you can deploy the example custom resource or copy the metrics configuration to your own custom resource definition.
81+
82+
//Example Prometheus JMX metrics files
83+
include::../../modules/metrics/ref-prometheus-jmx-metrics-config.adoc[leveloffset=+1]
84+
//Example Strimzi metrics reporter files
85+
include::../../modules/metrics/ref-strimzi-metrics-reporter-config.adoc[leveloffset=+1]
7286
//Example Prometheus alert rules
7387
include::../../modules/metrics/ref_metrics-alertmanager-examples.adoc[leveloffset=+1]
7488
//Example Grafana dashboards

documentation/assemblies/metrics/assembly-metrics.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Strimzi provides example Prometheus rules and Grafana dashboards, which you can
2121
These tools help visualize metrics and define alerts based on specific conditions.
2222
Additionally, you can configure your deployment to track messages end-to-end by xref:assembly-distributed-tracing-str[setting up distributed tracing].
2323

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

2727
.Supporting documentation for metrics and monitoring tools

documentation/assemblies/metrics/assembly_metrics-prometheus-setup.adoc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,23 @@ To expose metrics in Prometheus format, you add configuration to a custom resour
1212
You must also make sure that the metrics are scraped by your monitoring stack.
1313
Prometheus and Prometheus Alertmanager are used in the examples provided by Strimzi, but you can use also other compatible tools.
1414

15-
Using Prometheus with Strimzi, requires the following:
15+
You can expose metrics using one of the following approaches:
16+
17+
* xref:proc-jmx-exporter-metrics-kafka-deploy-options-{context}[Enabling Prometheus JMX Exporter]
18+
19+
* xref:proc-metrics-reporter-kafka-deploy-options-{context}[Enabling Strimzi Metrics Reporter]
20+
21+
After enabling metrics, you can integrate with Prometheus:
1622

17-
. xref:proc-metrics-kafka-deploy-options-{context}[Enabling Prometheus metrics through configuration]
1823
. xref:assembly-metrics-prometheus-{context}[Setting up Prometheus]
1924
. xref:proc-metrics-deploying-prometheus-alertmanager-{context}[Deploying Prometheus Alertmanager]
2025

2126
Strimzi provides an xref:assembly-metrics-config-files-str[example Grafana dashboards] to display visualizations of metrics.
2227
The exposed metrics provide the monitoring data when you xref:proc-metrics-grafana-dashboard-str[enable the Grafana dashboard].
2328

24-
include::../../modules/metrics/proc-metrics-kafka-deploy-options.adoc[leveloffset=+1]
29+
include::../../modules/metrics/proc-jmx-exporter-metrics-kafka-deploy-options.adoc[leveloffset=+1]
30+
31+
include::../../modules/metrics/proc-strimzi-metrics-reporter-kafka-deploy-options.adoc[leveloffset=+1]
2532

2633
include::assembly_metrics-prometheus-deploy.adoc[leveloffset=+1]
2734

documentation/modules/metrics/proc-metrics-kafka-deploy-options.adoc renamed to documentation/modules/metrics/proc-jmx-exporter-metrics-kafka-deploy-options.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//
33
// metrics/assembly_metrics-kafka.adoc
44

5-
[id='proc-metrics-kafka-deploy-options-{context}']
6-
= Enabling Prometheus metrics through configuration
5+
[id='proc-jmx-exporter-metrics-kafka-deploy-options-{context}']
6+
= Enabling Prometheus JMX Exporter
77

88
[role="_abstract"]
99
To enable and expose metrics in Strimzi for Prometheus, configure the appropriate properties in the custom resources for the components you want to monitor.
@@ -39,7 +39,7 @@ You can create your own Prometheus configuration or use the xref:ref-metrics-pro
3939
* `kafka-cruise-control-metrics.yaml`
4040
* `oauth-metrics.yaml`
4141

42-
These files include relabeling rules and example metrics configuration, and are a good starting point for trying Prometheus with Strimzi.
42+
These files include relabeling rules and example metrics configuration, and are a good starting point for trying Prometheus with Strimzi.
4343

4444
This procedure shows how to deploy example Prometheus metrics configuration to the `Kafka` resource.
4545
The same steps apply when deploying the example files for other resources.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// This assembly is included in the following assemblies:
2+
//
3+
// metrics/assembly_metrics-kafka.adoc
4+
5+
[id='proc-metrics-reporter-kafka-deploy-options-{context}']
6+
= Enabling Strimzi Metrics Reporter
7+
8+
[role="_abstract"]
9+
To enable and expose metrics in Strimzi for Prometheus, configure the appropriate properties in the custom resources for the components you want to monitor.
10+
11+
Use `metricsConfig` configuration to expose metrics for these components:
12+
13+
* Kafka
14+
15+
This enables the {StrimziMetricsReporter}, which exposes metrics on port 9404 through an HTTP endpoint.
16+
Prometheus scrapes this endpoint to collect Kafka metrics.
17+
18+
You can create your own Prometheus configuration or use the xref:ref-metrics-prometheus-metrics-config-{context}[example custom resource file] provided with Strimzi:
19+
20+
* `kafka-metrics.yaml`
21+
22+
This file contains the necessary configuration, and is a good starting point for trying Prometheus with Strimzi.
23+
24+
This procedure shows how to deploy example Prometheus metrics configuration to the `Kafka` resource.
25+
26+
.Procedure
27+
28+
. Deploy the example custom resource with the Prometheus configuration.
29+
+
30+
For example, for each `Kafka` resource you can apply the `kafka-metrics.yaml` file.
31+
+
32+
.Deploying the example configuration
33+
[source,shell,subs="+attributes"]
34+
----
35+
kubectl apply -f kafka-metrics.yaml
36+
----
37+
+
38+
Alternatively, copy the example configuration in `kafka-metrics.yaml` to your own `Kafka` resource.
39+
+
40+
.Copying the example configuration
41+
[source,shell]
42+
----
43+
kubectl edit kafka <kafka_configuration_file>
44+
----
45+
+
46+
Copy the `metricsConfig` property to your `Kafka` resource.
47+
+
48+
.Example metrics configuration for Kafka
49+
[source,yaml,subs="+quotes,attributes"]
50+
----
51+
apiVersion: {KafkaApiVersion}
52+
kind: Kafka
53+
metadata:
54+
name: my-cluster
55+
spec:
56+
kafka:
57+
# ...
58+
metricsConfig:
59+
type: strimziMetricsReporter
60+
values:
61+
allowList:
62+
- "kafka_log.*"
63+
- "kafka_network.*"
64+
----

documentation/modules/metrics/proc_metrics-grafana-dashboard.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ When accessing a dashboard, you can use the `port-forward` command to forward tr
2929
The name of the Grafana pod is different for each user.
3030

3131
.Prerequisites
32-
* xref:proc-metrics-kafka-deploy-options-{context}[Metrics are configured for the Kafka cluster resource]
32+
* xref:proc-jmx-exporter-metrics-kafka-deploy-options-{context}[Prometheus JMX Exporter metrics are configured for the Kafka cluster resource]
33+
* xref:proc-strimzi-metrics-reporter-kafka-deploy-options.adoc-{context}[Strimzi Metrics Reporter metrics are configured for the Kafka cluster resource]
3334
* xref:assembly-metrics-prometheus-{context}[Prometheus and Prometheus Alertmanager are deployed]
3435

3536
.Procedure

documentation/modules/metrics/ref-prometheus-metrics-config.adoc renamed to documentation/modules/metrics/ref-prometheus-jmx-metrics-config.adoc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@
33
//
44
// metrics/assembly-metrics-config-files.adoc
55

6-
[id='ref-metrics-prometheus-metrics-config-{context}']
6+
[id='ref-jmx-metrics-prometheus-metrics-config-{context}']
77

8-
= Example Prometheus metrics configuration
8+
= Example Prometheus JMX Exporter metrics configuration
99

1010
[role="_abstract"]
11-
Strimzi uses the {JMXExporter} to expose metrics through an HTTP endpoint, which can be scraped by the Prometheus server.
1211

13-
Grafana dashboards are dependent on Prometheus JMX Exporter relabeling rules, which are defined for Strimzi components in the custom resource configuration.
12+
Grafana dashboards with Prometheus JMX Exporter are dependent on relabeling rules, which are defined for Strimzi components in the custom resource configuration.
1413

1514
A label is a name-value pair.
1615
Relabeling is the process of writing a label dynamically.
1716
For example, the value of a label may be derived from the name of a Kafka server and client ID.
1817

19-
Strimzi provides example custom resource configuration YAML files with relabeling rules.
20-
When deploying Prometheus metrics configuration, you can can deploy the example custom resource or copy the metrics configuration to your own custom resource definition.
21-
2218
.Example custom resources with metrics configuration
2319
[cols="3*",options="header",stripes="none"]
2420
|===
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
// This assembly is included in the following assemblies:
3+
//
4+
// metrics/assembly-metrics-config-files.adoc
5+
6+
[id='ref-metrics-reporter-config-{context}']
7+
8+
= Example Metrics Reporter metrics configuration
9+
[role="_abstract"]
10+
11+
.Example custom resources with metrics configuration
12+
[cols="3*",options="header",stripes="none"]
13+
|===
14+
|Component
15+
|Custom resource
16+
|Example YAML file
17+
18+
|Kafka nodes
19+
|`Kafka`
20+
|`kafka-metrics.yaml`
21+
22+
|===

0 commit comments

Comments
 (0)