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%:
But when I click on traces, the response code then becomes 200.
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.