feat(api): expose total alerts counter in the api response

This commit is contained in:
Łukasz Mierzwa
2018-07-19 23:38:11 +02:00
parent b7d274c93b
commit c0fdb71276
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@ type AlertsResponse struct {
Version string `json:"version"`
Upstreams AlertmanagerAPISummary `json:"upstreams"`
AlertGroups map[string]AlertGroup `json:"groups"`
TotalAlerts int `json:"totalAlerts"`
Colors LabelsColorMap `json:"colors"`
Filters []Filter `json:"filters"`
Counters LabelsCountMap `json:"counters"`
+1
View File
@@ -165,6 +165,7 @@ func alerts(c *gin.Context) {
if len(agCopy.Alerts) > 0 {
agCopy.Hash = agCopy.ContentFingerprint()
alerts[agCopy.ID] = agCopy
resp.TotalAlerts += len(agCopy.Alerts)
}
}