mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-11 09:30:13 -04:00
Merge pull request #18722 from roidelapluie/roidelapluie/guard-nil-funcall
promql: guard against nil function call in eval
This commit is contained in:
commit
e3055ac41e
1 changed files with 5 additions and 0 deletions
|
|
@ -2063,6 +2063,11 @@ func (ev *evaluator) eval(ctx context.Context, expr parser.Expr) (parser.Value,
|
|||
return ev.evalInfo(ctx, e.Args)
|
||||
}
|
||||
|
||||
// Functions with nil entries in FunctionCalls should have been handled before reaching this point.
|
||||
if call == nil {
|
||||
panic(fmt.Errorf("unexpected nil implementation for function %q", e.Func.Name))
|
||||
}
|
||||
|
||||
// Emit a warning when sort is used for range queries.
|
||||
if (e.Func.Name == "sort" || e.Func.Name == "sort_desc" || e.Func.Name == "sort_by_label" || e.Func.Name == "sort_by_label_desc") && ev.startTimestamp != ev.endTimestamp {
|
||||
warnings.Add(annotations.NewSortInRangeQueryWarning(e.PositionRange()))
|
||||
|
|
|
|||
Loading…
Reference in a new issue