Skip to content

Commit

Permalink
Alerting: Fix mathexp.NoData cannot be reduced
Browse files Browse the repository at this point in the history
This commit fixes a bug where queries from datasources such as
InfluxDB that returned no data would not create a DatasourceNoData
alert, but instead an error "can only reduce type series, got type
noData".
  • Loading branch information
grobinson-grafana committed Sep 18, 2022
1 parent 1a0cbde commit 6b6c0f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/expr/commands.go
Expand Up @@ -171,6 +171,8 @@ func (gr *ReduceCommand) Execute(_ context.Context, vars mathexp.Vars) (mathexp.
Text: fmt.Sprintf("Reduce operation is not needed. Input query or expression %s is already reduced data.", gr.VarToReduce),
})
newRes.Values = append(newRes.Values, copyV)
case mathexp.NoData:
// NoData cannot be reduced so we just return newRes
default:
return newRes, fmt.Errorf("can only reduce type series, got type %v", val.Type())
}
Expand Down

0 comments on commit 6b6c0f9

Please sign in to comment.