diff --git a/app/celery/process_ses_receipts_tasks.py b/app/celery/process_ses_receipts_tasks.py index 21968740a..fef0fb1f7 100644 --- a/app/celery/process_ses_receipts_tasks.py +++ b/app/celery/process_ses_receipts_tasks.py @@ -70,7 +70,11 @@ def process_ses_results(self, response): statsd_client.incr('callback.ses.{}'.format(notification_status)) if notification.sent_at: - statsd_client.timing_with_dates('callback.ses.elapsed-time', datetime.utcnow(), notification.sent_at) + statsd_client.timing_with_dates( + f'callback.ses.{notification_status}.elapsed-time', + datetime.utcnow(), + notification.sent_at + ) _check_and_queue_callback_task(notification) diff --git a/app/celery/process_sms_client_response_tasks.py b/app/celery/process_sms_client_response_tasks.py index 5c7c67ecb..6cc04d7fb 100644 --- a/app/celery/process_sms_client_response_tasks.py +++ b/app/celery/process_sms_client_response_tasks.py @@ -75,7 +75,7 @@ def _process_for_status(notification_status, client_name, provider_reference, de if notification.sent_at: statsd_client.timing_with_dates( - 'callback.{}.elapsed-time'.format(client_name.lower()), + f'callback.{client_name.lower()}.{notification_status}.elapsed-time', datetime.utcnow(), notification.sent_at ) diff --git a/tests/app/celery/test_process_ses_receipts_tasks.py b/tests/app/celery/test_process_ses_receipts_tasks.py index 693972acd..ee8c2081b 100644 --- a/tests/app/celery/test_process_ses_receipts_tasks.py +++ b/tests/app/celery/test_process_ses_receipts_tasks.py @@ -86,7 +86,7 @@ def test_ses_callback_should_update_notification_status( assert process_ses_results(ses_notification_callback(reference='ref')) assert get_notification_by_id(notification.id).status == 'delivered' statsd_client.timing_with_dates.assert_any_call( - "callback.ses.elapsed-time", datetime.utcnow(), notification.sent_at + "callback.ses.delivered.elapsed-time", datetime.utcnow(), notification.sent_at ) statsd_client.incr.assert_any_call("callback.ses.delivered") updated_notification = Notification.query.get(notification.id) diff --git a/tests/app/notifications/test_process_client_response.py b/tests/app/notifications/test_process_client_response.py index e4bc103e9..f31a9c9ed 100644 --- a/tests/app/notifications/test_process_client_response.py +++ b/tests/app/notifications/test_process_client_response.py @@ -144,7 +144,7 @@ def test_process_sms_client_response_records_statsd_metrics(sample_notification, statsd_client.incr.assert_any_call("callback.firetext.delivered") statsd_client.timing_with_dates.assert_any_call( - "callback.firetext.elapsed-time", datetime.utcnow(), sample_notification.sent_at + "callback.firetext.delivered.elapsed-time", datetime.utcnow(), sample_notification.sent_at )