mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-28 04:02:21 -04:00
promql: guard against nil function call in eval
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This commit is contained in:
parent
3e6f1cad54
commit
fbf32e349d
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