Cloudwatch: Fix issue with field calculation transform not working properly with Cloudwatch data (#28761)

* Cloudwatch: Fix issue with reducer transform not working properly with Cloudwatch data

* Updated go sdk and updated code

* CloudWatch: Improve test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Torkel Ödegaard
2020-11-03 11:24:26 +01:00
committed by GitHub
co-authored by Arve Knudsen
parent 651ab5677c
commit fa567de9b8
4 changed files with 12 additions and 11 deletions
+6 -8
View File
@@ -105,12 +105,11 @@ func parseMetricResults(results map[string]*cloudwatch.MetricDataResult, labels
}
}
timeField := data.NewField("timestamp", nil, []*time.Time{})
timeField.SetConfig(&data.FieldConfig{DisplayName: "Time"})
timeField := data.NewField(data.TimeSeriesTimeFieldName, nil, []*time.Time{})
valueField := data.NewField(data.TimeSeriesValueFieldName, tags, []*float64{})
frameName := formatAlias(query, query.Stats, tags, label)
valueField := data.NewField("value", tags, []*float64{})
valueField.SetConfig(&data.FieldConfig{DisplayName: frameName})
valueField.SetConfig(&data.FieldConfig{DisplayNameFromDS: frameName})
emptyFrame := data.Frame{
Name: frameName,
@@ -160,12 +159,11 @@ func parseMetricResults(results map[string]*cloudwatch.MetricDataResult, labels
points = append(points, val)
}
timeField := data.NewField("timestamp", nil, timestamps)
timeField.SetConfig(&data.FieldConfig{DisplayName: "Time"})
timeField := data.NewField(data.TimeSeriesTimeFieldName, nil, timestamps)
valueField := data.NewField(data.TimeSeriesValueFieldName, tags, points)
frameName := formatAlias(query, query.Stats, tags, label)
valueField := data.NewField("value", tags, points)
valueField.SetConfig(&data.FieldConfig{DisplayName: frameName})
valueField.SetConfig(&data.FieldConfig{DisplayNameFromDS: frameName})
frame := data.Frame{
Name: frameName,