mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-28 04:02:21 -04:00
Merge pull request #16352 from NeerajGartia21/promql/subquery_patch
[BUG] PromQL: Return early when `endtime` < `startime`
This commit is contained in:
commit
ba8609fbd0
2 changed files with 12 additions and 0 deletions
|
|
@ -1582,6 +1582,11 @@ func (ev *evaluator) eval(ctx context.Context, expr parser.Expr) (parser.Value,
|
|||
if err := contextDone(ctx, "expression evaluation"); err != nil {
|
||||
ev.error(err)
|
||||
}
|
||||
|
||||
if ev.endTimestamp < ev.startTimestamp {
|
||||
return Matrix{}, nil
|
||||
}
|
||||
|
||||
numSteps := int((ev.endTimestamp-ev.startTimestamp)/ev.interval) + 1
|
||||
|
||||
// Create a new span to help investigate inner evaluation performances.
|
||||
|
|
|
|||
7
promql/promqltest/testdata/subquery.test
vendored
7
promql/promqltest/testdata/subquery.test
vendored
|
|
@ -150,3 +150,10 @@ eval instant at 10m increase(native_histogram[10m:3m])
|
|||
# by the sub-query multiple times.
|
||||
eval instant at 10m increase(native_histogram[10m:15s])
|
||||
{} {{count:30.769230769230766 sum:30.769230769230766}}
|
||||
|
||||
# When range < resolution and the first evaluation time is out of range.
|
||||
load 5m
|
||||
foo 3+0x10
|
||||
|
||||
eval instant at 12m min_over_time((topk(1, foo))[1m:5m])
|
||||
#empty
|
||||
|
|
|
|||
Loading…
Reference in a new issue