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
+9 -2
View File
@@ -153,7 +153,7 @@ func (f *FakeRuleStore) GetAlertRuleByUID(_ context.Context, q *models.GetAlertR
}
// For now, we're not implementing namespace filtering.
func (f *FakeRuleStore) GetAlertRulesForScheduling(_ context.Context, q *models.ListAlertRulesQuery) error {
func (f *FakeRuleStore) GetAlertRulesForScheduling(_ context.Context, q *models.GetAlertRulesForSchedulingQuery) error {
f.mtx.Lock()
defer f.mtx.Unlock()
f.RecordedOps = append(f.RecordedOps, *q)
@@ -161,7 +161,14 @@ func (f *FakeRuleStore) GetAlertRulesForScheduling(_ context.Context, q *models.
return err
}
for _, rules := range f.Rules {
q.Result = append(q.Result, rules...)
for _, rule := range rules {
q.Result = append(q.Result, &models.SchedulableAlertRule{
UID: rule.UID,
OrgID: rule.OrgID,
IntervalSeconds: rule.IntervalSeconds,
Version: rule.Version,
})
}
}
return nil
}