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

fix(CapMan): Allocation Policies causing potentially timeout errors on ST #4403

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion snuba/query/allocation_policies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ def is_active(self) -> bool:

@property
def is_enforced(self) -> bool:
return bool(self.get_config_value(IS_ENFORCED))
return (
bool(self.get_config_value(IS_ENFORCED))
and settings.ENFORCE_BYTES_SCANNED_WINDOW_POLICY
)

@property
def max_threads(self) -> int:
Expand Down
5 changes: 5 additions & 0 deletions snuba/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class RedisClusters(TypedDict):
BULK_CLICKHOUSE_BUFFER = 10000
BULK_BINARY_LOAD_CHUNK = 2**22 # 4 MB


# Processor/Writer Options


Expand Down Expand Up @@ -245,6 +246,10 @@ class RedisClusters(TypedDict):
PROJECT_STACKTRACE_BLACKLIST: Set[int] = set()
PRETTY_FORMAT_EXPRESSIONS = True

# Capacity Management

ENFORCE_BYTES_SCANNED_WINDOW_POLICY = True

# By default, allocation policies won't block requests from going through in a production
# environment to not cause incidents unnecessarily. If something goes wrong with allocation
# policy code, the request will still be able to go through (but it will create a dangerous
Expand Down
2 changes: 2 additions & 0 deletions snuba/settings/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# should fail on bad code
RAISE_ON_ALLOCATION_POLICY_FAILURES = True

ENFORCE_BYTES_SCANNED_WINDOW_POLICY = True

# override replacer threshold to write to redis every time a replacement message is consumed
REPLACER_PROCESSING_TIMEOUT_THRESHOLD = 0 # ms

Expand Down
Loading