Skip to content

move SetNotifiesStage into its own file#5262

Open
Spaceman1701 wants to merge 3 commits into
prometheus:mainfrom
Spaceman1701:refactor/notify-1
Open

move SetNotifiesStage into its own file#5262
Spaceman1701 wants to merge 3 commits into
prometheus:mainfrom
Spaceman1701:refactor/notify-1

Conversation

@Spaceman1701
Copy link
Copy Markdown
Contributor

@Spaceman1701 Spaceman1701 commented May 29, 2026

This is part 1 of breaking up notify.go into a few separate files. I'm generally going to aim to

  1. move each stage implementation into its own file, or at least a file of related stages
  2. keep common types and utilities in notify.go
    I'm motivated to do this because making changes in notify.go is becoming difficult because of its length and the number of repeated symbols.

I'm going to do this one piece at a time so the reviews are easier. This PR takes the SetNotifiesStage and moves it into set_notifies.go. Nothing about the code or behavior changes.

NONE

Summary by CodeRabbit

  • Refactor
    • Notification bookkeeping stage relocated and reimplemented to streamline how notification expiry is calculated and logged. Behavior is preserved; telemetry (span/attributes) and optional store handling were added to improve observability and robustness.

Review Change Stack

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
@Spaceman1701 Spaceman1701 requested a review from a team as a code owner May 29, 2026 18:41
@Spaceman1701 Spaceman1701 added component/notify go Pull requests that update Go code labels May 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bf355e09-ea8b-48e6-acc4-5303085a8efc

📥 Commits

Reviewing files that changed from the base of the PR and between 2761dac and 8c0bbea.

📒 Files selected for processing (1)
  • notify/set_notifies.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • notify/set_notifies.go

📝 Walkthrough

Walkthrough

SetNotifiesStage is moved from notify/notify.go into notify/set_notifies.go. The stage validates context values, starts an OpenTelemetry span, computes expiry = 2 * repeat interval, optionally reads an NflogStore, and logs alerts via the NotificationLog.

Changes

SetNotifiesStage Module Organization

Layer / File(s) Summary
SetNotifiesStage relocation
notify/notify.go, notify/set_notifies.go
SetNotifiesStage type, NewSetNotifiesStage constructor, and Exec method are moved to notify/set_notifies.go. The stage reads GroupKey, FiringAlerts, ResolvedAlerts, and RepeatInterval from context, starts an OpenTelemetry span with alert/group counts, computes expiry = 2 * repeat, optionally extracts an NflogStore from context, and calls nflog.Log(...) with receiver metadata and alert sets.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • TheMeier
  • SoloJacobs
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: moving SetNotifiesStage into its own file. It is concise and clearly conveys the refactoring objective.
Description check ✅ Passed The description explains the motivation (reducing file length), the scope (moving SetNotifiesStage to set_notifies.go with no behavioral changes), and includes the release-notes section. However, it does not include linked issues or confirmation of the checklist items required by the template.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Spaceman1701 and others added 2 commits May 29, 2026 16:03
Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
Signed-off-by: Ethan Hunter <fc.spaceman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/notify go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant