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

feat(query): rate limit to 120 requests/min #14873

Merged
merged 1 commit into from
Mar 23, 2023
Merged

Conversation

mariusandra
Copy link
Collaborator

Problem

We want a separate set of rate limits to HogQL queries.

Changes

Implements almost this. The /api/projects/:id/query endpoint now gets a 120 queries per hour limit. This should be enough to block users who accidentally abuse the system, and also allow legit users to do things.

The previous rate limits were "4800/hour" (ClickHouseSustainedRateThrottle) and "240/minute" (ClickHouseBurstRateThrottle)

How did you test this code?

I didn't really. Copied what I found under api/feature_flag.py and hoping for the best.

@neilkakkar
Copy link
Collaborator

neilkakkar commented Mar 23, 2023

Q: Do you want this to apply in the UI? Because right now these rate limits are only for the API accessed via a personal API key

@mariusandra
Copy link
Collaborator Author

mariusandra commented Mar 23, 2023

Yep, that's exactly what I want. People should be able to experiment in the UI as much as they want, including clicking "reload" and then "cancel" over 120 times in a minute (though why and how would you). This however is to just prevent abuse via the API.

@neilkakkar
Copy link
Collaborator

Sorry thought I had approved with the first comment 😓

@pauldambra pauldambra merged commit 7a8629c into master Mar 23, 2023
@pauldambra pauldambra deleted the query-rate-limits branch March 23, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants