Do not expose resolved alerts & do not send resolved if never firing (#820)
Do not expose resolved alerts on the /alerts endpoint. Do not send resolved alerts to receivers if the alerts have never been fired before.
This commit is contained in:
parent
0819ee8a87
commit
a217e162a8
|
@ -300,6 +300,11 @@ func (api *API) listAlerts(w http.ResponseWriter, r *http.Request) {
|
|||
continue
|
||||
}
|
||||
|
||||
// Continue if alert is resolved
|
||||
if !a.Alert.EndsAt.IsZero() && a.Alert.EndsAt.Before(time.Now()) {
|
||||
continue
|
||||
}
|
||||
|
||||
status := api.getAlertStatus(a.Fingerprint())
|
||||
|
||||
if !showSilenced && len(status.SilencedBy) != 0 {
|
||||
|
|
|
@ -474,7 +474,7 @@ func (n *DedupStage) needsUpdate(entry *nflogpb.Entry, firing, resolved map[uint
|
|||
// If we haven't notified about the alert group before, notify right away
|
||||
// unless we only have resolved alerts.
|
||||
if entry == nil {
|
||||
return ((len(firing) > 0) || (n.sendResolved && len(resolved) > 0)), nil
|
||||
return len(firing) > 0, nil
|
||||
}
|
||||
|
||||
if !entry.IsFiringSubset(firing) {
|
||||
|
|
Loading…
Reference in New Issue