CloudWatch: Fix alerting for queries with Id (using GetMetricData) (#17899)
This commit addresses half of #13749 by making sure GetMetricData works for alerting. Math Expressions (compound metrics) will still not work for alerting, this would require a bigger refactoring of Grafana's alerting service. However, with this commit at least alerting for basic metrics with non empty query Id will work. Fixes half of #13749
This commit is contained in:
committed by
Marcus Efraimsson
parent
c82a26e2b2
commit
4e1e220962
@@ -31,7 +31,6 @@ func TestCloudWatchGetMetricData(t *testing.T) {
|
||||
Period: 300,
|
||||
Id: "id1",
|
||||
Expression: "",
|
||||
ReturnData: true,
|
||||
},
|
||||
"id2": {
|
||||
RefId: "B",
|
||||
@@ -39,7 +38,6 @@ func TestCloudWatchGetMetricData(t *testing.T) {
|
||||
Statistics: []*string{aws.String("Average")},
|
||||
Id: "id2",
|
||||
Expression: "id1 * 2",
|
||||
ReturnData: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -58,11 +56,9 @@ func TestCloudWatchGetMetricData(t *testing.T) {
|
||||
So(*v.MetricStat.Period, ShouldEqual, 300)
|
||||
So(*v.MetricStat.Stat, ShouldEqual, "Average")
|
||||
So(*v.Id, ShouldEqual, "id1")
|
||||
So(*v.ReturnData, ShouldEqual, true)
|
||||
} else {
|
||||
So(*v.Id, ShouldEqual, "id2")
|
||||
So(*v.Expression, ShouldEqual, "id1 * 2")
|
||||
So(*v.ReturnData, ShouldEqual, true)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user