Skip to content

Commit

Permalink
Code Fix for Xray Errors in Celery (#2281)
Browse files Browse the repository at this point in the history
* Fixing a small typo bug for celery that was causing logging errors

* fixing a couple of f strings

* formatting
  • Loading branch information
P0NDER0SA authored Sep 4, 2024
1 parent 8b7db3a commit 8030d76
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/aws/xray_celery_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def xray_before_task_publish(
"xray-celery: Failed to create a X-Ray subsegment on task publish", extra={"celery": {"task_id": task_id}}
)
else:
logger.warn("xray-celery: No parent segment found for task {task_id} when trying to create subsegment", task_id)
logger.warn(f"xray-celery: No parent segment found for task {task_id} when trying to create subsegment")


def xray_after_task_publish(headers=None, body=None, exchange=None, routing_key=None, **kwargs):
Expand All @@ -47,9 +47,7 @@ def xray_after_task_publish(headers=None, body=None, exchange=None, routing_key=
if xray_recorder.current_subsegment():
xray_recorder.end_subsegment()
else:
logger.warn(
"xray-celery: Skipping subsegment closing after publish as no subsegment was found: {headers}", headers=headers
)
logger.warn(f"xray-celery: Skipping subsegment closing after publish as no subsegment was found: {headers}")


def xray_task_prerun(task_id=None, task=None, args=None, **kwargs):
Expand Down

0 comments on commit 8030d76

Please sign in to comment.