File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,13 @@ func updateDashboardAlerts(cmd *UpdateDashboardAlertsCommand) error {
25
25
26
26
extractor := NewDashAlertExtractor (cmd .Dashboard , cmd .OrgId )
27
27
28
- alerts , err := extractor .GetRuleModels ()
29
- if err != nil {
28
+ if alerts , err := extractor .GetAlerts (); err != nil {
30
29
return err
30
+ } else {
31
+ saveAlerts .Alerts = alerts
31
32
}
32
33
33
- saveAlerts .Alerts = alerts
34
- if bus .Dispatch (& saveAlerts ); err != nil {
34
+ if err := bus .Dispatch (& saveAlerts ); err != nil {
35
35
return err
36
36
}
37
37
Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ func (e *DashAlertExtractor) lookupDatasourceId(dsName string) (int64, error) {
47
47
return 0 , errors .New ("Could not find datasource id for " + dsName )
48
48
}
49
49
50
- func (e * DashAlertExtractor ) GetRuleModels () ([]* m.Alert , error ) {
50
+ func (e * DashAlertExtractor ) GetAlerts () ([]* m.Alert , error ) {
51
+ e .log .Debug ("GetAlerts" )
51
52
52
53
alerts := make ([]* m.Alert , 0 )
53
54
@@ -116,5 +117,6 @@ func (e *DashAlertExtractor) GetRuleModels() ([]*m.Alert, error) {
116
117
}
117
118
}
118
119
120
+ e .log .Debug ("Extracted alerts from dashboard" , "alertCount" , len (alerts ))
119
121
return alerts , nil
120
122
}
You can’t perform that action at this time.
0 commit comments