mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Fix two bugs in range op time advancement.
This commit is contained in:
parent
c11737c5fc
commit
becc278eb6
|
@ -215,7 +215,10 @@ func (g *getValuesAlongRangeOp) ExtractSamples(in []model.SamplePair) (out []mod
|
|||
return !in[i].Timestamp.Before(g.from)
|
||||
})
|
||||
if firstIdx == len(in) {
|
||||
// No samples at or after operator start time.
|
||||
// No samples at or after operator start time. This can only happen if we
|
||||
// try applying the operator to a time after the last recorded sample. In
|
||||
// this case, we're finished.
|
||||
g.from = g.through.Add(1)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -228,7 +231,10 @@ func (g *getValuesAlongRangeOp) ExtractSamples(in []model.SamplePair) (out []mod
|
|||
}
|
||||
|
||||
lastSampleTime := in[lastIdx-1].Timestamp
|
||||
g.from = lastSampleTime.Add(time.Duration(1))
|
||||
// Sample times are stored with a maximum time resolution of one second, so
|
||||
// we have to add exactly that to target the next chunk on the next op
|
||||
// iteration.
|
||||
g.from = lastSampleTime.Add(time.Second)
|
||||
return in[firstIdx:lastIdx]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue