mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vmalert: keep the returned timestamp when persisting recording rule (#1245)
Previously, vmalert used `lastExecTime` timestamp when writing recording rules to the remote storage. This may be incorrect, if vmalert uses `datasource.lookback` flag, which means rule's expression will be executed at some moment in the past. To avoid such situations, vmalert now will use returned timestamp instead of `lastExecTime`.
This commit is contained in:
parent
2357e21024
commit
0ceb4f7565
1 changed files with 1 additions and 1 deletions
|
@ -100,7 +100,7 @@ func (rr *RecordingRule) Exec(ctx context.Context, q datasource.Querier, series
|
||||||
duplicates := make(map[uint64]prompbmarshal.TimeSeries, len(qMetrics))
|
duplicates := make(map[uint64]prompbmarshal.TimeSeries, len(qMetrics))
|
||||||
var tss []prompbmarshal.TimeSeries
|
var tss []prompbmarshal.TimeSeries
|
||||||
for _, r := range qMetrics {
|
for _, r := range qMetrics {
|
||||||
ts := rr.toTimeSeries(r, rr.lastExecTime)
|
ts := rr.toTimeSeries(r, time.Unix(r.Timestamp, 0))
|
||||||
h := hashTimeSeries(ts)
|
h := hashTimeSeries(ts)
|
||||||
if _, ok := duplicates[h]; ok {
|
if _, ok := duplicates[h]; ok {
|
||||||
rr.lastExecError = errDuplicate
|
rr.lastExecError = errDuplicate
|
||||||
|
|
Loading…
Reference in a new issue