feat(alerting): requests looks to be working again
This commit is contained in:
@@ -31,7 +31,7 @@ func TestAlertRuleChangesDataAccess(t *testing.T) {
|
||||
WarnOperator: ">",
|
||||
CritOperator: ">",
|
||||
Frequency: 10,
|
||||
Title: "Alerting title",
|
||||
Name: "Alerting title",
|
||||
Description: "Alerting description",
|
||||
QueryRange: 3600,
|
||||
Aggregator: "avg",
|
||||
|
||||
@@ -26,7 +26,7 @@ func TestAlertingDataAccess(t *testing.T) {
|
||||
WarnOperator: ">",
|
||||
CritOperator: ">",
|
||||
Frequency: 10,
|
||||
Title: "Alerting title",
|
||||
Name: "Alerting title",
|
||||
Description: "Alerting description",
|
||||
QueryRange: 3600,
|
||||
Aggregator: "avg",
|
||||
@@ -65,7 +65,7 @@ func TestAlertingDataAccess(t *testing.T) {
|
||||
So(alert.CritOperator, ShouldEqual, ">")
|
||||
So(alert.Query, ShouldEqual, "Query")
|
||||
So(alert.QueryRefId, ShouldEqual, "A")
|
||||
So(alert.Title, ShouldEqual, "Alerting title")
|
||||
So(alert.Name, ShouldEqual, "Alerting title")
|
||||
So(alert.Description, ShouldEqual, "Alerting description")
|
||||
So(alert.QueryRange, ShouldEqual, 3600)
|
||||
So(alert.Aggregator, ShouldEqual, "avg")
|
||||
@@ -189,7 +189,7 @@ func TestAlertingDataAccess(t *testing.T) {
|
||||
WarnOperator: ">",
|
||||
CritOperator: ">",
|
||||
Frequency: 10,
|
||||
Title: "Alerting title",
|
||||
Name: "Alerting title",
|
||||
Description: "Alerting description",
|
||||
QueryRange: 3600,
|
||||
Aggregator: "avg",
|
||||
|
||||
@@ -25,7 +25,7 @@ func TestAlertingStateAccess(t *testing.T) {
|
||||
WarnOperator: ">",
|
||||
CritOperator: ">",
|
||||
Frequency: 10,
|
||||
Title: "Alerting title",
|
||||
Name: "Alerting title",
|
||||
Description: "Alerting description",
|
||||
QueryRange: 3600,
|
||||
Aggregator: "avg",
|
||||
|
||||
@@ -110,7 +110,7 @@ func TestAlertModel(t *testing.T) {
|
||||
"aggregator": "sum",
|
||||
"queryRange": "10m",
|
||||
"frequency": 10,
|
||||
"title": "active desktop users",
|
||||
"name": "active desktop users",
|
||||
"description": "restart webservers"
|
||||
},
|
||||
"links": []
|
||||
@@ -386,7 +386,7 @@ func TestAlertModel(t *testing.T) {
|
||||
So(v.Query, ShouldNotBeEmpty)
|
||||
So(v.QueryRefId, ShouldNotBeEmpty)
|
||||
So(v.QueryRange, ShouldNotBeEmpty)
|
||||
So(v.Title, ShouldNotBeEmpty)
|
||||
So(v.Name, ShouldNotBeEmpty)
|
||||
So(v.Description, ShouldNotBeEmpty)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,22 +19,26 @@ func init() {
|
||||
}
|
||||
|
||||
func GetDataSourceById(query *m.GetDataSourceByIdQuery) error {
|
||||
sess := x.Limit(100, 0).Where("org_id=? AND id=?", query.OrgId, query.Id)
|
||||
has, err := sess.Get(&query.Result)
|
||||
datasource := m.DataSource{OrgId: query.OrgId, Id: query.Id}
|
||||
has, err := x.Get(&datasource)
|
||||
|
||||
if !has {
|
||||
return m.ErrDataSourceNotFound
|
||||
}
|
||||
|
||||
query.Result = &datasource
|
||||
return err
|
||||
}
|
||||
|
||||
func GetDataSourceByName(query *m.GetDataSourceByNameQuery) error {
|
||||
sess := x.Limit(100, 0).Where("org_id=? AND name=?", query.OrgId, query.Name)
|
||||
has, err := sess.Get(&query.Result)
|
||||
datasource := m.DataSource{OrgId: query.OrgId, Name: query.Name}
|
||||
has, err := x.Get(&datasource)
|
||||
|
||||
if !has {
|
||||
return m.ErrDataSourceNotFound
|
||||
}
|
||||
|
||||
query.Result = &datasource
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ func addAlertMigrations(mg *Migrator) {
|
||||
{Name: "crit_level", Type: DB_Float, Nullable: false},
|
||||
{Name: "crit_operator", Type: DB_NVarchar, Length: 10, Nullable: false},
|
||||
{Name: "frequency", Type: DB_BigInt, Nullable: false},
|
||||
{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "description", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
{Name: "query_range", Type: DB_Int, Nullable: false},
|
||||
{Name: "aggregator", Type: DB_NVarchar, Length: 255, Nullable: false},
|
||||
@@ -32,7 +32,7 @@ func addAlertMigrations(mg *Migrator) {
|
||||
}
|
||||
|
||||
// create table
|
||||
mg.AddMigration("create alert_rule table v1", NewAddTableMigration(alertV1))
|
||||
mg.AddMigration("create alert_rule table v2", NewAddTableMigration(alertV1))
|
||||
|
||||
alert_changes := Table{
|
||||
Name: "alert_rule_change",
|
||||
|
||||
Reference in New Issue
Block a user