Skip to content

Commit

Permalink
use new callback.pinpoint metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
sastels committed May 6, 2024
1 parent fde4812 commit 040a361
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/celery/process_pinpoint_receipts_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ def process_pinpoint_results(self, response):
f"Pinpoint callback return status of {notification_status} for notification: {notification.id}"
)

statsd_client.incr(f"callback.sns.{notification_status}") # TODO: do we want a Pinpoint metric here?
statsd_client.incr(f"callback.pinpoint.{notification_status}")

if notification.sent_at:
statsd_client.timing_with_dates(
"callback.sns.elapsed-time", datetime.utcnow(), notification.sent_at
) # TODO: do we want a Pinpoint metric here?
"callback.pinpoint.elapsed-time", datetime.utcnow(), notification.sent_at
)

_check_and_queue_callback_task(notification)

Expand Down
4 changes: 2 additions & 2 deletions tests/app/celery/test_process_pinpoint_receipts_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ def test_process_pinpoint_results_calls_service_callback(sample_template, notify
assert process_pinpoint_results(pinpoint_success_callback(reference="ref"))
assert get_notification_by_id(notification.id).status == NOTIFICATION_DELIVERED
assert get_notification_by_id(notification.id).provider_response == "Message has been accepted by phone"
statsd_client.timing_with_dates.assert_any_call("callback.sns.elapsed-time", datetime.utcnow(), notification.sent_at)
statsd_client.incr.assert_any_call("callback.sns.delivered")
statsd_client.timing_with_dates.assert_any_call("callback.pinpoint.elapsed-time", datetime.utcnow(), notification.sent_at)
statsd_client.incr.assert_any_call("callback.pinpoint.delivered")
updated_notification = get_notification_by_id(notification.id)
signed_data = create_delivery_status_callback_data(updated_notification, callback_api)
send_mock.assert_called_once_with([str(notification.id), signed_data], queue="service-callbacks")

0 comments on commit 040a361

Please sign in to comment.