Adding logging to track "No Targets Specified" error fixes VICE-598

Test Plan
- Deploy and observe metric in datadog

Change-Id: Ic86de9b772a72d6fab710d4a58433a843973cae7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241822
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
Jeffrey Johnson 2020-07-02 12:12:27 -07:00
parent e9bb481bc0
commit 0cb4ca85cc
1 changed files with 6 additions and 1 deletions

View File

@ -638,9 +638,14 @@ class Message < ActiveRecord::Base
def enqueue_to_sqs
targets = notification_targets
if targets.empty?
# Log no_targets_specified error to DataDog
InstStatsd::Statsd.increment("message.no_targets_specified",
short_stat: 'message.no_targets_specified',
tags: {path_type: path_type})
self.transmission_errors = "No notification targets specified"
self.set_transmission_error
else
else
targets.each do |target|
Services::NotificationService.process(
notification_service_id,