Skip to content

fix(SPRE-7072): remove EtcdCustomDefragOccurred - #1361

Merged
FaisalAl-Rayes merged 5 commits into
redhat-appstudio:mainfrom
diksha1999:SPRE-7072-etcd-custom-defrag
Nov 23, 2026
Merged

FaisalAl-Rayes merged 5 commits into
redhat-appstudio:mainfrom
diksha1999:SPRE-7072-etcd-custom-defrag

Conversation

@diksha1999

@diksha1999 diksha1999 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Remove EtcdCustomDefragOccurred.

Infra reviewed the alert. It was added for a short period when clusters used etcd's built-in defrag. That was turned off after it nearly blocked five clusters, and every defrag is now the custom etcd-maintenance CronJob. The alert no longer describes a separate event.

Jira: SPRE-7072

Pre-Submission Checklist

  • Jira Ticket: If a corresponding Jira ticket exists, it is linked in the description above, in the PR name, and/or in the commit message.
  • Alert Tests: New or modified alerts include tests to ensure they function correctly.
  • SOP / Runbook: Any required SOP has been created or updated as needed. If it has direct connection to the dashboard or alert - It should be included within the dashboard or alert's runbook label respectively.
  • Dashboards Addition: New dashboards or significant changes to them should have a link to the staging instance for validation purposes.
  • Contribution Guides: This submission follows the guidelines in our CONTRIBUTING.md - specifically about the commit conventions and PR instructions - together with our README.md which explains contents of this repository with useful examples for contribution.
  • Pipeline Finished Successfully

The alert's promtool cases are removed with it.

Deployment Notice

  • Production Deployment: For any changes to alerts, recording rules or dashboards, I understand that the deployment of changes to production requires updating the commit reference to o11y in app-interface repository.

@qodo-for-redhat-appstudio

Copy link
Copy Markdown

PR Summary by Qodo

Alert only on sustained custom etcd defrag loops

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Replace the routine-defrag false positive with an alert for sustained, frequent defrag starts.
• Lower severity to warning while preserving routing and the runbook URL.
• Test sustained loops, isolated defrags, slower cadences, and bursts that stop.
Diagram

graph TD
  J["Maintenance CronJob"] --> M["Inflight metric"] --> S["Defrag start filter"] --> T{"10 starts hourly?"} --> H{"Sustained 30 minutes?"} --> A["Warning alert"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Consolidate the two frequent-defrag alerts
  • ➕ Avoids duplicate notifications if the planned EtcdDefragFrequent rewrite uses the same condition.
  • ➖ Requires coordination with the separate rewrite and a decision about which alert identity to retain.

Recommendation: Keep this scoped false-positive fix. Coordinate a follow-up consolidation when the EtcdDefragFrequent rewrite lands, since identical conditions would otherwise notify twice.

Files changed (2) +75 / -15

Bug fix (1) +35 / -7
prometheus.etcd_defrag.yamlRequire sustained, frequent starts for the custom defrag alert +35/-7

Require sustained, frequent starts for the custom defrag alert

• Replaces the overlapping two-defrag time window with an hourly count of defrag starts sustained for 30 minutes. Changes severity to warning and revises the alert text; routing and the runbook URL remain unchanged.

rhobs/alerting/data_plane/prometheus.etcd_defrag.yaml

Tests (1) +40 / -8
etcd_defrag_test.yamlCover sustained loops and non-alerting defrag patterns +40/-8

Cover sustained loops and non-alerting defrag patterns

• Updates expectations for the new severity and annotations. Adds cases for repeated five-minute starts, isolated defrags, ten-minute starts, a stopped burst, and an idle metric.

test/promql/tests/data_plane/etcd_defrag_test.yaml

@qodo-for-redhat-appstudio

qodo-for-redhat-appstudio Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Code Review by Qodo


View medium (1)
Remediation recommended
1. Long defrag loops evade alerts 🔗 Cross-repo conflict
Description
EtcdCustomDefragOccurred requires ten defrag starts per hour, but infra-deployments configures the
five-minute maintenance CronJob to forbid overlapping runs and allows a run to last up to ten
minutes. When repeated runs take more than five minutes, scheduled executions are skipped and the
alert can remain silent even if every eligible execution starts another defrag.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The ten-start threshold cannot detect repeated long-running defrags when the CronJob skips schedules under its Forbid concurrency policy.

## Fix Focus Areas
- rhobs/alerting/data_plane/prometheus.etcd_defrag.yaml[39-46]
- test/promql/tests/data_plane/etcd_defrag_test.yaml[64-75]
- /cross_repos/infra-deployments/configs/etcd-defrag/base/cronjob.yaml[8-13]

## Recommended Fix
Add an alert condition for sustained long-running or repeatedly skipped defrag executions, or calibrate the start threshold to executions the configured CronJob can actually make. Test repeated five-to-ten-minute runs without changing the CronJob solely to satisfy the alert.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


@diksha1999 diksha1999 changed the title fix(SPRE-7072): alert on sustained custom etcd defrag loops in EtcdCustomDefragOccurred fix(SPRE-7072): remove EtcdCustomDefragOccurred Nov 16, 2026

@glevi-rh glevi-rh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@FaisalAl-Rayes

Copy link
Copy Markdown
Contributor

/ok-to-test

1 similar comment
@rubenmgx

Copy link
Copy Markdown
Contributor

/ok-to-test

@rubenmgx

Copy link
Copy Markdown
Contributor

/test all

@rubenmgx

Copy link
Copy Markdown
Contributor

/ok-to-test

@rubenmgx

Copy link
Copy Markdown
Contributor

/approved

@rubenmgx

Copy link
Copy Markdown
Contributor

/retest

@FaisalAl-Rayes

Copy link
Copy Markdown
Contributor

/ok-to-test

@FaisalAl-Rayes FaisalAl-Rayes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

…stomDefragOccurred

The 3-10 minute window overlaps the 5-minute etcd-maintenance CronJob, so routine defrags fired EtcdCustomDefragOccurred. Count starts over the last hour and alert only when at least 10 of 12 runs defrag for 30 minutes.
Match the shorter comment used on the sibling defrag alert.
A cluster-wide sum counts one CronJob run several times when members defrag a minute apart. Keep the highest per-member start count so one run counts once.
Every defrag is now the custom etcd-maintenance CronJob, so this leftover alert no longer describes a separate event. EtcdDefragFrequent remains the loop signal.
@diksha1999
diksha1999 force-pushed the SPRE-7072-etcd-custom-defrag branch from caa61be to 1f984b1 Compare November 23, 2026 12:05
@FaisalAl-Rayes

Copy link
Copy Markdown
Contributor

/ok-to-test

@FaisalAl-Rayes
FaisalAl-Rayes merged commit 8032791 into redhat-appstudio:main Nov 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants