Skip to content

feat(ruler): add limit to list-rules API - #7785

Merged
yeya24 merged 1 commit into
cortexproject:masterfrom
kylestang:kyle/listrules-limit
Sep 17, 2026
Merged

yeya24 merged 1 commit into
cortexproject:masterfrom
kylestang:kyle/listrules-limit

Conversation

@kylestang

@kylestang kylestang commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

This commit adds a limit to the number of rules returned by the ListRules prometheus API, after which the API will truncate the result and return a pagination token for the next page. If a single rule group is larger than the max, that rule group will still be returned.

This is being implemented after we found that JSON serializing a very large number of rules massively spikes the ruler CPU, which causes issues with rule evaluations and request timeouts.

What this PR does:

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
  • docs/configuration/v1-guarantees.md updated if this PR introduces experimental flags

@kylestang
kylestang force-pushed the kyle/listrules-limit branch 4 times, most recently from 014cc97 to 6aa117e Compare August 21, 2026 20:31
@danielblando

Copy link
Copy Markdown
Contributor

Thanks @kylestang. The code looks solid.
Can you update the description? It seems outdated.

@kylestang
kylestang marked this pull request as ready for review September 15, 2026 23:11
@kylestang
kylestang requested a review from a team as a code owner September 15, 2026 23:11
This commit adds a limit to the number of rules returned by the
ListRules prometheus API, after which the API will truncate the result
and return a pagination token for the next page. If a single rule group
is larger than the max, that rule group will still be returned.

This is being implemented after we found that JSON serializing a very large
number of rules massively spikes the ruler CPU, which causes issues
with rule evaluations and request timeouts.

Signed-off-by: Kyle Stang <kylestng@amazon.com>

@yeya24 yeya24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@yeya24
yeya24 merged commit b1a7e67 into cortexproject:master Sep 17, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants