mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
vmalert: correctly update seriesFetched metric for const exprs (#4287)
Previously, metric `vmalert_alerting_rules_last_evaluation_series_fetched` would be set to 0 for const expressions, because const expression do not match any series. This may result into a confusion: no series were matched but response isn't empty. The change updates the logic behind metric: if no series were matched but there are samples in response - use amount of samples as number of series. Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
fd35f023dd
commit
6365d97aee
1 changed files with 7 additions and 1 deletions
|
@ -129,7 +129,13 @@ func newAlertingRule(qb datasource.QuerierBuilder, group *Group, cfg config.Rule
|
|||
// means seriesFetched is unsupported
|
||||
return -1
|
||||
}
|
||||
return float64(*e.seriesFetched)
|
||||
seriesFetched := float64(*e.seriesFetched)
|
||||
if seriesFetched == 0 && e.samples > 0 {
|
||||
// `alert: 0.95` will fetch no series
|
||||
// but will get one time series in response.
|
||||
seriesFetched = float64(e.samples)
|
||||
}
|
||||
return seriesFetched
|
||||
})
|
||||
return ar
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue