mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 08:51:30 -05:00
Log notification ID on deliver tasks and in clients.
- help tie things together in Kibana.
This commit is contained in:
@@ -113,6 +113,6 @@ class FiretextClient(SmsClient):
|
||||
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
|
||||
|
||||
@@ -120,6 +120,6 @@ class MMGClient(SmsClient):
|
||||
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
|
||||
|
||||
@@ -19,6 +19,9 @@ from app.models import SMS_TYPE, KEY_TYPE_TEST, BRANDING_ORG, EMAIL_TYPE
|
||||
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(
|
||||
@@ -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)
|
||||
@@ -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__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user