Creating segment for async_django_q_task

0

Hello, I have added xray to my django app and it works correctly for every api call , Custom segment and subsegments I created except custom segments of functions that are called inside async_django_q_task. It looks like it does create traces for them but they are empty, example of such trace:

{
    "Id": "some_id",
    "Duration": null,
    "LimitExceeded": false,
    "Segments": []
}

Example of the way I try to trace the function in async_django_q_task:

def dummy_function():
    xray_recorder.begin_segment('segment')
    do_something()
    xray_recorder.end_segment()
async_django_q_task(dummy_function)

Thanks in advance for help.

질문됨 2년 전257회 조회
1개 답변
0

Hi. Sorry that you are running into this weird issue. I would like to ask a few follow up questions to investigate further.

  1. Are you running your code in a Lambda function? if yes, does this issue happen consistently or intermittently?
  2. Since the code involves async execution, there is a possibility that the execution completes outside the scope of the function execution. Do you see the async method complete execution before Lambda function finishes?
  3. Does your Lambda function have enough permissions to send traces to X-Ray backend?
  4. If possible, can you enable Debug level logs on the X-Ray SDK and see if the segments are being emitted or if there are any errors?
  5. If possible, can you provide the incoming trace header to your code? Just want to make sure if the incoming trace header is sampled or not.
AWS
답변함 2년 전
  • Hi, thank you and sorry for late response.

    1. No, the code runs in a django server on an ec2 instace.
    2. We don't use lambda function
    3. Yes, the EC2 send traces of regular http requests just fine.
    4. Does x-ray sdk has it's own log file? because I'm not seeing any xray related logs in our app log file.
    5. I'm sorry, I don't quite understand what do you mean by "provide the incoming trace header to your code", can you please elaborate?(read the trace header section in the docs but I don't understand what you mean by "provide" it)

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠