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

ref(rules): Only fetch necessary data #74229

Merged
merged 12 commits into from
Jul 16, 2024
9 changes: 7 additions & 2 deletions src/sentry/rules/conditions/event_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,18 @@ def batch_query_hook(
"id", "type", "project__organization_id"
)
error_issue_ids, generic_issue_ids = self.get_error_and_generic_group_ids(groups)
organization_id = None
if groups:
group = groups[0]
if len(group) == 3:
organization_id = group[3]
ceorourke marked this conversation as resolved.
Show resolved Hide resolved

if error_issue_ids:
error_sums = self.get_chunked_result(
tsdb_function=self.tsdb.get_sums,
model=get_issue_tsdb_group_model(GroupCategory.ERROR),
group_ids=error_issue_ids,
organization_id=groups[0][2],
organization_id=organization_id,
start=start,
end=end,
environment_id=environment_id,
Expand All @@ -441,7 +446,7 @@ def batch_query_hook(
# this isn't necessarily performance, just any non-error category
model=get_issue_tsdb_group_model(GroupCategory.PERFORMANCE),
group_ids=generic_issue_ids,
organization_id=groups[0][2],
organization_id=organization_id,
start=start,
end=end,
environment_id=environment_id,
Expand Down
Loading