Skip to content

Comments

ROX-33254: use SQL aggregate query for GetAlertsGroup#19166

Draft
dashrews78 wants to merge 1 commit intodashrews/resolvers-alert-policy-counts-33251from
dashrews/getalertgroups-33254
Draft

ROX-33254: use SQL aggregate query for GetAlertsGroup#19166
dashrews78 wants to merge 1 commit intodashrews/resolvers-alert-policy-counts-33251from
dashrews/getalertgroups-33254

Conversation

@dashrews78
Copy link
Contributor

@dashrews78 dashrews78 commented Feb 24, 2026

Description

Replace the unbounded SearchListAlerts call (which deserializes every alert protobuf blob and groups in-memory) with a SQL GROUP BY + COUNT query that computes per-policy alert counts entirely in the database.

The new SearchAlertPolicyGroups datastore method follows the established pattern from SearchAlertPolicySeverityCounts: a view struct with db tags, a query builder that adds SELECT/GROUP BY/ORDER BY clauses, and RunSelectRequestForSchemaFn for execution.

AI-assisted development.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

change me!

Replace the unbounded SearchListAlerts call (which deserializes every
alert protobuf blob and groups in-memory) with a SQL GROUP BY + COUNT
query that computes per-policy alert counts entirely in the database.

The new SearchAlertPolicyGroups datastore method follows the established
pattern from SearchAlertPolicySeverityCounts: a view struct with db tags,
a query builder that adds SELECT/GROUP BY/ORDER BY clauses, and
RunSelectRequestForSchemaFn for execution.

Categories are omitted from the response since the Dashboard UI consumer
(the only caller) does not use them from this endpoint.

AI-assisted development.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dashrews78
Copy link
Contributor Author

@openshift-ci
Copy link

openshift-ci bot commented Feb 24, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@rhacs-bot
Copy link
Contributor

Images are ready for the commit at aaedb9d.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-170-gaaedb9d16c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants