-
Couldn't load subscription status.
- Fork 754
Continuing the trace #1921
-
I have a scenario where the end-to-end flow is broken since there is a queue involved. As an example, the client makes a request to a web service, which stores the request in a queue. Another process reads from the queue and makes a new request to complete the flow. I would like to trace the complete flow and wondering how to achieve it. Here is the general approach I've in mind.
- At the end of the first hop, I capture the current context and stores in the queue.
- At the beginning of the second hop, the context is read from the queue and used for restarting the trace.
I run into a couple of issues while trying to implement it. For example, capturing the context and saving gives me the following error:
# read the context
current_context = context.get_current()
# serialize data
serialized_data = pickle.dump(current_context)
# store serialized_data in the queue
..
Here is the error:
TypeError: can't pickle _thread.lock objects
If there is a way we can reliably serialize the context, I am thinking of using the following approach to continue the trace. However, I'm not able to test since I am stuck on the first error.
# read the context_data from the queue
...
# de-serialize the context_data
saved_context = pickle.loads(context_data)
with tracer.start_as_current_span("redis", saved_context)
...
Any pointers would be appreciated.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions
I could solve this issue by using inject() and extract() methods instead of using pickle module.
Replies: 1 comment
-
I could solve this issue by using inject() and extract() methods instead of using pickle module.
Beta Was this translation helpful? Give feedback.