-
Notifications
You must be signed in to change notification settings - Fork 51
[26.2] Improved cluster health summary #1805
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
kbatuigas
wants to merge
9
commits into
beta
Choose a base branch
from
DOC-2016-document-feature-improved-cluster-health-summary
base: beta
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.
+251
−1
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2784d02
Improved cluster health summary
kbatuigas 23661fc
Add to What's new
kbatuigas 7ba72fe
Minor edit
kbatuigas ee3e91c
Add new metrics reference
kbatuigas d04e2fa
Review pass
kbatuigas a99a5d7
Merge branch 'beta' into DOC-2016-document-feature-improved-cluster-h…
kbatuigas 28afb80
Apply suggestions from SME review
kbatuigas 5bfa1b8
Minor edit
kbatuigas 5f38fd1
Apply suggestion from SME review
kbatuigas 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ endif::[] | |
|
|
||
| This section provides guidelines and example queries using Redpanda's public metrics to optimize your system's performance and monitor its health. | ||
|
|
||
| To help detect and mitigate anomalous system behaviors, capture baseline metrics of your healthy system at different stages (at start-up, under high load, in steady state) so you can set thresholds and alerts according to those baselines. | ||
| To help detect and mitigate anomalous system behaviors, capture baseline metrics of your healthy system at different stages (at startup, under high load, in steady state) so you can set thresholds and alerts according to those baselines. | ||
|
|
||
| [TIP] | ||
| ==== | ||
|
|
@@ -428,6 +428,146 @@ Leaderless partitions can be caused by unresponsive brokers. When an alert on `r | |
|
|
||
| Redpanda's Raft implementation exchanges periodic status RPCs between a broker and its peers. The xref:reference:public-metrics-reference.adoc#redpanda_node_status_rpcs_timed_out[`redpanda_node_status_rpcs_timed_out`] gauge increases when a status RPC times out for a peer, which indicates that a peer may be unresponsive and may lead to problems with partition replication that Raft manages. Monitor for non-zero values of this gauge, and correlate it with any logged errors or changes in partition replication. | ||
|
|
||
| ifndef::env-cloud[] | ||
| [[cluster-health]] | ||
| === Cluster health | ||
|
|
||
| A healthy cluster has all brokers responding, a leader for every partition, and an elected controller. Redpanda continuously assembles these signals into a cluster health summary. Redpanda can export this summary as a set of <<available-metrics,Prometheus metrics>>, so you can alert on overall cluster health from your metrics system instead of polling xref:reference:rpk/rpk-cluster/rpk-cluster-health.adoc[`rpk cluster health`] or the link:/api/doc/admin/operation/operation-get_cluster_health_overview[health overview Admin API]. | ||
|
|
||
| These metrics are disabled by default. When enabled, every broker periodically assembles its own view of the health overview and exposes it on the public metrics endpoint, prefixed with `redpanda_cluster_health_`. For most of these metrics, a value of `0` means healthy and any value greater than `0` indicates a problem. | ||
|
|
||
| NOTE: Cluster health metrics require Redpanda version 26.2 or later. | ||
|
|
||
| ==== Enable cluster health metrics | ||
|
|
||
| Set xref:reference:properties/cluster-properties.adoc#health_monitor_metrics_enabled[`health_monitor_metrics_enabled`] to `true`. This property requires a broker restart to take effect. | ||
|
|
||
| ifndef::env-kubernetes[] | ||
| [,bash] | ||
| ---- | ||
| rpk cluster config set health_monitor_metrics_enabled true | ||
| ---- | ||
| endif::[] | ||
|
|
||
| ifdef::env-kubernetes[] | ||
| [tabs] | ||
| ====== | ||
| Helm + Operator:: | ||
| + | ||
| -- | ||
| .`redpanda-cluster.yaml` | ||
| [,yaml] | ||
| ---- | ||
| apiVersion: cluster.redpanda.com/v1alpha2 | ||
| kind: Redpanda | ||
| metadata: | ||
| name: redpanda | ||
| spec: | ||
| chartRef: {} | ||
| clusterSpec: | ||
| config: | ||
| cluster: | ||
| health_monitor_metrics_enabled: true | ||
| ---- | ||
|
|
||
| ```bash | ||
| kubectl apply -f redpanda-cluster.yaml --namespace <namespace> | ||
| ``` | ||
|
|
||
| -- | ||
| Helm:: | ||
| + | ||
| -- | ||
| [tabs] | ||
| ==== | ||
| --values:: | ||
| + | ||
| .`health-metrics.yaml` | ||
| [,yaml] | ||
| ---- | ||
| config: | ||
| cluster: | ||
| health_monitor_metrics_enabled: true | ||
| ---- | ||
| + | ||
| ```bash | ||
| helm upgrade --install redpanda redpanda/redpanda --namespace <namespace> --create-namespace \ | ||
| --values health-metrics.yaml --reuse-values | ||
| ``` | ||
|
|
||
| --set:: | ||
| + | ||
| [,bash] | ||
| ---- | ||
| helm upgrade --install redpanda redpanda/redpanda \ | ||
| --namespace <namespace> \ | ||
| --create-namespace \ | ||
| --set config.cluster.health_monitor_metrics_enabled=true | ||
| ---- | ||
|
|
||
| ==== | ||
| -- | ||
| ====== | ||
| endif::[] | ||
|
|
||
| By default, each broker refreshes the metrics every 100 seconds. This interval is 10 times the value of xref:reference:properties/cluster-properties.adoc#health_monitor_max_metadata_age[`health_monitor_max_metadata_age`]. Enabling the metrics causes a modest increase in CPU usage and network traffic. | ||
|
|
||
| ==== Available metrics | ||
|
|
||
| Redpanda emits two groups of metrics on the public metrics endpoint, both prefixed `redpanda_cluster_health_` and reported once per broker. The freshness metrics (`redpanda_cluster_health_metadata_age_seconds` and `redpanda_cluster_health_refreshes_total`) appear as soon as you enable the feature, so you can confirm that refreshes are running. The overview metrics, which are all the others, appear on a broker after it assembles a usable view of the cluster, typically a few seconds after startup. | ||
|
|
||
| [cols="2a,1,3"] | ||
| |=== | ||
| |Metric |Type |Description | ||
|
|
||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_unhealthy_reasons[`redpanda_cluster_health_unhealthy_reasons`] |gauge |Number of reasons the cluster is currently unhealthy. A value of `0` means healthy. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_no_elected_controller[`redpanda_cluster_health_no_elected_controller`] |gauge |Reports `1` if no controller is elected, otherwise `0`. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_nodes_down[`redpanda_cluster_health_nodes_down`] |gauge |Number of brokers not responding to liveness checks. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_leaderless_partitions[`redpanda_cluster_health_leaderless_partitions`] |gauge |Number of partitions without a leader. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_under_replicated_partitions[`redpanda_cluster_health_under_replicated_partitions`] |gauge |Number of partitions that are not fully replicated. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_high_disk_usage_nodes[`redpanda_cluster_health_high_disk_usage_nodes`] |gauge |Number of brokers past the storage-space alert threshold. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_no_health_report[`redpanda_cluster_health_no_health_report`] |gauge |Reports `1` if the most recent refresh attempt failed, otherwise `0`. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_cluster_size[`redpanda_cluster_health_cluster_size`] |gauge |Number of known cluster members. Informational. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_nodes_in_recovery_mode[`redpanda_cluster_health_nodes_in_recovery_mode`] |gauge |Number of brokers in recovery mode. Informational; does not affect the health verdict. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_bytes_in_cloud_storage[`redpanda_cluster_health_bytes_in_cloud_storage`] |gauge |Bytes stored in object storage. Informational; `0` if Tiered Storage isn't enabled. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_metadata_age_seconds[`redpanda_cluster_health_metadata_age_seconds`] |gauge |Seconds since the last successful refresh on the broker. Reports a very large value before the first refresh so that staleness alerts fire. | ||
| |xref:reference:public-metrics-reference.adoc#redpanda_cluster_health_refreshes_total[`redpanda_cluster_health_refreshes_total`] |counter |Number of successful refreshes on the broker. | ||
| |=== | ||
|
|
||
| NOTE: The informational metrics (`cluster_size`, `nodes_in_recovery_mode`, and `bytes_in_cloud_storage`) don't affect whether the cluster is considered healthy. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surprised nodes in recovery node would not impact cluster health @pgellert @tyson-redpanda |
||
|
|
||
| ==== Metric aggregation across brokers | ||
|
|
||
| Every broker exposes its own copy of these metrics, so decide how to combine them. | ||
|
|
||
| Aggregate across all brokers, for example with `max()`: | ||
|
|
||
| [,promql] | ||
| ---- | ||
| max(redpanda_cluster_health_nodes_down) | ||
| ---- | ||
|
|
||
| Use `max()`, not `sum()`. Every broker reports its own copy, so `sum()` returns roughly the broker count times the real value. Aggregation is fine for coarse cluster-health alerting, but it's noisier during controller elections and broker restarts, and a stale or partitioned broker still contributes its last cached view. | ||
|
|
||
| For a lower-noise signal, read the metric only from the current controller leader by joining against the Raft `leader_for` gauge for the controller partition: | ||
|
|
||
| [,promql] | ||
| ---- | ||
| redpanda_cluster_health_unhealthy_reasons | ||
| and on(instance) | ||
| redpanda_raft_leader_for{namespace="redpanda",topic="controller",partition="0"} == 1 | ||
| ---- | ||
|
|
||
| This join returns a value only while some broker is the controller leader. If no broker is the leader, for example when the cluster has no controller at all, the query returns an empty result, which an alert configured to fire above zero would not catch. Pair the join with a separate alert that fires when no broker reports itself as the controller leader: | ||
|
|
||
| [,promql] | ||
| ---- | ||
| sum(redpanda_raft_leader_for{namespace="redpanda",topic="controller",partition="0"}) == 0 | ||
| ---- | ||
|
|
||
| A controller election creates a brief window where no broker is the leader, and the joined series drops out. To avoid spurious alerts during these normal elections, configure the alerts to fire only after the metric has been non-zero for at least one minute (for example, with a Prometheus `for` duration of `1m`). | ||
| endif::[] | ||
|
|
||
| [[consumers]] | ||
| === Consumer group lag | ||
|
|
||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprised this is opt in @tyson-redpanda . Not high cardinality at all and quite useful in the general case