Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Continuing the trace #1921

Answered by kamalhussain
kamalhussain asked this question in Q&A
Discussion options

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.

  1. At the end of the first hop, I capture the current context and stores in the queue.
  2. 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

You must be logged in to vote

I could solve this issue by using inject() and extract() methods instead of using pickle module.

Replies: 1 comment

Comment options

I could solve this issue by using inject() and extract() methods instead of using pickle module.

You must be logged in to vote
0 replies
Answer selected by kamalhussain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /