Merge pull request #1233 from Conorbro/resolved-alert-counter-fix

Fixes AM wrongly counting alerts with EndTimes in the future as resolved
This commit is contained in:
Frederic Branczyk 2018-02-08 10:54:13 +01:00 committed by GitHub
commit 168cb217c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -493,7 +493,8 @@ func (api *API) insertAlerts(w http.ResponseWriter, r *http.Request, alerts ...*
if alert.EndsAt.IsZero() {
alert.Timeout = true
alert.EndsAt = now.Add(resolveTimeout)
}
if alert.EndsAt.After(time.Now()) {
numReceivedAlerts.WithLabelValues("firing").Inc()
} else {
numReceivedAlerts.WithLabelValues("resolved").Inc()