mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: rule evaluation loop to not access multiorg Alertmanager if no alerts to add (#39872)
This commit is contained in:
parent
29f3e175b6
commit
526961f298
@ -478,6 +478,11 @@ func (sch *schedule) ruleRoutine(grafanaCtx context.Context, key models.AlertRul
|
|||||||
sch.saveAlertStates(processedStates)
|
sch.saveAlertStates(processedStates)
|
||||||
alerts := FromAlertStateToPostableAlerts(processedStates, sch.stateManager, sch.appURL)
|
alerts := FromAlertStateToPostableAlerts(processedStates, sch.stateManager, sch.appURL)
|
||||||
|
|
||||||
|
if len(alerts.PostableAlerts) == 0 {
|
||||||
|
sch.log.Debug("no alerts to put in the notifier", "org", alertRule.OrgID)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
sch.log.Debug("sending alerts to notifier", "count", len(alerts.PostableAlerts), "alerts", alerts.PostableAlerts, "org", alertRule.OrgID)
|
sch.log.Debug("sending alerts to notifier", "count", len(alerts.PostableAlerts), "alerts", alerts.PostableAlerts, "org", alertRule.OrgID)
|
||||||
n, err := sch.multiOrgNotifier.AlertmanagerFor(alertRule.OrgID)
|
n, err := sch.multiOrgNotifier.AlertmanagerFor(alertRule.OrgID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user