nflog: add muted_alerts to the notification log entry - #5474
Conversation
Entry records the alerts that were firing and resolved at the time of the last notification, but not the ones that were muted. The mute stages drop muted alerts before the dedup stage runs, so they are absent from both lists and indistinguishable from alerts that stopped firing. Add a muted_alerts field alongside them, an IsMutedSubset helper mirroring IsFiringSubset and IsResolvedSubset, and a mutedAlerts parameter on Log(). The field number 9 is new; existing field numbers are untouched, so entries gossiped by peers that predate this field decode with MutedAlerts unset, and entries this version writes are readable by those peers. Nothing populates the field yet: SetNotifiesStage passes nil, and the dedup stage does not read it. This is the schema and write path only, so that the behavior change can be reviewed on its own. Generated code regenerated with scripts/genproto.sh. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FqRsyADYBfpUxp1JpzQsW8
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe notification log now accepts muted alert IDs, stores them in protobuf entries, exposes subset checks, and validates serialization, querying, timestamp-based merging, and notification integrations. ChangesMuted alert persistence
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds muted-alert information to notification log entries without changing existing alert processing behavior; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description clearly explains the schema, API, compatibility, tests, and intentionally deferred behavior. The feature and compatibility checklist items remain unchecked, and the release-notes block is empty, but the description is otherwise mostly complete and directly related to the changes. Full details: Docstring CoverageExplanation Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 7 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Spaceman1701
left a comment
There was a problem hiding this comment.
Thanks for the contribution, generally looks good!
|
|
||
| // IsMutedSubset returns whether the given subset is a subset of the alerts | ||
| // that were muted at the time of the last notification. | ||
| func (m *Entry) IsMutedSubset(subset map[uint64]struct{}) bool { |
There was a problem hiding this comment.
I'm not sure we'll end up needing this function, I think we should leave it out until it's clear that it'll be used.
…ted-alerts-to-proto
Signed-off-by: Geoff Wilson <geoff@gr-oss.io>
Entry currently records the alerts that were firing and resolved at the time of the last notification, but not the ones that were muted. The mute stages drop muted alerts before the dedup stage runs, so they are absent from both lists and indistinguishable from alerts that stopped firing.
Add a muted_alerts field alongside them, an IsMutedSubset helper mirroring IsFiringSubset and IsResolvedSubset, and a mutedAlerts parameter on Log(). Entries that predate this field decode with MutedAlerts unset.
Nothing populates the field yet: SetNotifiesStage passes nil, and the dedup stage does not read it. This is the schema and write path only, so that the behavior change can be reviewed on its own.
Generated code regenerated with scripts/genproto.sh.
Assisted-by: Claude Code
Pull Request Checklist
Please check all the applicable boxes.
benchstatto compare benchmarksWhich user-facing changes does this PR introduce?