Add alert archiving
Release / build (amd64, darwin) (push) Failing after 2m46s
Release / build (amd64, linux) (push) Failing after 2m26s
Release / build (arm64, darwin) (push) Failing after 1m40s
Release / build (arm64, linux) (push) Failing after 10s
Release / release (push) Has been skipped
Release / chart (push) Failing after 11s
Release / docker (push) Failing after 19s

Alerts can be manually archived (POST /api/alerts/{id}/archive) or
unarchived (DELETE /api/alerts/{id}/archive). A background goroutine
auto-archives resolved alerts older than TERDUT_ARCHIVE_AFTER (default 7d).
GET /api/alerts hides archived alerts by default; ?archived=true shows them.
This commit is contained in:
Niklas Ye
2026-05-22 13:22:45 +02:00
parent 36468a68ed
commit debc4bf78c
8 changed files with 178 additions and 6 deletions
+2
View File
@@ -41,6 +41,8 @@ func main() {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
go api.StartArchiver(ctx, database, cfg.ArchiveAfter)
go func() {
log.Printf("terdut-server %s listening on %s", version, cfg.Addr)
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {