-
I have found myself a few times in the situation where I was debugging some error that occurred during a job and I would need to know why that job has been enqueued in the first place. What are your thoughts on this? (Or is there another approach to debugging something like this?) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
In GoodJob itself, there is nothing for this. I think it would be pretty expensive to store the backtrace eagerly on enqueue. Rails has some things that might help you out though. There is active_job.log_query_tags_around_perform to write to logs where a job got enqueued from. That one is more of a dev option, and only enabled there by default. The usefulness in production doesn't seem that high. You could also try the instrumentation api, there is an event when a job got enqueued: enqueue.active_job. It contains the job payload and may help you understand what's going on. I'm not sure how helpful this information will be to you. It sounds like you are looking at the jobs in production as these things happen but maybe it'll give you some pointers. |
Beta Was this translation helpful? Give feedback.
In GoodJob itself, there is nothing for this. I think it would be pretty expensive to store the backtrace eagerly on enqueue. Rails has some things that might help you out though.
There is active_job.log_query_tags_around_perform to write to logs where a job got enqueued from. That one is more of a dev option, and only enabled there by default. The usefulness in production doesn't seem that high.
You could also try the instrumentation api, there is an event when a job got enqueued: enqueue.active_job. It contains the job payload and may help you understand what's going on.
caller
should include the enqueue source (but I have not tested this).I'm not sure how helpful this information will…