A queue is the easiest part of a Laravel app to forget about, because when it works you never think about it. Jobs go in, things happen, nobody notices. The trouble is it fails the same way: quietly. A worker dies and isn't restarted, jobs pile up, and the first symptom isn't an error but a user asking why their export from an hour ago still hasn't arrived. Monitoring queues is mostly about making that silence loud by surfacing the dead worker, the failure spike, and the slowly-growing backlog before they become a support ticket.
1. Keep your workers alive
Queue workers are long-running processes. They leak memory, die on OOM, and restart on deploy. You need a supervisor that restarts them automatically.
Supervisor config: /etc/supervisor/conf.d/laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /srv/app/artisan queue:work redis --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=4
redirect_stderr=true
stdout_logfile=/srv/app/storage/logs/worker.log
stopwaitsecs=3600
If you're on Redis, Horizon manages the workers for you: it balances and scales worker processes across queues, exposes a dashboard, and restarts cleanly on deploy with horizon:terminate. It doesn't replace Supervisor. You run one php artisan horizon program under Supervisor instead of the queue:work entries. Not on Redis? See the Horizon alternatives for other queue drivers.
composer require laravel/horizon
php artisan horizon:install
php artisan horizon2. Handle failures loud, not silent
Laravel writes failed jobs to the failed_jobs table by default. That's useful as a dead-letter store but invisible unless you look.
Hook into the Queue::failing() event to alert on failures:
use Illuminate\Queue\Events\JobFailed;
use Illuminate\Support\Facades\Queue;
public function boot(): void
{
Queue::failing(function (JobFailed $event) {
logger()->error('Job failed', [
'job' => $event->job->resolveName(),
'connection' => $event->connectionName,
'queue' => $event->job->getQueue(),
'attempts' => $event->job->attempts(),
'exception' => $event->exception->getMessage(),
]);
});
}Logging is a baseline. For production alerting you want something that groups failures by job class and throttles duplicate noise. Raw logger() calls will drown your channel. The failed job monitoring guide covers the options layer by layer.
3. Track attempts, duration, and throughput
A job that takes 10x longer today than yesterday is a problem, even if it doesn't fail. The three metrics that matter:
- Wait time: how long a job sat in the queue before a worker picked it up
- Processing time: how long handle() took, with p50/p95/p99 per job class
- Attempt count: how often jobs are being retried before succeeding
For Redis queues, Horizon's dashboard shows the current wait per queue and its Metrics page charts throughput and runtime. The queue latency guide shows how to record wait time on any driver. For everything else (SQS, database, mixed drivers, per-class duration percentiles), you need an APM with queue-specific watchers.
4. Tag jobs for context
When a job fails, you want to know whose data it was processing. Use Horizon tags, or add values with Laravel's Context facade. Nightwatch records the Context on each job attempt, and NightOwl shows it on the attempt page. Job properties themselves aren't recorded.
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Context;
class ChargeCustomer implements ShouldQueue
{
use Queueable;
public function __construct(public Customer $customer) {}
public function tags(): array
{
return ['billing', 'customer:'.$this->customer->id];
}
public function handle(): void
{
Context::add('customer_id', $this->customer->id);
// ...
}
}