tech(alerting): change interval -> frequency

This commit is contained in:
bergquist
2016-05-30 09:31:05 +02:00
parent 16a9e56eca
commit 077be210da
10 changed files with 9 additions and 12 deletions

View File

@@ -68,7 +68,7 @@ func GetAlerts(c *middleware.Context) Response {
QueryRefId: alert.QueryRefId,
WarnLevel: alert.WarnLevel,
CritLevel: alert.CritLevel,
Interval: alert.Interval,
Frequency: alert.Frequency,
Title: alert.Title,
Description: alert.Description,
QueryRange: alert.QueryRange,

View File

@@ -10,7 +10,7 @@ type AlertRuleDTO struct {
CritLevel int64 `json:"critLevel"`
WarnOperator string `json:"warnOperator"`
CritOperator string `json:"critOperator"`
Interval string `json:"interval"`
Frequency int64 `json:"frequency"`
Title string `json:"title"`
Description string `json:"description"`
QueryRange int `json:"queryRange"`

View File

@@ -16,7 +16,6 @@ type AlertRule struct {
CritLevel int64 `json:"critLevel"`
WarnOperator string `json:"warnOperator"`
CritOperator string `json:"critOperator"`
Interval string `json:"interval"`
Frequency int64 `json:"frequency"`
Title string `json:"title"`
Description string `json:"description"`

View File

@@ -21,7 +21,6 @@ func (this AlertRuleReader) Fetch() []m.AlertRule {
Id: 1,
OrgId: 1,
Title: "alert rule 1",
Interval: "10s",
Frequency: 3,
DatasourceId: 1,
WarnOperator: "<",

View File

@@ -26,7 +26,7 @@ func ParseAlertsFromDashboard(cmd *m.SaveDashboardCommand) []m.AlertRule {
CritLevel: alerting.Get("critLevel").MustInt64(),
WarnOperator: alerting.Get("warnOperator").MustString(),
CritOperator: alerting.Get("critOperator").MustString(),
Interval: alerting.Get("interval").MustString(),
Frequency: alerting.Get("interval").MustInt64(),
Title: alerting.Get("title").MustString(),
Description: alerting.Get("description").MustString(),
QueryRange: alerting.Get("queryRange").MustInt(),

View File

@@ -112,7 +112,7 @@ func alertIsDifferent(rule1, rule2 m.AlertRule) bool {
result = result || rule1.CritOperator != rule2.CritOperator
result = result || rule1.Query != rule2.Query
result = result || rule1.QueryRefId != rule2.QueryRefId
result = result || rule1.Interval != rule2.Interval
result = result || rule1.Frequency != rule2.Frequency
result = result || rule1.Title != rule2.Title
result = result || rule1.Description != rule2.Description
result = result || rule1.QueryRange != rule2.QueryRange

View File

@@ -30,7 +30,7 @@ func TestAlertRuleChangesDataAccess(t *testing.T) {
CritLevel: 50,
WarnOperator: ">",
CritOperator: ">",
Interval: "10",
Frequency: 10,
Title: "Alerting title",
Description: "Alerting description",
QueryRange: 3600,

View File

@@ -25,7 +25,7 @@ func TestAlertingDataAccess(t *testing.T) {
CritLevel: 50,
WarnOperator: ">",
CritOperator: ">",
Interval: "10",
Frequency: 10,
Title: "Alerting title",
Description: "Alerting description",
QueryRange: 3600,
@@ -58,7 +58,7 @@ func TestAlertingDataAccess(t *testing.T) {
alert := alertQuery.Result[0]
So(err2, ShouldBeNil)
So(alert.Interval, ShouldEqual, "10")
So(alert.Frequency, ShouldEqual, 10)
So(alert.WarnLevel, ShouldEqual, 30)
So(alert.CritLevel, ShouldEqual, 50)
So(alert.WarnOperator, ShouldEqual, ">")
@@ -188,7 +188,7 @@ func TestAlertingDataAccess(t *testing.T) {
CritLevel: 50,
WarnOperator: ">",
CritOperator: ">",
Interval: "10",
Frequency: 10,
Title: "Alerting title",
Description: "Alerting description",
QueryRange: 3600,

View File

@@ -24,7 +24,7 @@ func TestAlertingStateAccess(t *testing.T) {
CritLevel: 50,
WarnOperator: ">",
CritOperator: ">",
Interval: "10",
Frequency: 10,
Title: "Alerting title",
Description: "Alerting description",
QueryRange: 3600,

View File

@@ -20,7 +20,6 @@ func addAlertMigrations(mg *Migrator) {
{Name: "warn_operator", Type: DB_NVarchar, Length: 10, Nullable: false},
{Name: "crit_level", Type: DB_BigInt, Nullable: false},
{Name: "crit_operator", Type: DB_NVarchar, Length: 10, Nullable: false},
{Name: "interval", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "frequency", Type: DB_BigInt, Nullable: false},
{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "description", Type: DB_NVarchar, Length: 255, Nullable: false},