chore(alerting): convert alert levels to float

This commit is contained in:
bergquist
2016-05-31 14:18:12 +02:00
parent 338fdcb576
commit 7224ea5229
5 changed files with 38 additions and 38 deletions
+2 -2
View File
@@ -22,8 +22,8 @@ func ParseAlertsFromDashboard(cmd *m.SaveDashboardCommand) []m.AlertRule {
PanelId: panel.Get("id").MustInt64(),
Id: alerting.Get("id").MustInt64(),
QueryRefId: alerting.Get("queryRef").MustString(),
WarnLevel: alerting.Get("warnLevel").MustInt64(),
CritLevel: alerting.Get("critLevel").MustInt64(),
WarnLevel: alerting.Get("warnLevel").MustFloat64(),
CritLevel: alerting.Get("critLevel").MustFloat64(),
WarnOperator: alerting.Get("warnOperator").MustString(),
CritOperator: alerting.Get("critOperator").MustString(),
Frequency: alerting.Get("frequency").MustInt64(),
+2 -2
View File
@@ -57,11 +57,11 @@ func (this *ExecutorImpl) ValidateRule(rule m.AlertRule, series m.TimeSeriesSlic
var aggValue = aggregator[rule.Aggregator](serie)
if operators[rule.CritOperator](aggValue, float64(rule.CritLevel)) {
if operators[rule.CritOperator](aggValue, rule.CritLevel) {
return &m.AlertResult{State: m.AlertStateCritical, Id: rule.Id, ActualValue: aggValue, Rule: rule}
}
if operators[rule.WarnOperator](aggValue, float64(rule.WarnLevel)) {
if operators[rule.WarnOperator](aggValue, rule.WarnLevel) {
return &m.AlertResult{State: m.AlertStateWarn, Id: rule.Id, ActualValue: aggValue, Rule: rule}
}
}
@@ -16,9 +16,9 @@ func addAlertMigrations(mg *Migrator) {
{Name: "org_id", Type: DB_BigInt, Nullable: false},
{Name: "query", Type: DB_Text, Nullable: false},
{Name: "query_ref_id", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "warn_level", Type: DB_BigInt, Nullable: false},
{Name: "warn_level", Type: DB_Float, Nullable: false},
{Name: "warn_operator", Type: DB_NVarchar, Length: 10, Nullable: false},
{Name: "crit_level", Type: DB_BigInt, Nullable: false},
{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},