Alerting: Do not retry rule evaluations with "input data must be a wide series but got type long" style errors (#87343)

add typed error for series must be wide, do not retry
This commit is contained in:
Alexander Weaver
2024-05-07 11:31:07 -05:00
committed by GitHub
parent 5fb87de321
commit 6c47968f6c
4 changed files with 19 additions and 4 deletions
+2 -2
View File
@@ -79,7 +79,7 @@ func (c *ResultConverter) Convert(ctx context.Context,
}
if schema.Type != data.TimeSeriesTypeWide && !allowLongFrames {
return "", mathexp.Results{}, fmt.Errorf("input data must be a wide series but got type %s (input refid)", schema.Type)
return "", mathexp.Results{}, fmt.Errorf("%w but got type %s (input refid)", ErrSeriesMustBeWide, schema.Type)
}
filtered = append(filtered, frame)
totalLen += len(schema.ValueIndices)
@@ -249,7 +249,7 @@ func extractNumberSet(frame *data.Frame) ([]mathexp.Number, error) {
func WideToMany(frame *data.Frame, fixSeries func(series mathexp.Series, valueField *data.Field)) ([]mathexp.Series, error) {
tsSchema := frame.TimeSeriesSchema()
if tsSchema.Type != data.TimeSeriesTypeWide {
return nil, fmt.Errorf("input data must be a wide series but got type %s", tsSchema.Type)
return nil, fmt.Errorf("%w but got type %s", ErrSeriesMustBeWide, tsSchema.Type)
}
if len(tsSchema.ValueIndices) == 1 {
+2
View File
@@ -7,6 +7,8 @@ import (
"github.com/grafana/grafana/pkg/util/errutil"
)
var ErrSeriesMustBeWide = errors.New("input data must be a wide series")
var ConversionError = errutil.BadRequest("sse.readDataError").MustTemplate(
"[{{ .Public.refId }}] got error: {{ .Error }}",
errutil.WithPublic(