Skip to content

Commit

Permalink
add more logging in apps.alerts.tasks.notify_user.perform_notificatio…
Browse files Browse the repository at this point in the history
…n task (#3403)

# What this PR does

add more logging in `apps.alerts.tasks.notify_user.perform_notification`
task (related to grafana/oncall-private#2318;
won't solve that issue but will help with the investigation)
  • Loading branch information
joeyorlando authored Nov 21, 2023
1 parent 56d1b52 commit f70c439
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions engine/apps/alerts/tasks/notify_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f70c439

Please sign in to comment.