From effc887b08f1e3adc3c9687285bdf3233a86e70f Mon Sep 17 00:00:00 2001 From: Moustafa Baiou Date: Fri, 15 Aug 2025 08:53:01 -0700 Subject: [PATCH] Alerting: Use db pagination for prometheus api This reintroduces database pagination for the Prometheus API for rules. Follow up for #109558 to use the new pagination format. Note: This changes the sort-order to use `NamespaceUID` instead of the fully qualified Folder path. This also changes the cursor format to use the `NamespaceUID` instead of the Folder path and to be in a reverisble format. --- pkg/services/ngalert/api/prometheus/api_prometheus.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/services/ngalert/api/prometheus/api_prometheus.go b/pkg/services/ngalert/api/prometheus/api_prometheus.go index ed02dc780c5..2d0b441c9ef 100644 --- a/pkg/services/ngalert/api/prometheus/api_prometheus.go +++ b/pkg/services/ngalert/api/prometheus/api_prometheus.go @@ -30,7 +30,7 @@ import ( type RuleStoreReader interface { GetUserVisibleNamespaces(context.Context, int64, identity.Requester) (map[string]*folder.Folder, error) - ListAlertRulesStore + ListAlertRulesStoreV2 } type RuleGroupAccessControlService interface { @@ -292,7 +292,7 @@ func (srv PrometheusSrv) RouteGetRuleStatuses(c *contextmodel.ReqContext) respon return response.JSON(ruleResponse.HTTPStatusCode(), ruleResponse) } - ruleResponse = PrepareRuleGroupStatuses( + ruleResponse = PrepareRuleGroupStatusesV2( srv.log, srv.store, RuleGroupStatusesOptions{