aws / aws/aws-xray-sdk-python

Django Middleware not working on AWS Lambda

Open
#175 11 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
338
Forks
147
PR merge metrics
No merged PRs in 30d

Description

I tried to use the Django middleware with an app deployed on Lambda (using Zappa with ELB, not API Gateway) but it’s not working. If the middleware is enabled, the subsegments are sent to the Lambda X-Ray Daemon but they are discarded because the parent_id is not good (according to AWS Support & AWS X-Ray teams).

Without the middleware, it is possible to use patch_db() to get the SQL queries inside X-Ray.

SDK Version: 2.4.2
Django Version: 2.2.5

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reproducing the Django middleware behavior on Lambda through Zappa with ELB, using SDK 2.4.2 and Django 2.2.5, then compare it with patch_db(); done means middleware subsegments are retained by X-Ray with a valid parent_id instead of being discarded.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, django, python
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.