Group ID needs to include receiver name

This commit is contained in:
Łukasz Mierzwa
2017-06-03 18:43:50 -07:00
parent 7bac3d89c0
commit 081b93c6b8

View File

@@ -69,7 +69,10 @@ func PullFromAlertmanager() {
log.Infof("Deduplicating alert groups (%d)", len(alertGroups))
uniqueGroups := map[string]models.AlertGroup{}
for _, ag := range alertGroups {
agID := fmt.Sprintf("%x", structhash.Sha1(ag.Labels, 1))
agIDHasher := sha1.New()
io.WriteString(agIDHasher, ag.Receiver)
io.WriteString(agIDHasher, fmt.Sprintf("%x", structhash.Sha1(ag.Labels, 1)))
agID := fmt.Sprintf("%x", agIDHasher.Sum(nil))
if _, found := uniqueGroups[agID]; !found {
uniqueGroups[agID] = ag
}