laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.82k stars 636 forks source link

Display Laravel Context on the Job view #1470

Closed flexchar closed 1 week ago

flexchar commented 1 week ago

Hey, the new laravel context feature is great.

Often times custom logging is not needed but sometimes it would be extremely helpful to see the existing context on the jobs in Horizon just as we see the payload or custom tags for the lifetime of the job.

When the job is dispatched, any information currently stored in the context is captured and shared with the job. The captured information is then hydrated back into the current context while the job is executing. So, if our job's handle method was to write to the log ... The resulting log entry would contain the information that was added to the context during the request that originally dispatched the job. https://laravel.com/docs/11.x/context#how-it-works

Would it be possible to expose that in UI since it's already made available for logging?

driesvints commented 1 week ago

Hi @flexchar. Best that you attempt a PR to see if Taylor would accept. Thanks.