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

bytes_scanned_window_policy DD metric #6081

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ def _get_quota_allowance(
granted_quota = granted_quotas[0]
is_throttled = False
if granted_quota.granted <= 0:
self.metrics.increment(
"bytes_scanned_window_policy_throttle",
tags={"referrer": str(referrer)},
)
is_throttled = True
explanation[
"reason"
Expand Down
3 changes: 3 additions & 0 deletions snuba/web/db_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,9 @@ def _apply_allocation_policies_quota(
_add_quota_info(summary, _THROTTLED_BY, throttle_quota_and_policy)
stats["quota_allowance"]["summary"] = summary

if throttle_quota_and_policy is not None:
metrics.increment("db_query_throttled_query")

if not can_run:
raise AllocationPolicyViolations.from_args(stats["quota_allowance"])
# Before allocation policies were a thing, the query pipeline would apply
Expand Down
Loading