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)
This commit is contained in:
Joey Orlando 2023-11-21 13:35:23 -05:00 committed by GitHub
parent 56d1b529e9
commit f70c439334
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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