Skip to content

Commit

Permalink
Merge pull request #492 from bookingcom/emadolsky/fix-fallback-series…
Browse files Browse the repository at this point in the history
…-func-panic

Fix panic on number of args in fallbackSeries func
  • Loading branch information
emadolsky authored May 31, 2023
2 parents b48f416 + 5808767 commit c15bce2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/expr/functions/fallbackSeries/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func (f *fallbackSeries) Do(ctx context.Context, e parser.Expr, from, until int3
Takes a wildcard seriesList, and a second fallback metric.
If the wildcard does not match any series, draws the fallback metric.
*/
if len(e.Args()) < 2 {
return nil, parser.ErrMissingArgument
}

seriesList, err := helper.GetSeriesArg(ctx, e.Args()[0], from, until, values, getTargetData)
fallback, errFallback := helper.GetSeriesArg(ctx, e.Args()[1], from, until, values, getTargetData)
if errFallback != nil && err != nil {
Expand Down

0 comments on commit c15bce2

Please sign in to comment.