Commit 1778e9f0 by Kyle Brandt Committed by GitHub

Alerting: remove LongToWide call in alerting (#27140)

causing issues and currently as we use it, the query
should be requesting it as part of the query model via fromat as time series
fixes #27132
parent 4a626801
......@@ -54,15 +54,6 @@ func FrameToSeriesSlice(frame *data.Frame) (TimeSeriesSlice, error) {
}
return nil, fmt.Errorf("input frame is not recognized as a time series")
}
// If Long, make wide
if tsSchema.Type == data.TimeSeriesTypeLong {
var err error
frame, err = data.LongToWide(frame, nil)
if err != nil {
return nil, errutil.Wrap("failed to convert long to wide series when converting from dataframe", err)
}
tsSchema = frame.TimeSeriesSchema()
}
seriesCount := len(tsSchema.ValueIndices)
seriesSlice := make(TimeSeriesSlice, 0, seriesCount)
......
......@@ -57,71 +57,22 @@ func TestFrameToSeriesSlice(t *testing.T) {
Err: require.NoError,
},
{
name: "a long series",
name: "empty wide series",
frame: data.NewFrame("",
data.NewField("Time", nil, []time.Time{
time.Date(2020, 1, 2, 3, 4, 0, 0, time.UTC),
time.Date(2020, 1, 2, 3, 4, 0, 0, time.UTC),
time.Date(2020, 1, 2, 3, 4, 30, 0, time.UTC),
time.Date(2020, 1, 2, 3, 4, 30, 0, time.UTC),
}),
data.NewField("Values Floats", nil, []float64{
1.0,
2.0,
3.0,
4.0,
}),
data.NewField("Values Int64", nil, []int64{
1,
2,
3,
4,
}),
data.NewField("Animal Factor", nil, []string{
"cat",
"sloth",
"cat",
"sloth",
}),
data.NewField("Location", nil, []string{
"Florida",
"Central & South America",
"Florida",
"Central & South America",
})),
data.NewField("Time", nil, []time.Time{}),
data.NewField(`Values Int64s`, data.Labels{"Animal Factor": "cat"}, []*int64{}),
data.NewField(`Values Floats`, data.Labels{"Animal Factor": "sloth"}, []float64{})),
seriesSlice: TimeSeriesSlice{
&TimeSeries{
Name: "Values Floats",
Tags: map[string]string{"Animal Factor": "cat", "Location": "Florida"},
Points: TimeSeriesPoints{
TimePoint{null.FloatFrom(1), null.FloatFrom(1577934240000)},
TimePoint{null.FloatFrom(3), null.FloatFrom(1577934270000)},
},
Name: "Values Int64s",
Tags: map[string]string{"Animal Factor": "cat"},
Points: TimeSeriesPoints{},
},
&TimeSeries{
Name: "Values Floats",
Tags: map[string]string{"Animal Factor": "sloth", "Location": "Central & South America"},
Points: TimeSeriesPoints{
TimePoint{null.FloatFrom(2), null.FloatFrom(1577934240000)},
TimePoint{null.FloatFrom(4), null.FloatFrom(1577934270000)},
},
},
&TimeSeries{
Name: "Values Int64",
Tags: map[string]string{"Animal Factor": "cat", "Location": "Florida"},
Points: TimeSeriesPoints{
TimePoint{null.FloatFrom(1), null.FloatFrom(1577934240000)},
TimePoint{null.FloatFrom(3), null.FloatFrom(1577934270000)},
},
},
&TimeSeries{
Name: "Values Int64",
Tags: map[string]string{"Animal Factor": "sloth", "Location": "Central & South America"},
Points: TimeSeriesPoints{
TimePoint{null.FloatFrom(2), null.FloatFrom(1577934240000)},
TimePoint{null.FloatFrom(4), null.FloatFrom(1577934270000)},
},
Tags: map[string]string{"Animal Factor": "sloth"},
Points: TimeSeriesPoints{},
},
},
Err: require.NoError,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment