From d5eb7cc42affaf57e4752c8ae83ee1506bf04b98 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 13 Jun 2022 12:06:47 -0400 Subject: [PATCH] Alerting: remove unused function in alert rule store (#50696) (#50705) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit ed6a8877371211e9466fa780e940b485ac9a64d2) Co-authored-by: Jean-Philippe Quéméner --- pkg/services/ngalert/provisioning/persist.go | 1 - pkg/services/ngalert/store/alert_rule.go | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/pkg/services/ngalert/provisioning/persist.go b/pkg/services/ngalert/provisioning/persist.go index c50204fa504..da940e39989 100644 --- a/pkg/services/ngalert/provisioning/persist.go +++ b/pkg/services/ngalert/provisioning/persist.go @@ -34,7 +34,6 @@ type RuleStore interface { ListAlertRules(ctx context.Context, query *models.ListAlertRulesQuery) error GetRuleGroupInterval(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string) (int64, error) InsertAlertRules(ctx context.Context, rule []models.AlertRule) (map[string]int64, error) - UpdateRuleGroup(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string, interval int64) error UpdateAlertRules(ctx context.Context, rule []store.UpdateRule) error DeleteAlertRulesByUID(ctx context.Context, orgID int64, ruleUID ...string) error } diff --git a/pkg/services/ngalert/store/alert_rule.go b/pkg/services/ngalert/store/alert_rule.go index 74d89d33be8..f7153acd7e4 100644 --- a/pkg/services/ngalert/store/alert_rule.go +++ b/pkg/services/ngalert/store/alert_rule.go @@ -46,8 +46,6 @@ type RuleStore interface { // GetRuleGroups returns the unique rule groups across all organizations. GetRuleGroups(ctx context.Context, query *ngmodels.ListRuleGroupsQuery) error GetRuleGroupInterval(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string) (int64, error) - // UpdateRuleGroup will update the interval for all rules in the group. - UpdateRuleGroup(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string, interval int64) error GetUserVisibleNamespaces(context.Context, int64, *models.SignedInUser) (map[string]*models.Folder, error) GetNamespaceByTitle(context.Context, string, int64, *models.SignedInUser, bool) (*models.Folder, error) // InsertAlertRules will insert all alert rules passed into the function @@ -302,16 +300,6 @@ func (st DBstore) GetRuleGroupInterval(ctx context.Context, orgID int64, namespa }) } -func (st DBstore) UpdateRuleGroup(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string, interval int64) error { - return st.SQLStore.WithDbSession(ctx, func(sess *sqlstore.DBSession) error { - _, err := sess.Update( - ngmodels.AlertRule{IntervalSeconds: interval}, - ngmodels.AlertRule{OrgID: orgID, RuleGroup: ruleGroup, NamespaceUID: namespaceUID}, - ) - return err - }) -} - // GetNamespaces returns the folders that are visible to the user and have at least one alert in it func (st DBstore) GetUserVisibleNamespaces(ctx context.Context, orgID int64, user *models.SignedInUser) (map[string]*models.Folder, error) { namespaceMap := make(map[string]*models.Folder)