feat: ARO-25981 - Adding Prometheus Alerts For etcd Metrics - #5687
feat: ARO-25981 - Adding Prometheus Alerts For etcd Metrics#5687kevinobriendotca wants to merge 13 commits into
Conversation
|
Hi @kevinobriendotca. Thanks for your PR. I'm waiting for a Azure member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR tightens some Kubernetes control-plane alert firing durations and introduces a new set of etcd availability/performance PrometheusRule alerts along with promtool tests, then wires the new rule file into existing alert bundles.
Changes:
- Reduce
fordurations (and corresponding annotations) for a few Kubernetes alerts (e.g., 30m → 15m, 90m → 15m). - Add a new
etcd-availabilityPrometheusRule group with tiered alerting and a new promtool test suite. - Include the new etcd rule file in SRE/HCP and SL services rule bundles.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| observability/alerts/kubernetesControlPlane-prometheusRule.yaml | Shortens alert for durations / descriptions for select Kubernetes alerts. |
| observability/alerts/etcd-availability-prometheusRule.yaml | Adds new tiered etcd performance/availability alerts. |
| observability/alerts/etcd-availability-prometheusRule_test.yaml | Adds promtool unit tests for the new etcd alert rules. |
| observability/alerts-sre-hcps.yaml | Registers the new etcd PrometheusRule in the SRE/HCP rules list. |
| observability/alerts-sl-services.yaml | Registers the new etcd PrometheusRule in the SL services rules list and reorders entries. |
| tests: | ||
|
|
||
| # ======================================== |
There was a problem hiding this comment.
Hmm, not sure what you mean here, Copilot. There are no "|" characters in the file and running "promtool test rules --debug etcd-availability-prometheusRule_test.yaml" shows the expected output for the passing tests. The tests are also passing via make alerts.
| expr: | | ||
| count by (cluster) (count by (git_version, cluster) (label_replace(kubernetes_build_info{job!~"kube-dns|coredns"},"git_version","$1","git_version","(v[0-9]*.[0-9]*).*"))) > 1 | ||
| for: 90m | ||
| for: 15m |
There was a problem hiding this comment.
This is an upstream change pulled in via make alerts from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/e02554298cb62b5533f3407c8eacc664e80bc74b/manifests/kubernetesControlPlane-prometheusRule.yaml.
79165f3 to
0dbc817
Compare
10276c2 to
70d3f78
Compare
70d3f78 to
8c3eae9
Compare
0d64364 to
7c95680
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
observability/alerts-sl-services.yaml:12
rulesFoldersincludes duplicate entries for backend, fleet, and frontend (these files are each listed twice). Even if generation currently dedupes, this is confusing and risks accidental drift if one instance is edited later.
Remove the duplicate entries and keep a single cluster-service-slo-rules.yaml entry here, then re-run make alerts to regenerate the generated bicep outputs.
- ../admin/alerts/admin-prometheusRule.yaml
- ../backend/alerts/backend-prometheusRule.yaml
- ../cluster-service/alerts/cluster-service-slo-rules.yaml
- ../fleet/alerts/fleet-prometheusRule.yaml
- ../frontend/alerts/frontend-prometheusRule.yaml
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
observability/alerts-rp-hcps.yaml:16
- PR description says etcd alerts are being added for backend management + service clusters as well as HCP clusters, but this PR wires the new etcd rules only into the RP HCP alert config (the only reference to
alerts/etcd-availability-prometheusRule.yamlis here). Either add the etcd alert group into the other intended alert configs/lanes, or update the PR description to reflect the actual scope.
rulesFolders:
- alerts/etcd-availability-prometheusRule.yaml
|
Three items from reviewing against the ADR:
|
ARO-25981 etcd Alerting Adding Prometheus alerts for etcd metrics exposed via the SRE metrics set. Alerts follow the design defined in the ARO HCP Alerting Recommendation ADR. See openshift-online/architecture#79 for details. 18 alerts total in three separate burn-rate tiers. ┌───────────────────────────────┬───────────────────┬─────────────────────┬───────────────────┐ │ Alert │ Fast (1h/5m) │ Medium (6h/30m) │ Slow (3d) │ ├───────────────────────────────┼───────────────────┼─────────────────────┼───────────────────┤ │ EtcdBackendCommitDurationHigh │ for: 5m, rate[5m] │ for: 30m, rate[30m] │ for: 6h, rate[6h] │ ├───────────────────────────────┼───────────────────┼─────────────────────┼───────────────────┤ │ EtcdDatabaseInUseSizeHigh │ for: 5m │ for: 30m │ for: 6h │ ├───────────────────────────────┼───────────────────┼─────────────────────┼───────────────────┤ │ EtcdDatabaseSizeExceeded │ for: 5m │ for: 30m │ for: 6h │ ├───────────────────────────────┼───────────────────┼─────────────────────┼───────────────────┤ │ EtcdFrequentLeaderChanges │ for: 5m │ for: 30m │ for: 6h │ ├───────────────────────────────┼───────────────────┼─────────────────────┼───────────────────┤ │ EtcdPeerRoundTripTimeHigh │ for: 5m, rate[5m] │ for: 30m, rate[30m] │ for: 6h, rate[6h] │ ├───────────────────────────────┼───────────────────┼─────────────────────┼───────────────────┤ │ EtcdWALFsyncDurationHigh │ for: 5m, rate[5m] │ for: 30m, rate[30m] │ for: 6h, rate[6h] │ └───────────────────────────────┴───────────────────┴─────────────────────┴───────────────────┘ Automated tests that run via make alerts are passing and generated alerts in the bicep files are deployed successfully via make personal-dev-env.
- Updated etcd alerts to include the burn rate tier in the alert name and description annotation. - Removed the reference to the etcd alerts from alerts-sl-services.yaml.
- Removed duplicate entries from alerts-sl-services.yaml and regenerated generatedPrometheusAlertingRules.bicep.
Addressing PR comments. - Wrapped all histogram rate expressions in sum by (cluster, instance, le) (rate(...)) across all 3 histogram alert groups (BackendCommit, PeerRTT, WALFsync) in both fast/medium/slow tiers. - Inverted the condition to < 0.5 to detect high fragmentation, renamed alerts from EtcdDatabaseInUseSizeHigh to EtcdDatabaseHighFragmentation, and updated summary/description to say "fragmentation is high" with "defragmentation may be needed". - Added short_window: 6h to all 3d-tier alerts for label consistency. - Changed all fast/medium tier severities from warning to 3 and all slow tier severities from info to 4. - Prefixed all 18 alert names with userJourney as per updated naming convention in alerting ADR (ex. EtcdBackendCommitDurationHigh1h5m → userJourneyEtcdBackendCommitDurationHigh1h5m). - Added and clause with the long window rate for fast (1h) and medium (6h) tiers on all histogram-based alerts. Gauge/counter alerts are unchanged since MWMBR doesn't apply to them. Changes made with assistance from Claude Opus 4.6.
- Splitting RP HCP and Service generated alert rules into their own files.
- Updated etcd alert definitions to include the TSG URL.
- Updated the etcd tests to expect the real TSG URL. - Regenerated the generatedRPHCPPrometheusAlertingRules.bicep file to include the correct TSG URL.
Updated ALERT_CONFIGS list in tooling/prometheus-alerts/Makefile to include a reference to the the alerts-rp-hcps file. Updated azureMonitoringWorkspaceId param in rpHcpAlerts module in monitoring bicep file to use hcpAzureMonitoringWorkspaceId. Updated misleading comment in rp-hcp-rules bicep file.
Added component label set to fleet for etcd availability alerts. Added labels.instance to the summary annotation for etcd availability alerts.
Updated groupNamePrefix in alerts-rp-services to use underscores to keep naming convention consistent. Those alert names use underscores, whereas most are using dashes for the separator. Added the component label set to backend for the cluster-service-slo alerts and updated the test file accordingly. Had to do that to unblock running make alerts after rebasing from main. Bicep files were updated after running make alerts. One of my previous commits split up the the RP alerts into separate files, so now that make alerts is working I deleted the generatedRPPrometheusAlertingRules.bicep file after confirming only the resource names changed due to the prefix being added.
Updated etcd availability alerts to - include label.cluster and label.resource_id in the summary annotation for each alert - updated the component label from fleet to hcp - switched the fragmentation, leader change and database size alerts from MWMBR to simple gauge alerts retaining the 3 burn rate tiers - exempted the e2e subscriptions from triggering the alerts Ran make alerts and make personal-dev-env successfully after changes.
Removing generatedRPPrometheusAlertingRules.bicep to fix merge conflict as rules files have been split up for the RP lane. Regenerated generatedRPServicePrometheusAlertingRules.bicep with latest changes.
d423657 to
0fa627b
Compare
There was a problem hiding this comment.
🟡 Not ready to approve
Several etcd histogram-based alerts aggregate away resource_id while still templating it into annotations/correlation IDs, producing empty identifiers and necessitating corresponding rule/test updates.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Comments suppressed due to low confidence (6)
observability/alerts/etcd-availability-prometheusRule.yaml:203
- Same issue here:
sum by (cluster, instance, le)dropsresource_id, but annotations/correlation IDs expect it. Addresource_idto the aggregation labels so the alert series retains it.
histogram_quantile(0.99, sum by (cluster, instance, le) (rate(etcd_network_peer_round_trip_time_seconds_bucket{subscription_id!~"974ebd46-8ad3-41e3-afef-7ef25fd5c371|e8c5a115-842d-4d7e-98ad-cfb2c50b209e|e627aa70-36a3-40b0-8e68-975269e39d7b|6ed122d1-7e03-4a01-baae-9020abf350d4|64f0619f-ebc2-4156-9d91-c4c781de7e54|dee2f1be-a999-4e19-b027-221e7adaf7d3|8d696692-794f-4cdb-ba25-9250c9e9ec4c|ec435068-e722-475f-8504-c91b72a5dc51|403d9de9-132b-4974-94a5-5b78bdfa191e"}[5m]))) > 0.1
and
histogram_quantile(0.99, sum by (cluster, instance, le) (rate(etcd_network_peer_round_trip_time_seconds_bucket{subscription_id!~"974ebd46-8ad3-41e3-afef-7ef25fd5c371|e8c5a115-842d-4d7e-98ad-cfb2c50b209e|e627aa70-36a3-40b0-8e68-975269e39d7b|6ed122d1-7e03-4a01-baae-9020abf350d4|64f0619f-ebc2-4156-9d91-c4c781de7e54|dee2f1be-a999-4e19-b027-221e7adaf7d3|8d696692-794f-4cdb-ba25-9250c9e9ec4c|ec435068-e722-475f-8504-c91b72a5dc51|403d9de9-132b-4974-94a5-5b78bdfa191e"}[1h]))) > 0.1
observability/alerts/etcd-availability-prometheusRule.yaml:250
- Same issue here:
sum by (cluster, instance, le)dropsresource_id, but annotations/correlation IDs expect it. Addresource_idto the aggregation labels so the alert series retains it.
histogram_quantile(0.99, sum by (cluster, instance, le) (rate(etcd_disk_wal_fsync_duration_seconds_bucket{subscription_id!~"974ebd46-8ad3-41e3-afef-7ef25fd5c371|e8c5a115-842d-4d7e-98ad-cfb2c50b209e|e627aa70-36a3-40b0-8e68-975269e39d7b|6ed122d1-7e03-4a01-baae-9020abf350d4|64f0619f-ebc2-4156-9d91-c4c781de7e54|dee2f1be-a999-4e19-b027-221e7adaf7d3|8d696692-794f-4cdb-ba25-9250c9e9ec4c|ec435068-e722-475f-8504-c91b72a5dc51|403d9de9-132b-4974-94a5-5b78bdfa191e"}[5m]))) > 0.01
and
histogram_quantile(0.99, sum by (cluster, instance, le) (rate(etcd_disk_wal_fsync_duration_seconds_bucket{subscription_id!~"974ebd46-8ad3-41e3-afef-7ef25fd5c371|e8c5a115-842d-4d7e-98ad-cfb2c50b209e|e627aa70-36a3-40b0-8e68-975269e39d7b|6ed122d1-7e03-4a01-baae-9020abf350d4|64f0619f-ebc2-4156-9d91-c4c781de7e54|dee2f1be-a999-4e19-b027-221e7adaf7d3|8d696692-794f-4cdb-ba25-9250c9e9ec4c|ec435068-e722-475f-8504-c91b72a5dc51|403d9de9-132b-4974-94a5-5b78bdfa191e"}[1h]))) > 0.01
observability/alerts/etcd-availability-prometheusRule_test.yaml:20
- The promtool tests currently assume
clusterandresource_idare absent (note the leading spaces / empty segments in expected annotations). If you keepresource_idin the alert text/correlation IDs, the test input series should include representativeclusterandresource_idlabels so expectations validate the real alert payloads.
# Scenario 1: High commit duration — all three tiers fire
- interval: 1m
input_series:
- series: 'etcd_disk_backend_commit_duration_seconds_bucket{instance="etcd-0",le="0.001"}'
values: "0+10x370"
dev-infrastructure/modules/metrics/rp-rules.bicep:27
rp-rules.bicepnow includes both RP service alert rules and HCP alert rules, but it only takes a singleazureMonitoringWorkspaceIdparameter (documented as services/AKS metrics). This would deploy HCP rules to the wrong workspace if this module is used. Sincemonitoring.bicepnow deploys HCP rules viarp-hcp-rules.bicep, consider removing the HCP rules from this combined module (or reworking it to accept a separate HCP workspace ID).
module rpHcpGeneratedAlerts 'rules/generatedRPHCPPrometheusAlertingRules.bicep' = {
name: 'generatedRPHCPPrometheusAlertingRules'
params: {
azureMonitoring: azureMonitoringWorkspaceId
actionGroups: actionGroups
severityCeiling: severityCeiling
}
}
observability/alerts/etcd-availability-prometheusRule.yaml:27
- These histogram-based alerts reference $labels.resource_id in summary/description, but the
sum by (cluster, instance, le)aggregation drops theresource_idlabel, soresource_id(and correlation IDs derived from it) will be empty at runtime. Includeresource_idin the aggregation labels so it propagates throughhistogram_quantile.
This issue also appears in the following locations of the same file:
- line 201
- line 248
histogram_quantile(0.99, sum by (cluster, instance, le) (rate(etcd_disk_backend_commit_duration_seconds_bucket{subscription_id!~"974ebd46-8ad3-41e3-afef-7ef25fd5c371|e8c5a115-842d-4d7e-98ad-cfb2c50b209e|e627aa70-36a3-40b0-8e68-975269e39d7b|6ed122d1-7e03-4a01-baae-9020abf350d4|64f0619f-ebc2-4156-9d91-c4c781de7e54|dee2f1be-a999-4e19-b027-221e7adaf7d3|8d696692-794f-4cdb-ba25-9250c9e9ec4c|ec435068-e722-475f-8504-c91b72a5dc51|403d9de9-132b-4974-94a5-5b78bdfa191e"}[5m]))) > 0.025
and
histogram_quantile(0.99, sum by (cluster, instance, le) (rate(etcd_disk_backend_commit_duration_seconds_bucket{subscription_id!~"974ebd46-8ad3-41e3-afef-7ef25fd5c371|e8c5a115-842d-4d7e-98ad-cfb2c50b209e|e627aa70-36a3-40b0-8e68-975269e39d7b|6ed122d1-7e03-4a01-baae-9020abf350d4|64f0619f-ebc2-4156-9d91-c4c781de7e54|dee2f1be-a999-4e19-b027-221e7adaf7d3|8d696692-794f-4cdb-ba25-9250c9e9ec4c|ec435068-e722-475f-8504-c91b72a5dc51|403d9de9-132b-4974-94a5-5b78bdfa191e"}[1h]))) > 0.025
cluster-service/alerts/cluster-service-slo-rules.yaml:394
- The new
component: backendlabel value on Cluster Service SLO alerts is inconsistent with how other service rule groups labelcomponent(e.g., backend/alerts/* usecomponent: backend, frontend usescomponent: frontend, maestro usescomponent: maestro). Ifcomponentis used for routing or dashboards, these alerts will be misclassified; consider using a Cluster Service-specific value (and updating the test expectations).
for: 5m
labels:
component: backend
long: 6h
severity: warning
- Files reviewed: 18/19 changed files
- Comments generated: 0 new
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
🟡 Not ready to approve
dev-infrastructure/modules/metrics/rp-rules.bicep currently wires RP-HCP alert rules to the services workspace parameter, which is likely incorrect and should be corrected/removed before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
- Files reviewed: 18/19 changed files
- Comments generated: 1
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
Removed labels.cluster from the beginning of the summary annotation for all alerts to address Simon's comment re duplicate strings in IcM titles.
There was a problem hiding this comment.
🟡 Not ready to approve
There are unresolved alert-routing/scoping issues (misleading component labeling for Cluster Service SLO alerts and potentially unsafe scoping in rp-rules.bicep) that could impact operational behavior if merged as-is.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Comments suppressed due to low confidence (9)
dev-infrastructure/modules/metrics/rp-rules.bicep:27
rp-rules.bicepnow wires the HCP alert rules module toazureMonitoringWorkspaceId, whose description says it is for services/AKS level metrics. This makes it easy to accidentally deploy HCP alerts to the wrong Azure Monitor Workspace if this module is reused in the future (the HCP lane useshcpAzureMonitoringWorkspaceIdintemplates/monitoring.bicep). Consider keepingrp-rules.bicepservice-scoped now that RP service/HCP rules are deployed via dedicated modules.
module rpHcpGeneratedAlerts 'rules/generatedRPHCPPrometheusAlertingRules.bicep' = {
name: 'generatedRPHCPPrometheusAlertingRules'
params: {
azureMonitoring: azureMonitoringWorkspaceId
actionGroups: actionGroups
severityCeiling: severityCeiling
}
}
dev-infrastructure/modules/metrics/rp-service-rules.bicep:1
- This file comment says these alerts are "reserved for future" use, but
dev-infrastructure/templates/monitoring.bicepnow deploysrp-service-rules.bicepin the RP lane. Please update the comment so it accurately reflects current usage.
// Alerts and Recording Rules reserved for future ARO-RP-owned user journey alerts.
dev-infrastructure/modules/metrics/rp-hcp-rules.bicep:1
- This file comment says these alerts are "reserved for future" use, but
dev-infrastructure/templates/monitoring.bicepnow deploysrp-hcp-rules.bicepto publish HCP etcd alerts. Please update the comment so it accurately reflects current usage.
// Alerts and Recording Rules reserved for future ARO-RP-owned user journey alerts.
cluster-service/alerts/cluster-service-slo-rules.yaml:406
- These SLO alerts are for the Cluster Service (
namespace="clusters-service", summaries reference "Cluster Service"), but the newly addedcomponent: backendlabel suggests a different owning component and may misroute/misclassify alerts. Please confirm the intended component label and align it consistently with other SLO alerting rules.
component: backend
cluster-service/alerts/cluster-service-slo-rules.yaml:437
- These SLO alerts are for the Cluster Service (
namespace="clusters-service"), but the newly addedcomponent: backendlabel may misroute/misclassify alerts. Please confirm the intendedcomponentlabel and align it consistently.
component: backend
cluster-service/alerts/cluster-service-slo-rules.yaml:450
- These SLO alerts are for the Cluster Service (
namespace="clusters-service"), but the newly addedcomponent: backendlabel may misroute/misclassify alerts. Please confirm the intendedcomponentlabel and align it consistently.
component: backend
cluster-service/alerts/cluster-service-slo-rules.yaml:481
- These SLO alerts are for the Cluster Service (
namespace="clusters-service"), but the newly addedcomponent: backendlabel may misroute/misclassify alerts. Please confirm the intendedcomponentlabel and align it consistently.
component: backend
cluster-service/alerts/cluster-service-slo-rules.yaml:494
- These SLO alerts are for the Cluster Service (
namespace="clusters-service"), but the newly addedcomponent: backendlabel may misroute/misclassify alerts. Please confirm the intendedcomponentlabel and align it consistently.
component: backend
cluster-service/alerts/cluster-service-slo-rules.yaml:392
- These SLO alerts are for the Cluster Service (
namespace="clusters-service", summaries reference "Cluster Service"), but the newly addedcomponent: backendlabel suggests a different owning component and may misroute/misclassify alerts. Other SLO alert groups inobservability/alerts/*-slo-*.yamlusecomponent: sloat the group level (e.g.observability/alerts/access-cluster-slo-prometheusRule.yaml:29-30). Please confirm the intended component label here and align it consistently.
This issue also appears in the following locations of the same file:
- line 406
- line 437
- line 450
- line 481
- line 494
component: backend
- Files reviewed: 18/19 changed files
- Comments generated: 0 new
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
What
Adding Prometheus alerts for etcd metrics exposed via the SRE metrics set as described in ARO-25981.
Alerts follow the design defined in the ARO HCP Alerting Recommendation ADR.
See https://github.com/openshift-online/architecture/pull/79 for details.
18 alerts total in three separate burn-rate tiers.
│ Alert │ Fast (1h/5m) │ Medium (6h/30m) │ Slow (3d) │
│ EtcdBackendCommitDurationHigh │ for: 5m, rate[5m] │ for: 30m, rate[30m] │ for: 6h, rate[6h] │
│ EtcdDatabaseInUseSizeHigh │ for: 5m │ for: 30m │ for: 6h │
│ EtcdDatabaseSizeExceeded │ for: 5m │ for: 30m │ for: 6h │
│ EtcdFrequentLeaderChanges │ for: 5m │ for: 30m │ for: 6h │
│ EtcdPeerRoundTripTimeHigh │ for: 5m, rate[5m] │ for: 30m, rate[30m] │ for: 6h, rate[6h] │
│ EtcdWALFsyncDurationHigh │ for: 5m, rate[5m] │ for: 30m, rate[30m] │ for: 6h, rate[6h] │
Prometheus rules and test file generated with the help of claude-sonnet-4-6.
Why
We are currently lacking alerts for etcd performance degradation scenarios. Alerts are only being added for the etcd instances in the customer HCP clusters.
Testing
Automated tests that run via make alerts are passing and generated alerts in the bicep files are deployed successfully via make personal-dev-env.
Confirmed alerts are firing via Azure Portal and a test email action group. Example of firing alert email below.
Alert name etcd-availability/EtcdPeerRoundTripTimeHigh1h5m
Severity Sev3
Monitor condition Fired
Affected resource services-usw3keob
Resource type microsoft.monitor/accounts
Resource group hcp-underlay-pers-xyz
Description etcd instance etcd-6a29af2d5dac860001bca2bb-dgrv4746q2 has 99th percentile peer round-trip time of 0.10122971428571428s (threshold: 100ms). Network latency between peers may be affecting cluster performance.
Monitoring service Prometheus
Signal type Metric
Fired time June 17, 2026 3:28 UTC
Alert ID f45d3e02-32cd-bd71-1a3f-da9f015e000a - .../providers/Microsoft.AlertsManagement/prometheusRuleGroups/etcd-availability
PR Checklist