From f70c439334e98cc3d7d4f40012fa572715dc164c Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Tue, 21 Nov 2023 13:35:23 -0500 Subject: [PATCH] add more logging in apps.alerts.tasks.notify_user.perform_notification task (#3403) # What this PR does add more logging in `apps.alerts.tasks.notify_user.perform_notification` task (related to https://github.com/grafana/oncall-private/issues/2318; won't solve that issue but will help with the investigation) --- engine/apps/alerts/tasks/notify_user.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/apps/alerts/tasks/notify_user.py b/engine/apps/alerts/tasks/notify_user.py index c40cb4900b..e9c2437640 100644 --- a/engine/apps/alerts/tasks/notify_user.py +++ b/engine/apps/alerts/tasks/notify_user.py @@ -230,8 +230,18 @@ def perform_notification(log_record_pk): from apps.base.models import UserNotificationPolicy, UserNotificationPolicyLogRecord from apps.telegram.models import TelegramToUserConnector + # TODO: remove this log line once done investigation + task_logger.info(f"perform_notification: log_record {log_record_pk}") + log_record = UserNotificationPolicyLogRecord.objects.get(pk=log_record_pk) + # TODO: uncomment this out once done investigation + # try: + # log_record = UserNotificationPolicyLogRecord.objects.get(pk=log_record_pk) + # except UserNotificationPolicyLogRecord.DoesNotExist: + # task_logger.info(f"perform_notification: log_record {log_record_pk} doesn't exist. Skipping remainder of task") + # return + user = log_record.author alert_group = log_record.alert_group notification_policy = log_record.notification_policy