fix(api): color @cluster label

This commit is contained in:
Łukasz Mierzwa
2020-06-12 12:18:46 +01:00
committed by Łukasz Mierzwa
parent 685317842e
commit d07c56d3d8
2 changed files with 12 additions and 0 deletions

View File

@@ -309,6 +309,17 @@ func alerts(c *gin.Context) {
}
}
if ck, foundKey := dedupedColors["@cluster"]; foundKey {
for _, am := range alert.Alertmanager {
if cv, foundVal := ck[am.Cluster]; foundVal {
if _, found := colors["@cluster"]; !found {
colors["@cluster"] = map[string]models.LabelColors{}
}
colors["@cluster"][am.Cluster] = cv
}
}
}
agCopy.StateCount[alert.State]++
for _, am := range alert.Alertmanager {

View File

@@ -261,6 +261,7 @@ func (am *Alertmanager) pullAlerts(version string) error {
transform.ColorLabel(colors, "@receiver", alert.Receiver)
for _, am := range alert.Alertmanager {
transform.ColorLabel(colors, "@alertmanager", am.Name)
transform.ColorLabel(colors, "@cluster", am.Cluster)
}
for k, v := range alert.Labels {
transform.ColorLabel(colors, k, v)