Skip to content

Commit

Permalink
Revert "fix(quota): Max limit of 2**32 - 1" (#48353)
Browse files Browse the repository at this point in the history
Reverts #48057

As of getsentry/relay#2079, Relay is able to
parse any positive integer `< 2**64`, so this workaround is no longer
necessary.
  • Loading branch information
jjbayer authored May 3, 2023
1 parent d8ac56e commit 23cc3f5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
22 changes: 0 additions & 22 deletions src/sentry/quotas/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import logging
import typing
from enum import IntEnum, unique
from typing import Optional

import sentry_sdk
from django.conf import settings
from django.core.cache import cache

Expand All @@ -16,9 +14,6 @@
from sentry.models import Project


logger = logging.getLogger(__name__)


@unique
class QuotaScope(IntEnum):
ORGANIZATION = 1
Expand Down Expand Up @@ -83,23 +78,6 @@ def __init__(
assert reason_code, "reason code required for fallible quotas"
assert type(limit) == int, "limit must be an integer"

if limit >= 2**32:
with sentry_sdk.configure_scope() as sentry_scope:
sentry_scope.set_context(
"quota_limit",
{
"id": id,
"categories": categories,
"scope": scope,
"scope_id": scope_id,
"limit": limit,
"window": window,
"reason_code": reason_code,
},
)
logging.error("Quota limit too large for Relay to parse: %s", limit)
limit = 2**32 - 1

if limit == 0:
assert id is None, "reject-all quotas cannot be tracked"
assert window is None, "tracked quotas must specify a window"
Expand Down
18 changes: 0 additions & 18 deletions tests/sentry/quotas/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,6 @@ def test_get_blended_sample_rate(self):
"reasonCode": "go_away",
},
),
(
QuotaConfig(
id="p",
scope=QuotaScope.PROJECT,
scope_id=1,
limit=2**32,
window=1,
reason_code="go_away",
),
{
"id": "p",
"scope": "project",
"scopeId": "1",
"limit": 2**32 - 1,
"window": 1,
"reasonCode": "go_away",
},
),
],
)
def test_quotas_to_json(obj, json):
Expand Down

0 comments on commit 23cc3f5

Please sign in to comment.