Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Move some verbose celery INFO-level logs to reduce log size" #2021

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions app/celery/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ def worker_process_shutdown(sender, signal, pid, exitcode, **kwargs):


def make_task(app):
from app import statsd_client

class NotifyTask(Task):
abstract = True
start = None

def on_success(self, retval, task_id, args, kwargs):
task_name = self.name
now = time.time()
statsd_client.timing_with_dates(f"celery-task.{task_name}.total-time", now, self.start)

elapsed_time = now - self.start
app.logger.debug("{task_name} took {time}".format(task_name=task_name, time="{0:.4f}".format(elapsed_time)))
elapsed_time = time.time() - self.start
app.logger.info("{task_name} took {time}".format(task_name=self.name, time="{0:.4f}".format(elapsed_time)))

def on_failure(self, exc, task_id, args, kwargs, einfo):
# ensure task will log exceptions to correct handlers
Expand Down
2 changes: 1 addition & 1 deletion app/celery/provider_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def deliver_sms(self, notification_id):
@statsd(namespace="tasks")
def deliver_email(self, notification_id):
try:
current_app.logger.debug("Start sending email for notification id: {}".format(notification_id))
current_app.logger.info("Start sending email for notification id: {}".format(notification_id))
notification = notifications_dao.get_notification_by_id(notification_id)
if not notification:
raise NoResultFound()
Expand Down
12 changes: 6 additions & 6 deletions app/celery/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,12 @@ def save_smss(self, service_id: Optional[str], signed_notifications: List[Signed
try:
# If the data is not present in the encrypted data then fallback on whats needed for process_job.
saved_notifications = persist_notifications(verified_notifications)
current_app.logger.debug(
current_app.logger.info(
f"Saved following notifications into db: {notification_id_queue.keys()} associated with receipt {receipt}"
)
if receipt:
acknowledge_receipt(SMS_TYPE, process_type, receipt)
current_app.logger.debug(
current_app.logger.info(
f"Batch saving: receipt_id {receipt} removed from buffer queue for notification_id {notification_id} for process_type {process_type}"
)
else:
Expand All @@ -297,7 +297,7 @@ def save_smss(self, service_id: Optional[str], signed_notifications: List[Signed
signed_and_verified = list(zip(signed_notifications, verified_notifications))
handle_batch_error_and_forward(self, signed_and_verified, SMS_TYPE, e, receipt, template)

current_app.logger.debug(f"Sending following sms notifications to AWS: {notification_id_queue.keys()}")
current_app.logger.info(f"Sending following sms notifications to AWS: {notification_id_queue.keys()}")
for notification_obj in saved_notifications:
try:
if not current_app.config["FF_EMAIL_DAILY_LIMIT"]:
Expand Down Expand Up @@ -383,7 +383,7 @@ def save_emails(self, _service_id: Optional[str], signed_notifications: List[Sig
try:
# If the data is not present in the encrypted data then fallback on whats needed for process_job
saved_notifications = persist_notifications(verified_notifications)
current_app.logger.debug(
current_app.logger.info(
f"Saved following notifications into db: {notification_id_queue.keys()} associated with receipt {receipt}"
)
if receipt:
Expand All @@ -392,7 +392,7 @@ def save_emails(self, _service_id: Optional[str], signed_notifications: List[Sig
# at this point in the code we have a list of notifications (saved_notifications)
# which could use multiple templates
acknowledge_receipt(EMAIL_TYPE, process_type, receipt)
current_app.logger.debug(
current_app.logger.info(
f"Batch saving: receipt_id {receipt} removed from buffer queue for notification_id {notification_id} for process_type {process_type}"
)
else:
Expand All @@ -415,7 +415,7 @@ def try_to_send_notifications_to_queue(notification_id_queue, service, saved_not
Loop through saved_notifications, check if the service has hit their daily rate limit,
and if not, call send_notification_to_queue on notification
"""
current_app.logger.debug(f"Sending following email notifications to AWS: {notification_id_queue.keys()}")
current_app.logger.info(f"Sending following email notifications to AWS: {notification_id_queue.keys()}")
# todo: fix this potential bug
# service is whatever it was set to last in the for loop above.
# at this point in the code we have a list of notifications (saved_notifications)
Expand Down
Loading