-
Notifications
You must be signed in to change notification settings - Fork 1.4k
docs(metrics): updates for kafka exporter #11520
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
Open
PaulRMellor
wants to merge
2
commits into
strimzi:main
Choose a base branch
from
PaulRMellor:docs_kafka-exporter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
documentation/modules/metrics/proc-kafka-exporter-deploy.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// This assembly is included in the following assemblies: | ||
// | ||
// metrics/assembly-metrics.adoc | ||
|
||
[id='proc-kafka-exporter-deploy-{context}'] | ||
= Deploying Kafka Exporter | ||
|
||
[role="_abstract"] | ||
To monitor consumer lag in your Kafka cluster, configure Kafka Exporter in the `Kafka` custom resource. | ||
Kafka Exporter exposes lag data as Prometheus metrics, which can be visualized in Grafana. | ||
A Grafana dashboard for Kafka Exporter is included in the xref:ref-metrics-dashboards-{context}[example Grafana dashboards] provided by Strimzi. | ||
|
||
IMPORTANT: Kafka Exporter provides only metrics related to consumer groups and lag. | ||
To collect general Kafka metrics, configure metrics on the Kafka brokers. | ||
For more information, see xref:assembly-metrics-setup-{context}[]. | ||
|
||
.Prerequisites | ||
|
||
* Consumer groups must be in use. | ||
+ | ||
Kafka Exporter relies on data from the `__consumer_offsets` topic to report lag metrics. | ||
PaulRMellor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This topic only contains information if consumer groups are actively committing offsets. | ||
|
||
.Procedure | ||
|
||
. Add `kafkaExporter` configuration to the `spec` section of the `Kafka` resource. | ||
+ | ||
.Example configuration for deploying Kafka Exporter | ||
[source,yaml,subs="attributes+"] | ||
---- | ||
apiVersion: {KafkaApiVersion} | ||
kind: Kafka | ||
metadata: | ||
name: my-cluster | ||
spec: | ||
# ... | ||
kafkaExporter: | ||
# Collection filters (recommended) | ||
groupRegex: ".*" # <1> | ||
topicRegex: ".*" # <2> | ||
groupExcludeRegex: "^excluded-.*" # <3> | ||
topicExcludeRegex: "^excluded-.*" # <4> | ||
# Resources requests and limits (recommended) | ||
resources: # <6> | ||
requests: | ||
cpu: 200m | ||
memory: 64Mi | ||
limits: | ||
cpu: 500m | ||
memory: 128Mi | ||
# Metrics for all consumers (optional) | ||
showAllOffsets: false # <5> | ||
# Logging configuration (optional) | ||
logging: debug # <7> | ||
# Sarama logging (optional) | ||
enableSaramaLogging: true # <8> | ||
# Readiness probe (optional) | ||
readinessProbe: # <9> | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 5 | ||
# Liveness probe (optional) | ||
livenessProbe: # <10> | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 5 | ||
# Pod template (optional) | ||
template: # <11> | ||
pod: | ||
metadata: | ||
labels: | ||
label1: value1 | ||
imagePullSecrets: | ||
- name: my-docker-credentials | ||
securityContext: | ||
runAsUser: 1000001 | ||
fsGroup: 0 | ||
terminationGracePeriodSeconds: 120 | ||
# Custom image (optional) | ||
image: my-registry.io/my-org/my-exporter-cluster:latest # <12> | ||
# ... | ||
---- | ||
<1> Regular expression to specify consumer groups to include in metrics. | ||
<2> Regular expression to specify topics to include in metrics. | ||
<3> Regular expression to specify consumer groups to exclude from metrics. | ||
<4> Regular expression to specify topics to exclude from metrics. | ||
<5> By default, metrics are collected for all consumers regardless of connection status. Setting `showAllOffsets` to `false` stops collecting metrics for disconnected consumers. | ||
<6> CPU and memory resources to reserve. | ||
<7> Logging configuration, to log messages with a given severity (debug, info, warn, error, fatal) or above. | ||
<8> Boolean to enable Sarama logging, which provides detailed logs from the Go client library used by Kafka Exporter. Useful for debugging Kafka client interactions. | ||
<9> Readiness probe to check when Kafka Exporter is ready to serve metrics. | ||
<10> Liveness probe to detect and restart Kafka Exporter if it becomes unresponsive. | ||
<11> Template customization. Here a pod is scheduled with additional security attributes. | ||
<12> **ADVANCED OPTION:** Container image configuration, which is recommended only in special situations. | ||
|
||
. Apply the changes to the `Kafka` configuration. | ||
+ | ||
Resources, including a `Service` and `Pod`, are created for the Kafka Exporter with the naming convention `<kafka_cluster_name>-kafka-exporter`. | ||
|
||
. Configure Prometheus to scrape metrics from the Kafka Exporter endpoint. | ||
+ | ||
If you are using the example Prometheus deployment, it is already set up to discover and scrape Kafka Exporter metrics. | ||
The `PodMonitor` resource named `kafka-resources-metrics` matches the `strimzi.io/kind: Kafka` label used to identify the Kafka Exporter. | ||
For more information, see xref:proc-metrics-deploying-prometheus-{context}[]. | ||
|
||
. Import the Kafka Exporter dashboard into Grafana to visualize consumer lag. | ||
+ | ||
For more information, see xref:proc-metrics-grafana-dashboard-{context}[]. | ||
+ | ||
TIP: Use the _Lag by consumer group_ and _Messages consumed per second_ panels to evaluate lag and the impact of tuning actions. |
2 changes: 1 addition & 1 deletion
2
...ntation/modules/metrics/proc-strimzi-metrics-reporter-kafka-deploy-options.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.