Merge pull request #1056 from prymitive/sort-ams

fix(api): sort upstreams in the API response
This commit is contained in:
Łukasz Mierzwa
2019-10-21 12:03:11 +01:00
committed by GitHub

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"net/url"
"sort"
"sync"
"time"
@@ -82,6 +83,9 @@ func GetAlertmanagers() []*Alertmanager {
for _, am := range upstreams {
ams = append(ams, am)
}
sort.Slice(ams[:], func(i, j int) bool {
return ams[i].Name < ams[j].Name
})
return ams
}