mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Merge pull request #3399 from alphagov/timeout-stats-180344294
Add new metrics for slow / unknown delivery
This commit is contained in:
@@ -8,7 +8,7 @@ from notifications_utils.clients.zendesk.zendesk_client import (
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from app import notify_celery, zendesk_client
|
||||
from app import notify_celery, statsd_client, zendesk_client
|
||||
from app.aws import s3
|
||||
from app.config import QueueNames
|
||||
from app.cronitor import cronitor
|
||||
@@ -123,6 +123,7 @@ def timeout_notifications():
|
||||
notifications = dao_timeout_notifications(cutoff_time)
|
||||
|
||||
for notification in notifications:
|
||||
statsd_client.incr(f'timeout-sending.{notification.sent_by}')
|
||||
check_and_queue_callback_task(notification)
|
||||
|
||||
current_app.logger.info(
|
||||
|
||||
@@ -20,7 +20,7 @@ from sqlalchemy.sql import functions
|
||||
from sqlalchemy.sql.expression import case
|
||||
from werkzeug.datastructures import MultiDict
|
||||
|
||||
from app import create_uuid, db
|
||||
from app import create_uuid, db, statsd_client
|
||||
from app.clients.sms.firetext import (
|
||||
get_message_status_and_reason_from_firetext_code,
|
||||
)
|
||||
@@ -565,10 +565,7 @@ def is_delivery_slow_for_providers(
|
||||
slow_notifications = sum(row.count for row in rows if row.slow)
|
||||
|
||||
slow_providers[provider] = (slow_notifications / total_notifications >= threshold)
|
||||
|
||||
current_app.logger.info("Slow delivery notifications count for provider {}: {} out of {}. Ratio {}".format(
|
||||
provider, slow_notifications, total_notifications, slow_notifications / total_notifications
|
||||
))
|
||||
statsd_client.gauge(f'slow-delivery.{provider}.ratio', slow_notifications / total_notifications)
|
||||
|
||||
return slow_providers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user