exq icon indicating copy to clipboard operation
exq copied to clipboard

Access pipeline.assigns or parent PID from job?

Open bgentry opened this issue 7 years ago • 3 comments
trafficstars

Hi there,

I have an Exq middleware for AppSignal that adds instrumentation (code is here). I begin the AppSignal transaction as part of the middleware. However, the job itself runs in a different process, and AppSignal's Elixir library has no way to know this is a part of the parent transaction, not unless I'm able to tell it that the child PID is related to the parent.

Is there any way to a) access the PID of the parent (i.e. the process that calls the middleware chain), or b) access the middleware pipeline.assigns from within the job?

Either of those would allow me to correlate the job itself with the parent that's running it. The existing Job metadata does not contain any such info.

Thanks!

bgentry avatar Oct 31 '18 02:10 bgentry

Anybody able to solve this one? Working on a similar problem.

foeken avatar Jan 08 '19 10:01 foeken

Process.info(self(), :links) is a hack that can be used within the job to get the parent id.

ananthakumaran avatar Jan 08 '19 11:01 ananthakumaran

The proper way would be to expose the pipeline via Exq.worker_pipeline(), like we do for Exq.worker_job()

ananthakumaran avatar Jan 08 '19 11:01 ananthakumaran