Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limit to API for Alert Rules #70596

Merged
merged 3 commits into from
May 9, 2024

Conversation

saponifi3d
Copy link
Contributor

Description

Fixes: #67195

Adds the x-sentry-rule-limit header to the list views for alert rules (both the combined-rules and metric alert api).

I tried adding an indicator to the UI, but it was pretty difficult to tell which page we're on in the UI, since we're handling it on the backend with a Link. Rather than blocking the API fix on trying to figure out the UI, i figure it's better to get this out and we can add to the UI later.

Screenshot 2024-05-09 at 11 39 43 AM

@saponifi3d saponifi3d requested a review from a team as a code owner May 9, 2024 18:41
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 9, 2024
@@ -0,0 +1,2 @@
MAX_QUERY_SUBSCTIPTIONS_HEADER = "X-Sentry-Rule-Limit"
Copy link
Member

Choose a reason for hiding this comment

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

SUBSCTIPTIONS typo 😛 also should this be X-Sentry-Alert-Rule-Limit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at least i was consistent in my typo. 🤣 - ty - updating!

for X-Sentry-Alert-Rule-Limit do you know if the snuba subscription limit only impacts metric alerts? (i believe so, in which case agree that this is a better name)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, if you look here it's checking the QuerySubscriptions which are only used for metric alerts.

@@ -0,0 +1,2 @@
MAX_QUERY_SUBSCTIPTIONS_HEADER = "X-Sentry-Rule-Limit"
ALERT_RULES_COUNT_HEADER = "X-Sentry-Alert-Rule-Hits"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be "remaining" instead of "hits" to match the API rate limits: https://docs.sentry.io/api/ratelimits/#headers

Copy link
Member

Choose a reason for hiding this comment

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

Eh I could see it either way, up to you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, I don't think we should rename this because it already existed on the combined-rules api. i just also wanted to move this so it's consistent between alert-rules and combined-rules.

@saponifi3d saponifi3d merged commit e8f6cb0 into master May 9, 2024
48 checks passed
@saponifi3d saponifi3d deleted the jcallender/fix-67915-show-alert-limit branch May 9, 2024 20:04
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alert rules quantity limits monitoring
2 participants