Skip to content

Commit

Permalink
fix: Events with empty affected resource list getting ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreZiviani committed Sep 11, 2023
1 parent f61dc5c commit a87a661
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion exporter/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,21 @@ func ignoreResourceEvent(ignoredResourceEvent []string, event HealthEvent) bool
}

size := len(event.AffectedResources)
resourceIgnored := false

for _, ignored := range ignoredResourceEvent {
tmp := strings.Split(ignored, ":")
ignoredEvent, ignoredResource := tmp[0], tmp[1]

for _, resource := range event.AffectedResources {
if *resource.EntityValue == ignoredResource && *event.Event.EventTypeCode == ignoredEvent {
resourceIgnored = true
size -= 1
}
}
}

if size == 0 {
if resourceIgnored && size == 0 {
// all resources are ignored, ignoring entire alert
return true
}
Expand Down

0 comments on commit a87a661

Please sign in to comment.