1

I'm setting up AWS X-Ray integration for my lambda service in Python, but I've encountered a strange issue.

I make an external HTTP call with the built in Python requests library, and my logs show that the status code is 404. Here's a snippet:

...
response = get_request(url, headers, params)
print(f"stat = {response.status_code}") # logs as 404
...

When I check AWS X-Ray, I can see the error rate is 100%: X-Ray Service Map

But when I click on traces, the response code then becomes 200. X-Ray Traces

Why is there a discrepancy between the response codes?

From the documentation here, I should only need to add patch_all() method in order to trace my requests, which I've already done, so why is it I am still seeing 200 response.

Ryan T.
  • 197
  • 1
  • 15
  • 1
    I have encountered a similar issue and have opened [my own question](https://stackoverflow.com/questions/71239226/aws-x-ray-always-reports-200). However, further reading has led me to this [GitHub](https://github.com/aws/aws-xray-sdk-dotnet/issues/7) issue from 4 years ago. Sadly it looks like AWS consider this to be expected/acceptable behaviour. – David Gard Feb 23 '22 at 15:24
  • Wow that is quite frustrating to see that this is acceptable behaviour, it leaves so much ambiguity as to whether there actually was an issue in my pipeline. – Ryan T. Feb 24 '22 at 07:36
  • 1
    Yeah, it's pretty shocking. Very poor too that it was four years ago they said "We are working with AWS Lambda team to open up Lambda segment" but it doesn't seem to have happened (at least my Google skills couldn't find any evidence of it). – David Gard Feb 25 '22 at 09:54

0 Answers0