From 158ce061675d51c287ddc07a7ed8cd77c51b7b97 Mon Sep 17 00:00:00 2001 From: bergquist Date: Wed, 17 Aug 2016 11:00:09 +0200 Subject: [PATCH 1/3] fix(alerting): cleanup alerting example dashboard --- examples/alerting-dashboard.json | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/examples/alerting-dashboard.json b/examples/alerting-dashboard.json index ea30f6d6875..e6e729ecc06 100644 --- a/examples/alerting-dashboard.json +++ b/examples/alerting-dashboard.json @@ -74,7 +74,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -185,7 +184,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -296,7 +294,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -407,7 +404,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -526,7 +522,6 @@ "notifications": [], "severity": "warning" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -636,7 +631,6 @@ "notifications": [], "severity": "warning" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -746,7 +740,6 @@ "notifications": [], "severity": "warning" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -856,7 +849,6 @@ "notifications": [], "severity": "warning" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -974,7 +966,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1084,7 +1075,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1194,7 +1184,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1304,7 +1293,6 @@ "notifications": [], "severity": "critical" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1422,7 +1410,6 @@ "notifications": [], "name": "Fast Warning panel alert" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1532,7 +1519,6 @@ "notifications": [], "name": "Fast Warning panel alert" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1642,7 +1628,6 @@ "notifications": [], "name": "Fast Warning panel alert" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1752,7 +1737,6 @@ "notifications": [], "name": "Fast Warning panel alert" }, - "alerting": {}, "aliasColors": {}, "bars": false, "datasource": "${DS_GRAPHITE}", @@ -1936,7 +1920,6 @@ "timeShift": null, "aliasColors": {}, "seriesOverrides": [], - "alerting": {}, "thresholds": [ { "value": 20, @@ -2047,7 +2030,6 @@ "timeShift": null, "aliasColors": {}, "seriesOverrides": [], - "alerting": {}, "thresholds": [ { "value": 10, @@ -2167,7 +2149,6 @@ "timeShift": null, "aliasColors": {}, "seriesOverrides": [], - "alerting": {}, "thresholds": [ { "value": 60, From 4154a4066f5e3f2cc218b6f05849ab8b7436852a Mon Sep 17 00:00:00 2001 From: bergquist Date: Wed, 17 Aug 2016 22:12:08 +0200 Subject: [PATCH 2/3] feat(alerting): handle all results, even due they have errors DON'T SWALLOW THE ERR CARL --- pkg/services/alerting/engine.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/services/alerting/engine.go b/pkg/services/alerting/engine.go index e3813b8e912..7abfe32425c 100644 --- a/pkg/services/alerting/engine.go +++ b/pkg/services/alerting/engine.go @@ -101,11 +101,6 @@ func (e *Engine) resultDispatcher() { for result := range e.resultQueue { e.log.Debug("Alert Rule Result", "ruleId", result.Rule.Id, "firing", result.Firing) - - if result.Error != nil { - e.log.Error("Alert Rule Result Error", "ruleId", result.Rule.Id, "error", result.Error, "retry") - } else { - e.resultHandler.Handle(result) - } + e.resultHandler.Handle(result) } } From 6d080904fac49a7ff48750484220df98c20fd415 Mon Sep 17 00:00:00 2001 From: bergquist Date: Wed, 17 Aug 2016 22:13:27 +0200 Subject: [PATCH 3/3] tech(alerting): empty string does not update database --- pkg/services/alerting/result_handler.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/services/alerting/result_handler.go b/pkg/services/alerting/result_handler.go index af9bb7f8e7b..c6dfdfeb2a3 100644 --- a/pkg/services/alerting/result_handler.go +++ b/pkg/services/alerting/result_handler.go @@ -29,7 +29,7 @@ func NewResultHandler() *DefaultResultHandler { func (handler *DefaultResultHandler) Handle(ctx *EvalContext) { oldState := ctx.Rule.State - exeuctionError := "" + exeuctionError := " " if ctx.Error != nil { handler.log.Error("Alert Rule Result Error", "ruleId", ctx.Rule.Id, "error", ctx.Error) ctx.Rule.State = m.AlertStateExeuctionError @@ -41,7 +41,6 @@ func (handler *DefaultResultHandler) Handle(ctx *EvalContext) { } countSeverity(ctx.Rule.Severity) - if ctx.Rule.State != oldState { handler.log.Info("New state change", "alertId", ctx.Rule.Id, "newState", ctx.Rule.State, "oldState", oldState)