|
16 | 16 | from click_datetime import Datetime as click_dt |
17 | 17 | from dateutil import rrule |
18 | 18 | from flask import current_app, json |
| 19 | +from notifications_utils.clients.otel.utils import otel_duration_histogram, otel_span_with_status |
19 | 20 | from notifications_utils.recipients import RecipientCSV |
20 | 21 | from notifications_utils.statsd_decorators import statsd |
21 | 22 | from notifications_utils.template import SMSMessageTemplate |
| 23 | +from opentelemetry.trace import get_tracer |
22 | 24 | from sqlalchemy.exc import IntegrityError |
23 | 25 | from sqlalchemy.orm.exc import NoResultFound |
24 | 26 |
|
@@ -397,6 +399,8 @@ def bulk_invite_user_to_service(file_name, service_id, user_id, auth_type, permi |
397 | 399 | "-s", "--start_date", default=datetime(2017, 2, 1), help="start date inclusive", type=click_dt(format="%Y-%m-%d") |
398 | 400 | ) |
399 | 401 | @statsd(namespace="tasks") |
| 402 | +@otel_duration_histogram("populate_notification_postage_duration") |
| 403 | +@otel_span_with_status(get_tracer(__name__), "populate_notification_postage") |
400 | 404 | def populate_notification_postage(start_date): |
401 | 405 | current_app.logger.info("populating historical notification postage") |
402 | 406 |
|
@@ -442,6 +446,8 @@ def populate_notification_postage(start_date): |
442 | 446 | @click.option("-s", "--start_date", required=True, help="start date inclusive", type=click_dt(format="%Y-%m-%d")) |
443 | 447 | @click.option("-e", "--end_date", required=True, help="end date inclusive", type=click_dt(format="%Y-%m-%d")) |
444 | 448 | @statsd(namespace="tasks") |
| 449 | +@otel_duration_histogram("update_jobs_archived_flag") |
| 450 | +@otel_span_with_status(get_tracer(__name__), "populate_notification_postage") |
445 | 451 | def update_jobs_archived_flag(start_date, end_date): |
446 | 452 | current_app.logger.info("Archiving jobs created between %s to %s", start_date, end_date) |
447 | 453 |
|
@@ -475,6 +481,8 @@ def update_jobs_archived_flag(start_date, end_date): |
475 | 481 | @notify_command(name="update-emails-to-remove-gsi") |
476 | 482 | @click.option("-s", "--service_id", required=True, help="service id. Update all user.email_address to remove .gsi") |
477 | 483 | @statsd(namespace="tasks") |
| 484 | +@otel_duration_histogram("update_emails_to_remove_gsi") |
| 485 | +@otel_span_with_status(get_tracer(__name__), "populate_notification_postage") |
478 | 486 | def update_emails_to_remove_gsi(service_id): |
479 | 487 | users_to_update = """SELECT u.id user_id, u.name, email_address, s.id, s.name |
480 | 488 | FROM users u |
|
0 commit comments