How to end a span in a different service? Job queue use case. #2711
Replies: 1 comment 4 replies
-
I think you should create two spans here. One which is started when the job is queued and ended when the job is done. And a second span in the worker which is started when the job itself starts and ended when it is done in worker. This has the extra benefit that you see also the time a job lies around in the queue. As main and worker thread can't share JS objects the SDK the OTel setup would be somewhat similar as if you would have two processes. One SDK instance in the main thread and one in each worker. To link the span you have to inject the span in main thread using the propagation API and extract it in worker. So some side channel in your workitem to transfer |
Beta Was this translation helpful? Give feedback.
-
I have a service where a webhook comes in and then a job is queued. I'd like to start a span there and then end it in the worker that processes the job.
How do I do this? My thought is we start a span when the webhook comes in and then set a
traceparent
on the job and then rehydrate the span somehow in the job worker?Beta Was this translation helpful? Give feedback.
All reactions