elastic / elastic/apm-agent-python
Celery task context sticks to the main transaction which is misleading
- Ngôn ngữ chính
- Python
- Star
- 431
- Fork
- 239
- Merge trung bình
- 5 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 7
Mô tả
**Describe the bug**: ...
Celery task execution sticks to the main transaction of the django view. This is really misleading cause you may think that your view\endpoint works really slow, but in reality user already received response.

**Environment (please complete the following information)**
- OS: Linux (heroku)
- Python version: 3.11
- Framework and version [e.g. Django 2.1]: Django 5
- APM Server version:
- Agent version: elastic-apm = "^6.23.0"
- Celery celery = {extras = ["sqs"], version = "^5.5.1"}
**Additional context**
`elasticapm.contrib.django.middleware.TracingMiddleware` middleware in the beginning (first).
Celery task is called trough .apply_async or .delay() doesn't matter.
Any ideas why it may happen? I assume it should be displayed just like it was called and that's it, without internal context sticked to the main View\endpoint transaction.
Hướng dẫn đóng góp
Hướng nghiên cứu
Tái hiện với Django 5, Python 3.11, elastic-apm 6.23.0 và Celery 5.5.1, đặt elasticapm.contrib.django.middleware.TracingMiddleware ở vị trí đầu tiên và gọi các task thông qua cả .apply_async và .delay(). So sánh thời gian và ngữ cảnh của các transaction của task và view; được xem là hoàn tất khi task được hiển thị độc lập sau phản hồi của view thay vì vẫn gắn với transaction chính của view.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- django, python
- Lĩnh vực
- backend, observability
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100