Skip to content

Commit

Permalink
dev(alerts): add logs to new condition (#79709)
Browse files Browse the repository at this point in the history
add logs for better debugging while we release the feature
  • Loading branch information
JoshFerge authored Oct 24, 2024
1 parent c8064d2 commit 786c088
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/sentry/rules/conditions/event_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,18 @@ def query_hook(
def batch_query_hook(
self, group_ids: set[int], start: datetime, end: datetime, environment_id: int
) -> dict[int, int]:
logger = logging.getLogger(
"sentry.rules.event_frequency.EventUniqueUserFrequencyConditionWithConditions"
)
logger.info(
"batch_query_hook_start",
extra={
"group_ids": group_ids,
"start": start,
"end": end,
"environment_id": environment_id,
},
)
assert self.rule
if not features.has(
"organizations:event-unique-user-frequency-condition-with-conditions",
Expand Down Expand Up @@ -611,6 +623,10 @@ def batch_query_hook(
if snuba_condition:
conditions.append(snuba_condition)

logger.info(
"batch_query_hook_conditions",
extra={"conditions": conditions},
)
if error_issue_ids and organization_id:
error_totals = self.get_chunked_result(
tsdb_function=self.tsdb.get_distinct_counts_totals_with_conditions,
Expand Down Expand Up @@ -639,6 +655,10 @@ def batch_query_hook(
)
batch_totals.update(error_totals)

logger.info(
"batch_query_hook_end",
extra={"batch_totals": batch_totals},
)
return batch_totals

def get_snuba_query_result(
Expand Down

0 comments on commit 786c088

Please sign in to comment.