From 786c088959253b72efdec472c199db0553e6312c Mon Sep 17 00:00:00 2001 From: Josh Ferge Date: Thu, 24 Oct 2024 15:57:44 -0400 Subject: [PATCH] dev(alerts): add logs to new condition (#79709) add logs for better debugging while we release the feature --- .../rules/conditions/event_frequency.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/sentry/rules/conditions/event_frequency.py b/src/sentry/rules/conditions/event_frequency.py index 397a6b15936c0..3b29025b637c1 100644 --- a/src/sentry/rules/conditions/event_frequency.py +++ b/src/sentry/rules/conditions/event_frequency.py @@ -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", @@ -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, @@ -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(