Commit 66c25942 by Torkel Ödegaard

feat(alerting): sql update fixes

parent 71c1c0ab
...@@ -21,6 +21,7 @@ func updateDashboardAlerts(cmd *UpdateDashboardAlertsCommand) error { ...@@ -21,6 +21,7 @@ func updateDashboardAlerts(cmd *UpdateDashboardAlertsCommand) error {
saveAlerts := m.SaveAlertsCommand{ saveAlerts := m.SaveAlertsCommand{
OrgId: cmd.OrgId, OrgId: cmd.OrgId,
UserId: cmd.UserId, UserId: cmd.UserId,
DashboardId: cmd.Dashboard.Id,
} }
extractor := NewDashAlertExtractor(cmd.Dashboard, cmd.OrgId) extractor := NewDashAlertExtractor(cmd.Dashboard, cmd.OrgId)
......
...@@ -69,7 +69,7 @@ func (e *ExecutorImpl) executeQuery(job *AlertJob) (tsdb.TimeSeriesSlice, error) ...@@ -69,7 +69,7 @@ func (e *ExecutorImpl) executeQuery(job *AlertJob) (tsdb.TimeSeriesSlice, error)
} }
func (e *ExecutorImpl) GetRequestForAlertRule(rule *AlertRule, datasource *m.DataSource) *tsdb.Request { func (e *ExecutorImpl) GetRequestForAlertRule(rule *AlertRule, datasource *m.DataSource) *tsdb.Request {
log.Debug2("GetRequest", "query", rule.Query.Query, "from", rule.Query.From, "datasourceId", datasource.Id) e.log.Debug("GetRequest", "query", rule.Query.Query, "from", rule.Query.From, "datasourceId", datasource.Id)
req := &tsdb.Request{ req := &tsdb.Request{
TimeRange: tsdb.TimeRange{ TimeRange: tsdb.TimeRange{
From: "-" + rule.Query.From, From: "-" + rule.Query.From,
......
...@@ -184,6 +184,7 @@ func upsertAlerts(alerts []*m.Alert, posted []*m.Alert, sess *xorm.Session) erro ...@@ -184,6 +184,7 @@ func upsertAlerts(alerts []*m.Alert, posted []*m.Alert, sess *xorm.Session) erro
update = true update = true
alert.Id = k.Id alert.Id = k.Id
alertToUpdate = k alertToUpdate = k
break
} }
} }
...@@ -224,6 +225,7 @@ func deleteMissingAlerts(alerts []*m.Alert, posted []*m.Alert, sess *xorm.Sessio ...@@ -224,6 +225,7 @@ func deleteMissingAlerts(alerts []*m.Alert, posted []*m.Alert, sess *xorm.Sessio
for _, k := range posted { for _, k := range posted {
if missingAlert.PanelId == k.PanelId { if missingAlert.PanelId == k.PanelId {
missing = false missing = false
break
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment