Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update assemblies and modules Docs for Metrics Reporter integration #11329

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

OwenCorrigan76
Copy link
Contributor

Type of change

  • Documentation

Description

With newly added support for the Strimzi Metrics Reporter to Kafka brokers/controllers components, this PR updates the assemblies and modules documents to reflect the changes in the way we can deploy metrics to the Kafka brokers and controllers.

Updates:

  • Example metrics files
  • Example grafana dashboards – mentioning metrics reporter-specific grafana dashboards

Structure for new content:

  • Assembly file: Using Metrics Reporter with Strimzi
  • Procedure file: Enabling Metrics Reporter
  • Reference file: Example Metrics Reporter configuration

Related to #11051

Checklist

Please go through this checklist and make sure all applicable tasks have been done

  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Check RBAC rights for Kubernetes / OpenShift roles
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
  • Reference relevant issue(s) and close them after merging
  • Update CHANGELOG.md
  • Supply screenshots for visual changes, such as Grafana dashboards

<13> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for Kafka.
<14> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for MirrorMaker 2.
<15> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for OAuth 2.0.
<10> Example Grafana dashboards with Metrics Reporter for the Kafka component.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<10> Example Grafana dashboards with Metrics Reporter for the Kafka component.
<10> Example Grafana dashboards to be used with Metrics Reporter for the Kafka component.

<14> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for MirrorMaker 2.
<15> Metrics configuration that defines Prometheus JMX Exporter relabeling rules for OAuth 2.0.
<10> Example Grafana dashboards with Metrics Reporter for the Kafka component.
<11> Resource for deploying and configuring Strimzi Metrics Reporter based Kafka.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<11> Resource for deploying and configuring Strimzi Metrics Reporter based Kafka.
<11> Resource for deploying and configuring Kafka with Strimzi Metrics Reporter.

Comment on lines 13 to 20
Grafana dashboards are dependent on relabeling rules, which are defined for Strimzi components in the custom resource configuration.

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

Strimzi provides example custom resource configuration YAML files with relabeling rules.
When deploying Prometheus metrics configuration, you can can deploy the example custom resource or copy the metrics configuration to your own custom resource definition.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only Prometheus JMX Exporter has relabeling rules, so I think we should make it clear. What about moving this part to the paragraph titled "Example Prometheus Jmx Exporter metrics configuration"?

Using Prometheus with Strimzi, requires the following:
You can enable either Prometheus JMX Exporter or Strimzi Metrics Reporter to expose metrics:

xref:proc-jmx-exporter-metrics-kafka-deploy-options-{context}[Enabling Prometheus Jmx metrics through configuration]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xref:proc-jmx-exporter-metrics-kafka-deploy-options-{context}[Enabling Prometheus Jmx metrics through configuration]
xref:proc-jmx-exporter-metrics-kafka-deploy-options-{context}[Enabling Prometheus JMX Exporter through configuration]

[id='proc-metrics-kafka-deploy-options-{context}']
= Enabling Prometheus metrics through configuration
[id='proc-jmx-exporter-metrics-kafka-deploy-options-{context}']
= Enabling Prometheus Jmx metrics through configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
= Enabling Prometheus Jmx metrics through configuration
= Enabling Prometheus JMX Exporter through configuration

// metrics/assembly_metrics-kafka.adoc

[id='proc-metrics-reporter-kafka-deploy-options-{context}']
= Enabling Metrics Reporter metrics through configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
= Enabling Metrics Reporter metrics through configuration
= Enabling Strimzi Metrics Reporter through configuration

Comment on lines 9 to 11
To enable and expose metrics in Strimzi for Prometheus, use metrics configuration properties.

The following components require `metricsConfig` configuration to expose metrics:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To enable and expose metrics in Strimzi for Prometheus, use metrics configuration properties.
The following components require `metricsConfig` configuration to expose metrics:
The following components require `metricsConfig` configuration to expose metrics in Prometheus format:

Comment on lines 15 to 16
This configuration enables the {StrimziMetricsReporter} to expose metrics through an HTTP endpoint.
The port for the Strimzi Metrics Reporter HTTP endpoint is 9404.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This configuration enables the {StrimziMetricsReporter} to expose metrics through an HTTP endpoint.
The port for the Strimzi Metrics Reporter HTTP endpoint is 9404.
This configuration enables the {StrimziMetricsReporter} to expose metrics through an HTTP endpoint on port 9404.

and similar change for the Prometheus JMX Exporter paragraph.

spec:
kafka:
# ...
metricsConfig: <1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reference for <1>. Is it really needed?

Comment on lines 67 to 68

# _metrics configuration..._
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

@fvaleri fvaleri requested review from PaulRMellor and a team April 8, 2025 08:20
@fvaleri fvaleri added this to the 0.46.0 milestone Apr 8, 2025
├── kafka-cruise-control-metrics.yaml <14>
├── kafka-metrics.yaml <15>
├── kafka-mirror-maker-2-metrics.yaml <16>
└── oauth-metrics.yaml <17>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of questions here:

  • aren't we getting examples for all the other components (apart Kafka) for using the Strimzi Metrics reporter?
  • wouldn't be better to put the Prometheus JMX exporter related example in a dedicated folder now that we have the strimzi-metrics-reporter one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppatierno Is this the structure you're recommending?

├── metrics
|     ├── prometheus JMX exporter
|        └──── grafana-dashboards
|        └──── kafka-bridge-metrics.yaml 
|        └──── kafka-connect-metrics.yaml 
|        └──── kafka-cruise-control-metrics.yaml 
|        └──── kafka-metrics.yaml 
|        └──── kafka-mirror-maker-2-metrics.yaml 
|        └──── oauth-metrics.yaml 
|     ├── strimzi-metrics-reporter
|         └────grafana-dashboards
|         └──── kafka-metrics.yaml 
|         └──── README.md

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was the idea thanks @OwenCorrigan76
@fvaleri @PaulRMellor wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but the folder name should be prometheus-jmx-exporter and we need a similar README.md for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'll update this docs PR and then update the main integration PR. Thanks

@OwenCorrigan76 OwenCorrigan76 force-pushed the Docs_for_integrate_metrics_reporter branch from e5596ab to 9fe4d31 Compare April 10, 2025 12:42
Copy link
Contributor

@PaulRMellor PaulRMellor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, Owen.
I left some suggestions.
There's a bit of overlap with a PR I'm about to merge in, which I've pointed out.
I also left a note on Kafka Exporter -- I've made a note to do something about that when we get these updates merged in

<8> PodMonitor definitions translated by the Prometheus Operator into jobs for the Prometheus server to be able to scrape metrics data directly from pods.
<9> Example Grafana dashboards to be used with Metrics Reporter for the Kafka component.
<10> Resource for deploying and configuring Kafka with Strimzi Metrics Reporter.
<11> Example Grafana dashboards for the different Strimzi components.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<11> Example Grafana dashboards for the different Strimzi components.
<11> Grafana dashboards for components using the JMX Reporter.

Comment on lines 34 to 36
* xref:assembly-metrics-setup-{context}[Set up and deploy Prometheus to expose metrics]
* xref:proc-metrics-kafka-deploy-options-{context}[Deploy Kafka Exporter to provide additional metrics]
* xref:proc-jmx-exporter-metrics-kafka-deploy-options-{context}[Deploy Kafka Exporter to provide additional metrics]
* xref:proc-metrics-grafana-dashboard-{context}[Use Grafana to present the Prometheus metrics]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted this section in PR #11307
I don't think we need it here, so would revert the changes to this file

<6> Alerting rules examples for use with Prometheus Alertmanager (deployed with Prometheus).
<7> Installation resource file for the Prometheus image.
<8> PodMonitor definitions translated by the Prometheus Operator into jobs for the Prometheus server to be able to scrape metrics data directly from pods.
<9> Example Grafana dashboards to be used with Metrics Reporter for the Kafka component.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<9> Example Grafana dashboards to be used with Metrics Reporter for the Kafka component.
<9> Grafana dashboards for components using the Strimzi Metrics Reporter.


xref:proc-metrics-reporter-kafka-deploy-options-{context}[Enabling Strimzi Metrics Reporter through configuration]

Once the type is determined, using Prometheus with Strimzi, requires the following:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once the type is determined, using Prometheus with Strimzi, requires the following:
After enabling metrics, you can integrate with Prometheus:

@@ -12,16 +12,23 @@ To expose metrics in Prometheus format, you add configuration to a custom resour
You must also make sure that the metrics are scraped by your monitoring stack.
Prometheus and Prometheus Alertmanager are used in the examples provided by Strimzi, but you can use also other compatible tools.

Using Prometheus with Strimzi, requires the following:
You can enable either Prometheus JMX Exporter or Strimzi Metrics Reporter to expose metrics:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can enable either Prometheus JMX Exporter or Strimzi Metrics Reporter to expose metrics:
You can expose metrics using one of the following approaches:

It is a good starting point for trying Prometheus with Strimzi.

This procedure shows how to deploy example Prometheus metrics configuration in the `Kafka` resource.
The process is the same when deploying the example files for other resources.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The process is the same when deploying the example files for other resources.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we include a note/cross-ref on how to configure the Kafka Exporter as well in the JMX procedure. Do we want it here too?

Lines 28-31: https://github.com/strimzi/strimzi-kafka-operator/pull/11307/files#diff-80eda6a9cce800533455d246c9b923ba06d53ea83645996177b63b5ef4f33e66R28-R31

Or maybe that needs to be separated from both now, so we link from each of these procedures. Note taken

@@ -29,7 +29,7 @@ When accessing a dashboard, you can use the `port-forward` command to forward tr
The name of the Grafana pod is different for each user.

.Prerequisites
* xref:proc-metrics-kafka-deploy-options-{context}[Metrics are configured for the Kafka cluster resource]
* xref:proc-jmx-exporter-metrics-kafka-deploy-options-{context}[Metrics are configured for the Kafka cluster resource]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have links for both options here as an either/or?


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

= Example Prometheus Jmx Exporter metrics configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
= Example Prometheus Jmx Exporter metrics configuration
= Example Prometheus JMX Exporter metrics configuration

A label is a name-value pair.
Relabeling is the process of writing a label dynamically.
For example, the value of a label may be derived from the name of a Kafka server and client ID.
Strimzi uses the {StrimziMetricsReporter} or the {JMXExporter} to expose metrics through an HTTP endpoint, which can be scraped by the Prometheus server.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this file is worth having for two sentences?
Maybe we can just add to the intro of the example metrics file section?

@@ -42,6 +42,7 @@
//Monitoring links
:GrafanaHome: link:https://grafana.com/[Grafana Labs^]
:JMXExporter: link:https://github.com/prometheus/jmx_exporter[Prometheus JMX Exporter^]
:StrimziMetricsReporter: link:https://github.com/strimzi/metrics-reporter[Strimzi Metrics Reporter^]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to link to this? We only use the link in one place. Maybe we can live without it?

@OwenCorrigan76 OwenCorrigan76 force-pushed the Docs_for_integrate_metrics_reporter branch from 99e88b1 to 8fa4e37 Compare April 11, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants