Skip to content

Commit

Permalink
ref: fix typing for sentry.snuba.errors (#86141)
Browse files Browse the repository at this point in the history
<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry authored Mar 3, 2025
1 parent 2c11b6b commit 8a92705
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ module = [
"sentry.search.snuba.executors",
"sentry.sentry_metrics.indexer.postgres.postgres_v2",
"sentry.shared_integrations.client.proxy",
"sentry.snuba.errors",
"sentry.snuba.metrics.query_builder",
"sentry.tasks.auth",
"sentry.tasks.base",
Expand Down
10 changes: 7 additions & 3 deletions src/sentry/snuba/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def timeseries_query(
if len(base_builder.aggregates) != 1:
raise InvalidSearchQuery("Only one column can be selected for comparison queries")
comp_query_params = snuba_params.copy()
assert comp_query_params.start is not None
assert comp_query_params.end is not None
comp_query_params.start -= comparison_delta
comp_query_params.end -= comparison_delta
comparison_builder = ErrorsTimeseriesQueryBuilder(
Expand All @@ -155,6 +157,8 @@ def timeseries_query(
with sentry_sdk.start_span(op="errors", name="timeseries.transform_results"):
results = []
for snql_query, result in zip(query_list, query_results):
assert snql_query.params.start is not None
assert snql_query.params.end is not None
results.append(
{
"data": (
Expand All @@ -163,7 +167,7 @@ def timeseries_query(
snql_query.params.start,
snql_query.params.end,
rollup,
"time",
["time"],
time_col_name="events.time",
)
if zerofill_results
Expand All @@ -177,9 +181,9 @@ def timeseries_query(
col_name = base_builder.aggregates[0].alias
# If we have two sets of results then we're doing a comparison queries. Divide the primary
# results by the comparison results.
for result, cmp_result in zip(results[0]["data"], results[1]["data"]):
for ret_result, cmp_result in zip(results[0]["data"], results[1]["data"]):
cmp_result_val = cmp_result.get(col_name, 0)
result["comparisonCount"] = cmp_result_val
ret_result["comparisonCount"] = cmp_result_val

result = base_builder.process_results(results[0])

Expand Down

0 comments on commit 8a92705

Please sign in to comment.