mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
add more context cancellation check at evaluation time
Signed-off-by: Ben Ye <benye@amazon.com>
This commit is contained in:
parent
65cf528403
commit
d778591fd3
|
@ -1471,6 +1471,9 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, annotations.Annotatio
|
||||||
it := storage.NewBuffer(selRange)
|
it := storage.NewBuffer(selRange)
|
||||||
var chkIter chunkenc.Iterator
|
var chkIter chunkenc.Iterator
|
||||||
for i, s := range selVS.Series {
|
for i, s := range selVS.Series {
|
||||||
|
if err := contextDone(ev.ctx, "expression evaluation"); err != nil {
|
||||||
|
ev.error(err)
|
||||||
|
}
|
||||||
ev.currentSamples -= len(floats) + totalHPointSize(histograms)
|
ev.currentSamples -= len(floats) + totalHPointSize(histograms)
|
||||||
if floats != nil {
|
if floats != nil {
|
||||||
floats = floats[:0]
|
floats = floats[:0]
|
||||||
|
@ -1690,6 +1693,9 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, annotations.Annotatio
|
||||||
it := storage.NewMemoizedEmptyIterator(durationMilliseconds(ev.lookbackDelta))
|
it := storage.NewMemoizedEmptyIterator(durationMilliseconds(ev.lookbackDelta))
|
||||||
var chkIter chunkenc.Iterator
|
var chkIter chunkenc.Iterator
|
||||||
for i, s := range e.Series {
|
for i, s := range e.Series {
|
||||||
|
if err := contextDone(ev.ctx, "expression evaluation"); err != nil {
|
||||||
|
ev.error(err)
|
||||||
|
}
|
||||||
chkIter = s.Iterator(chkIter)
|
chkIter = s.Iterator(chkIter)
|
||||||
it.Reset(chkIter)
|
it.Reset(chkIter)
|
||||||
ss := Series{
|
ss := Series{
|
||||||
|
|
Loading…
Reference in a new issue