mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): add datasource name field
This commit is contained in:
@@ -68,6 +68,7 @@ func alertIsDifferent(rule1, rule2 m.AlertRule) bool {
|
||||
result = result || rule1.Title != rule2.Title
|
||||
result = result || rule1.Description != rule2.Description
|
||||
result = result || rule1.QueryRange != rule2.QueryRange
|
||||
result = result || rule1.DatasourceName != rule2.DatasourceName
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -16,18 +16,19 @@ func TestAlertingDataAccess(t *testing.T) {
|
||||
|
||||
items := []m.AlertRule{
|
||||
{
|
||||
PanelId: 1,
|
||||
DashboardId: testDash.Id,
|
||||
OrgId: testDash.OrgId,
|
||||
Query: "Query",
|
||||
QueryRefId: "A",
|
||||
WarnLevel: "> 30",
|
||||
CritLevel: "> 50",
|
||||
Interval: "10",
|
||||
Title: "Alerting title",
|
||||
Description: "Alerting description",
|
||||
QueryRange: "5m",
|
||||
Aggregator: "avg",
|
||||
PanelId: 1,
|
||||
DashboardId: testDash.Id,
|
||||
OrgId: testDash.OrgId,
|
||||
Query: "Query",
|
||||
QueryRefId: "A",
|
||||
WarnLevel: "> 30",
|
||||
CritLevel: "> 50",
|
||||
Interval: "10",
|
||||
Title: "Alerting title",
|
||||
Description: "Alerting description",
|
||||
QueryRange: "5m",
|
||||
Aggregator: "avg",
|
||||
DatasourceName: "graphite",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -62,6 +63,7 @@ func TestAlertingDataAccess(t *testing.T) {
|
||||
So(alert.Description, ShouldEqual, "Alerting description")
|
||||
So(alert.QueryRange, ShouldEqual, "5m")
|
||||
So(alert.Aggregator, ShouldEqual, "avg")
|
||||
So(alert.DatasourceName, ShouldEqual, "graphite")
|
||||
})
|
||||
|
||||
Convey("Alerts with same dashboard id and panel id should update", func() {
|
||||
|
||||
@@ -19,6 +19,7 @@ func addAlertMigrations(mg *Migrator) {
|
||||
{Name: "description", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "query_range", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "aggregator", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "datasource_name", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user