mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix incorrect start time for DatasourceError alerts (#59903)
This commit is contained in:
parent
7e339decfe
commit
3c249e1b99
@ -1868,7 +1868,7 @@ func TestProcessEvalResults(t *testing.T) {
|
||||
Values: make(map[string]*float64),
|
||||
},
|
||||
},
|
||||
StartsAt: evaluationTime.Add(20 * time.Second),
|
||||
StartsAt: evaluationTime.Add(30 * time.Second),
|
||||
EndsAt: evaluationTime.Add(50 * time.Second).Add(state.ResendDelay * 3),
|
||||
LastEvaluationTime: evaluationTime.Add(50 * time.Second),
|
||||
EvaluationDuration: evaluationDuration,
|
||||
|
@ -198,6 +198,11 @@ func (a *State) resultError(alertRule *models.AlertRule, result eval.Result) {
|
||||
// is unavailable or queries against the datasource returns errors, and is
|
||||
// then resolved as soon as the datasource is available and queries return
|
||||
// without error
|
||||
if a.State != execErrState {
|
||||
// Set the start time if the state changes from Alerting to Error or from
|
||||
// Error to Alerting
|
||||
a.StartsAt = result.EvaluatedAt
|
||||
}
|
||||
a.State = execErrState
|
||||
a.setEndsAt(alertRule, result)
|
||||
case eval.Pending:
|
||||
|
Loading…
Reference in New Issue
Block a user