fix(folders): use namespace_uid for alert count (#111773)

This commit is contained in:
Jean-Philippe Quéméner
2025-09-29 16:12:34 -05:00
committed by GitHub
parent 37b5b1a03d
commit d0e3e91b03
3 changed files with 93 additions and 3 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ func (s *LegacyStatsGetter) GetStats(ctx context.Context, in *resourcepb.Resourc
group := "sql-fallback"
// Legacy alert rule table
err = fn("alert_rule", "org_id=? AND dashboard_uid=?", group, "alertrules", false)
err = fn("alert_rule", "org_id=? AND namespace_uid=?", group, "alertrules", false)
if err != nil {
return err
}
+3 -2
View File
@@ -78,9 +78,10 @@ func TestIntegrationDirectSQLStats(t *testing.T) {
require.NoError(t, err)
ruleStore := ngalertstore.SetupStoreForTesting(t, db)
dashboardUID := "test"
_, err = ruleStore.InsertAlertRules(context.Background(), ngmodels.NewUserUID(tempUser), []ngmodels.AlertRule{
{
DashboardUID: &folder2UID,
DashboardUID: &dashboardUID,
UID: "test",
Title: "test",
OrgID: 1,
@@ -97,7 +98,7 @@ func TestIntegrationDirectSQLStats(t *testing.T) {
},
Condition: "ok",
Updated: now,
NamespaceUID: "test",
NamespaceUID: folder2UID,
ExecErrState: ngmodels.ExecutionErrorState(ngmodels.Alerting),
NoDataState: ngmodels.Alerting,
IntervalSeconds: 60,