-
- Notifications
You must be signed in to change notification settings - Fork 153
feat: save alert state history #1442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: save alert state history #1442
Conversation
state history for an alert is saved at path .alerts/alert_state_{alertid}.json details to save - state, last_updated_at use to show full track of a lifecycle of an alert not triggered -> triggered -> disabled (if disabled by user) -> not triggered (when issue is resolved)
WalkthroughAdds persistent alert state tracking via new AlertStateEntry/StateTransition types, metastore trait methods and object-store implementations, integrates state creation/update/delete in HTTP handlers and alert logic, introduces alert_state_json_path, and implements LocalFS head to enable presence checks for alert state files. Changes
Sequence Diagram(s)sequenceDiagram autonumber actor Client participant HTTP as HTTP Alerts Handler participant Alerts as Alerts Logic participant Meta as Metastore participant Store as Object Storage rect rgba(230,245,255,0.6) note over Client,HTTP: Create Alert Client->>HTTP: POST /alerts HTTP->>Meta: put_alert_state(AlertStateEntry{NotTriggered}) Meta->>Store: write alert_state_{id}.json HTTP->>Alerts: create + start task HTTP-->>Client: 201 Created end rect rgba(230,255,230,0.6) note over Alerts,Meta: Runtime State Update Alerts->>Meta: put_alert_state(updated state) alt state changed Meta->>Store: read current state Meta->>Store: write updated alert_state_{id}.json else no change Meta-->>Alerts: OK (no write) end end rect rgba(255,235,230,0.6) note over Client,HTTP: Delete Alert Client->>HTTP: DELETE /alerts/{id} HTTP->>Meta: delete_alert_state(entry for {id}) Meta->>Store: delete alert_state_{id}.json HTTP-->>Client: 204 No Content end Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
🧰 Additional context used🧬 Code graph analysis (6)src/handlers/http/alerts.rs (2)
src/storage/localfs.rs (5)
src/alerts/alert_structs.rs (3)
src/metastore/metastores/object_store_metastore.rs (3)
src/metastore/metastore_traits.rs (1)
src/alerts/alert_types.rs (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (1)
Comment |
state history for an alert is saved at path .alerts/alert_state_{alertid}.json details to save - state, last_updated_at
use to show full track of a lifecycle of an alert
not triggered -> triggered -> disabled (if disabled by user) -> not triggered (when issue is resolved)
Summary by CodeRabbit