I’ve an issue in my python application :
Actually I'm creating an python middleware SDK, kind of a remote package, and I'll send it to my clients, so that they can install it in their environment and inject it in their controller (where endpoints are present ) py file of python application
its purpose :
if a call is made to any of endpoints in client's application, I'll add trace_id and parent_trace_id to its headers (for connecting nested calls) before request and
after request I'll call a endpoint (for getting and storing details), along with the current endpoint's request and response details. and same goes for the nested API calls made inside the endpoint.
the issue is:
for
incoming calls: I'm using before_request and after_request methods
outgoing calls: I've overrided request method of "requests.session"
and I'm using a thread variable to update every call's trace_id and parent_trace_id, I'm able to capture every request, but (parent-child) order gets messed up.
is there a way to capture and trace both incoming and outgoing request with a common method