Alerting: scheduler to use short version of model for alert rule (#48916)

* scheduler to use a short version of alert rule model
This commit is contained in:
Yuriy Tseretyan
2022-05-12 09:55:05 -04:00
committed by GitHub
parent c8a0e52a59
commit 369fcc5e9a
4 changed files with 42 additions and 14 deletions
+3 -3
View File
@@ -7,14 +7,14 @@ import (
"github.com/grafana/grafana/pkg/services/ngalert/models"
)
func (sch *schedule) getAlertRules(ctx context.Context, disabledOrgs []int64) []*models.AlertRule {
func (sch *schedule) getAlertRules(ctx context.Context, disabledOrgs []int64) []*models.SchedulableAlertRule {
start := time.Now()
defer func() {
sch.metrics.GetAlertRulesDuration.Observe(time.Since(start).Seconds())
}()
q := models.ListAlertRulesQuery{
ExcludeOrgs: disabledOrgs,
q := models.GetAlertRulesForSchedulingQuery{
ExcludeOrgIDs: disabledOrgs,
}
err := sch.ruleStore.GetAlertRulesForScheduling(ctx, &q)
if err != nil {