Skip to content

Commit

Permalink
fix queries
Browse files Browse the repository at this point in the history
  • Loading branch information
iamrajjoshi committed May 22, 2024
1 parent 93d6477 commit 06b402f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/sentry/release_health/release_monitor/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from datetime import datetime, timedelta

from snuba_sdk import (
BooleanCondition,
BooleanOp,
Column,
Condition,
Direction,
Expand Down Expand Up @@ -117,6 +119,7 @@ def fetch_project_release_health_totals_with_org_project_filter(
env_col,
],
groupby=[
Column("org_id"),
Column("project_id"),
release_col,
env_col,
Expand All @@ -138,12 +141,18 @@ def fetch_project_release_health_totals_with_org_project_filter(
),
),
# Either org_id > prev_org_id or (org_id == prev_org_id and project_id > prev_project_id)
Condition(
Condition(Column("org_id"), Op.GT, prev_org_id)
| (
Condition(Column("org_id"), Op.EQ, prev_org_id)
& Condition(Column("project_id"), Op.GT, prev_project_id)
)
BooleanCondition(
BooleanOp.OR,
[
Condition(Column("org_id"), Op.GT, prev_org_id),
BooleanCondition(
BooleanOp.AND,
[
Condition(Column("org_id"), Op.EQ, prev_org_id),
Condition(Column("project_id"), Op.GT, prev_project_id),
],
),
],
),
],
granularity=Granularity(21600),
Expand Down

0 comments on commit 06b402f

Please sign in to comment.