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:
Łukasz Mierzwa
2017-04-17 12:08:46 -07:00
parent ad8f3b7780
commit 10ef33afdf
2 changed files with 4 additions and 1 deletions

View File

@@ -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 {

View File

@@ -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 {