From ad64e9f1b2abbb471425e6655ff03ad37252e805 Mon Sep 17 00:00:00 2001 From: Stuart Nelson Date: Sat, 2 Sep 2017 11:35:17 +0200 Subject: [PATCH] Sort alerts by their fingerprint Seemed like an ok way to sort. --- api/api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/api.go b/api/api.go index 0848a240..cf405803 100644 --- a/api/api.go +++ b/api/api.go @@ -18,6 +18,7 @@ import ( "fmt" "net/http" "regexp" + "sort" "sync" "time" @@ -359,6 +360,9 @@ func (api *API) listAlerts(w http.ResponseWriter, r *http.Request) { }, nil) return } + sort.Slice(res, func(i, j int) bool { + return res[i].Fingerprint < res[j].Fingerprint + }) respond(w, res) }