feat: alert channel health indicator + test alerts #36

Merged
lerko merged 1 commits from feat/alert-health into main 2026-05-28 01:33:01 +00:00
Owner

Summary

Alert channels now show whether they're working. Previously fire-and-forget with no visibility.

Changes

Engine (monitor.go):

  • AlertHealth struct tracks per-channel: last send time, success/fail, error, counts
  • triggerAlert records delivery result after each Send()
  • GetAlertHealth(id) exposes health for TUI
  • TestAlert(id) sends test notification synchronously, records result

Alerts tab (tab_alerts.go):

  • New health dot column: ● green (OK), ● red (failed), ● gray (never sent)
  • New LAST SENT column: relative time ("2m ago", "1h ago", "never")
  • Last error visible in logs when send fails

TUI (tui.go):

  • t key on alerts tab sends test notification
  • Keybinding display updated: [n]New [e]Edit [d]Del [t]Test [T]Theme [Tab]Switch [q]Quit

Inspired by

Grafana's contact point health columns (Health, Last Delivery Attempt, Duration).

Files (3)

  • internal/monitor/monitor.go — AlertHealth type, tracking, test alert
  • internal/tui/tab_alerts.go — health dot, last sent column, formatters
  • internal/tui/tui.go — t key handler, keybinding display
## Summary Alert channels now show whether they're working. Previously fire-and-forget with no visibility. ### Changes **Engine (`monitor.go`):** - `AlertHealth` struct tracks per-channel: last send time, success/fail, error, counts - `triggerAlert` records delivery result after each Send() - `GetAlertHealth(id)` exposes health for TUI - `TestAlert(id)` sends test notification synchronously, records result **Alerts tab (`tab_alerts.go`):** - New health dot column: ● green (OK), ● red (failed), ● gray (never sent) - New LAST SENT column: relative time ("2m ago", "1h ago", "never") - Last error visible in logs when send fails **TUI (`tui.go`):** - `t` key on alerts tab sends test notification - Keybinding display updated: `[n]New [e]Edit [d]Del [t]Test [T]Theme [Tab]Switch [q]Quit` ### Inspired by Grafana's contact point health columns (Health, Last Delivery Attempt, Duration). ### Files (3) - `internal/monitor/monitor.go` — AlertHealth type, tracking, test alert - `internal/tui/tab_alerts.go` — health dot, last sent column, formatters - `internal/tui/tui.go` — t key handler, keybinding display
lerko added 1 commit 2026-05-28 01:23:18 +00:00
feat: alert channel health indicator + test alerts
CI / test (pull_request) Successful in 2m46s
CI / lint (pull_request) Successful in 1m1s
CI / vulncheck (pull_request) Successful in 51s
0aa2f9cd8a
Track alert delivery health at runtime:
- AlertHealth struct: LastSendAt, LastSendOK, LastError, SendCount, FailCount
- triggerAlert records success/failure after each Send()
- Health data exposed via GetAlertHealth() for TUI

Alerts tab enriched:
- Health dot column: green (OK), red (failed), gray (never sent)
- LAST SENT column: relative time ("2m ago", "never")
- [t] key sends test notification through selected channel

Inspired by Grafana's contact point health columns.
lerko merged commit 26e297cbae into main 2026-05-28 01:33:01 +00:00
lerko deleted branch feat/alert-health 2026-05-28 01:33:01 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lerkolabs/uptop#36