Skip to content

Commit 1fdb6f2

Browse files
authored
chore(reports): Add logging behind feature flag (#29725)
* chore(reports): Add logging behind feature flag
1 parent a9b85de commit 1fdb6f2

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

src/sentry/conf/server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,8 @@ def create_partitioned_queues(name):
10441044
# Enable usage of external relays, for use with Relay. See
10451045
# https://github.com/getsentry/relay.
10461046
"organizations:relay": True,
1047+
# Enable logging for weekly reports
1048+
"organizations:weekly-report-debugging": False,
10471049
# Enable Session Stats down to a minute resolution
10481050
"organizations:minute-resolution-sessions": True,
10491051
# Automatically opt IN users to receiving Slack notifications.

src/sentry/features/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
default_manager.add("organizations:prompt-dashboards", OrganizationFeature)
128128
default_manager.add("organizations:related-events", OrganizationFeature)
129129
default_manager.add("organizations:relay", OrganizationFeature)
130+
default_manager.add("organizations:weekly-report-debugging", OrganizationFeature, True)
130131
default_manager.add("organizations:release-adoption-chart", OrganizationFeature, True)
131132
default_manager.add("organizations:release-adoption-stage", OrganizationFeature, True)
132133
default_manager.add("organizations:release-archives", OrganizationFeature)

src/sentry/tasks/reports.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,16 @@ def deliver_organization_user_report(timestamp, duration, organization_id, user_
705705
user = User.objects.get(id=user_id)
706706

707707
if not user_subscribed_to_organization_reports(user, organization):
708+
if features.has("organizations:weekly-report-debugging", organization):
709+
logger.info(
710+
"reports.user.unsubscribed",
711+
extra={
712+
"user": user.id,
713+
"organization_id": organization.id,
714+
},
715+
)
708716
logger.debug(
709-
"Skipping report for %r to %r, user is not subscribed to reports.", organization, user
717+
f"Skipping report for {organization} to {user}, user is not subscribed to reports."
710718
)
711719
return Skipped.NotSubscribed
712720

@@ -715,10 +723,16 @@ def deliver_organization_user_report(timestamp, duration, organization_id, user_
715723
projects.update(Project.objects.get_for_user(team, user, _skip_team_check=True))
716724

717725
if not projects:
726+
if features.has("organizations:weekly-report-debugging", organization):
727+
logger.info(
728+
"reports.user.no_projects",
729+
extra={
730+
"user": user.id,
731+
"organization_id": organization.id,
732+
},
733+
)
718734
logger.debug(
719-
"Skipping report for %r to %r, user is not associated with any projects.",
720-
organization,
721-
user,
735+
f"Skipping report for {organization} to {user}, user is not associated with any projects."
722736
)
723737
return Skipped.NoProjects
724738

@@ -738,8 +752,16 @@ def deliver_organization_user_report(timestamp, duration, organization_id, user_
738752
)
739753

740754
if not reports:
755+
if features.has("organizations:weekly-report-debugging", organization):
756+
logger.info(
757+
"reports.user.no_reports",
758+
extra={
759+
"user": user.id,
760+
"organization_id": organization.id,
761+
},
762+
)
741763
logger.debug(
742-
"Skipping report for %r to %r, no qualifying reports to deliver.", organization, user
764+
f"Skipping report for {organization} to {user}, no qualifying reports to deliver."
743765
)
744766
return Skipped.NoReports
745767

0 commit comments

Comments
 (0)