使用 AWS X-Ray 在 Django 中跟踪 Celery 任务

Tracing Celery tasks in Django with AWS X-Ray

我正在尝试从我的 Django 应用程序中获取 Celery 任务的踪迹。我正在使用 AWS 的 X-Ray。我得到了正常 HTTP 调用、SQL 数据库查询的跟踪,但不是 Celery 任务或 Redis 的跟踪。 X-Ray 中提供了已实施任务中的日志语句。 在我的 AppConfig 实施中,我做了通常的事情:

from aws_xray_sdk.core import patch_all
patch_all()
from aws_xray_sdk.core import xray_recorder
# Need a default segment to avoid issues when running migrations and other management commands
xray_recorder.begin_segment("migrations")

我应该如何着手从 Celery 任务和 Redis 中获取踪迹?

目前X-RaySDK不支持Celery和Redis