Skip to content

inhibit: preserve source-only matches in equal-label index - #5449

Open
sueun-dev wants to merge 1 commit into
prometheus:mainfrom
sueun-dev:fix-inhibit-source-only-index
Open

inhibit: preserve source-only matches in equal-label index#5449
sueun-dev wants to merge 1 commit into
prometheus:mainfrom
sueun-dev:fix-inhibit-source-only-index

Conversation

@sueun-dev

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Please check all the applicable boxes.

  • Please list all open issue(s) discussed with maintainers related to this change
    • None.
  • Is this a new Receiver integration?
    • I have already tried to use the Webhook Receiver Integration and 3rd party integrations before adding this new Receiver Integration
  • Is this a bugfix?
    • I have added tests that can reproduce the bug which pass with this bugfix applied
  • Is this a new feature?
    • I have added tests that test the new feature's functionality
  • Does this change affect performance?
    • I have provided benchmarks comparison that shows performance is improved or is not degraded
    • I have added new benchmarks if required or requested by maintainers
  • Is this a breaking change?
    • My changes do not break the existing cluster messages
    • My changes do not break the existing api
  • I have added/updated the required documentation (not needed; this restores the documented self-inhibition behavior)
  • I have signed-off my commits
  • I will follow best practices for contributing to this project

Which user-facing changes does this PR introduce?

[BUGFIX] Inhibition: Fix a case where a source-only alert could be ignored when another source alert with the same equal labels also matched the target side.

Signed-off-by: Sueun Cho <sueun.dev@gmail.com>
@sueun-dev
sueun-dev requested a review from a team as a code owner August 14, 2026 05:32
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 34f2300f-eee9-4cfb-b77c-de5e4bc4e90e

📥 Commits

Reviewing files that changed from the base of the PR and between 55d0d79 and 3738527.

📒 Files selected for processing (2)
  • inhibit/inhibit.go
  • inhibit/inhibit_test.go

📝 Walkthrough

Walkthrough

hasEqual now falls back to the alert cache when an indexed source alert also matches target matchers. Tests cover source-only inhibition with a newer two-sided matching alert.

Changes

Inhibition source lookup

Layer / File(s) Summary
Cache fallback and regression coverage
inhibit/inhibit.go, inhibit/inhibit_test.go
hasEqual scans uncanceled cached alerts for an eligible equal-label source alert when the indexed alert is excluded. Tests configure target matchers and verify the source-only inhibition case.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 37385

This localized bugfix preserves source-only inhibition matches without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant hasEqual
  participant IndexedSourceAlerts
  participant AlertCache
  hasEqual->>IndexedSourceAlerts: Find equal-label source alert
  IndexedSourceAlerts-->>hasEqual: Return indexed alert
  hasEqual->>AlertCache: Scan uncanceled alerts when two-sided match is excluded
  AlertCache-->>hasEqual: Return eligible source fingerprint or no match
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the inhibit area and the primary fix for preserving source-only matches.
Description check ✅ Passed The description covers the checklist, bugfix tests, compatibility, sign-off, best practices, and user-facing release notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SoloJacobs

Copy link
Copy Markdown
Contributor

@siavashs I believe this is a regression introduced in #4607 . Could you have a look?

@SoloJacobs
SoloJacobs requested a review from siavashs August 16, 2026 14:51
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.

3 participants