Skip to content

Commit 8164bc2

Browse files
ref(ratelimit): Added a config and changed a default (#31141)
Org rate limits should be the most lenient rate limit. This change increases the default org limits to match the current highest, users. I also made enforce_rate_limit a configurable option so that self-hosted can disable it from config.py
1 parent abfc6e5 commit 8164bc2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/sentry/api/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Endpoint(APIView):
103103
# Default Rate Limit Values, override in subclass
104104
# Should be of format: { <http function>: { <category>: RateLimit(limit, window) } }
105105
rate_limits: Mapping[str, Mapping[RateLimitCategory | str, RateLimit]] = {}
106-
enforce_rate_limit: bool = False
106+
enforce_rate_limit: bool = settings.SENTRY_RATELIMITER_ENABLED
107107

108108
def build_cursor_link(self, request: Request, name, cursor):
109109
querystring = None

src/sentry/conf/server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,11 @@ def create_partitioned_queues(name):
13291329

13301330
# Rate limiting backend
13311331
SENTRY_RATELIMITER = "sentry.ratelimits.base.RateLimiter"
1332+
SENTRY_RATELIMITER_ENABLED = False
13321333
SENTRY_RATELIMITER_OPTIONS = {}
13331334
# These values were determined from analysis on one week of api access logs
1334-
SENTRY_RATELIMITER_DEFAULT_IP = 1000
1335-
SENTRY_RATELIMITER_DEFAULT_USER = 3230
1335+
SENTRY_RATELIMITER_DEFAULT_IP = 620
1336+
SENTRY_RATELIMITER_DEFAULT_USER = 620
13361337
SENTRY_RATELIMITER_DEFAULT_ORG = 620
13371338
SENTRY_RATELIMITER_DEFAULTS = {
13381339
RateLimitCategory.IP: RateLimit(SENTRY_RATELIMITER_DEFAULT_IP, 1),

0 commit comments

Comments
 (0)