mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Expose number of inhibited alerts in the /alerts.json response
This is so that the UI can take use of it
This commit is contained in:
3
views.go
3
views.go
@@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -165,6 +166,8 @@ func alerts(c *gin.Context) {
|
||||
countLabel(counters, "@silenced", "false")
|
||||
}
|
||||
|
||||
countLabel(counters, "@inhibited", strconv.FormatBool(alert.Inhibited))
|
||||
|
||||
for key, value := range alert.Labels {
|
||||
if keyMap, foundKey := store.Store.Colors[key]; foundKey {
|
||||
if color, foundColor := keyMap[value]; foundColor {
|
||||
|
||||
@@ -142,7 +142,7 @@ func TestAlerts(t *testing.T) {
|
||||
if ur.Status != "success" {
|
||||
t.Errorf("[%s] Invalid status in response: %s", version, ur.Status)
|
||||
}
|
||||
if len(ur.Counters) != 5 {
|
||||
if len(ur.Counters) != 6 {
|
||||
t.Errorf("[%s] Invalid number of counters in response (%d): %v", version, len(ur.Counters), ur.Counters)
|
||||
}
|
||||
for _, ag := range ur.AlertGroups {
|
||||
|
||||
Reference in New Issue
Block a user