Skip to content

Commit

Permalink
Log notification ID on deliver tasks and in clients.
Browse files Browse the repository at this point in the history
- help tie things together  in Kibana.
  • Loading branch information
Martyn Inglis committed Dec 20, 2016
1 parent 31b2c3f commit 2d94673
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/clients/sms/firetext.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ def send_sms(self, to, content, reference, sender=None):
raise FiretextClientResponseException(response=e.response, exception=e)
finally:
elapsed_time = monotonic() - start_time
self.current_app.logger.info("Firetext request finished in {}".format(elapsed_time))
self.current_app.logger.info("Firetext request for {} finished in {}".format(reference, elapsed_time))
self.statsd_client.timing("clients.firetext.request-time", elapsed_time)
return response
2 changes: 1 addition & 1 deletion app/clients/sms/mmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ def send_sms(self, to, content, reference, multi=True, sender=None):
finally:
elapsed_time = monotonic() - start_time
self.statsd_client.timing("clients.mmg.request-time", elapsed_time)
self.current_app.logger.info("MMG request finished in {}".format(elapsed_time))
self.current_app.logger.info("MMG request for {} finished in {}".format(reference, elapsed_time))

return response
8 changes: 7 additions & 1 deletion app/delivery/send_to_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
def send_sms_to_provider(notification):
service = dao_fetch_service_by_id(notification.service_id)
provider = provider_to_use(SMS_TYPE, notification.id)
current_app.logger.info(
"Starting sending SMS {} to provider at {}".format(notification.id, datetime.utcnow())
)
if notification.status == 'created':
template_model = dao_get_template_by_id(notification.template_id, notification.template_version)
template = SMSMessageTemplate(
Expand Down Expand Up @@ -47,7 +50,7 @@ def send_sms_to_provider(notification):
dao_update_notification(notification)

current_app.logger.info(
"SMS {} sent to provider at {}".format(notification.id, notification.sent_at)
"SMS {} sent to provider {} at {}".format(notification.id, provider.get_name(), notification.sent_at)
)
delta_milliseconds = (datetime.utcnow() - notification.created_at).total_seconds() * 1000
statsd_client.timing("sms.total-time", delta_milliseconds)
Expand All @@ -56,6 +59,9 @@ def send_sms_to_provider(notification):
def send_email_to_provider(notification):
service = dao_fetch_service_by_id(notification.service_id)
provider = provider_to_use(EMAIL_TYPE, notification.id)
current_app.logger.info(
"Starting sending EMAIL {} to provider at {}".format(notification.id, datetime.utcnow())
)
if notification.status == 'created':
template_dict = dao_get_template_by_id(notification.template_id, notification.template_version).__dict__

Expand Down

0 comments on commit 2d94673

Please sign in to comment.