Configuration
Configuration
Database Configuration
Configure which database connection to use for monitoring data:
'database' => [
'connection' => env('QUEUE_MONITOR_DB_CONNECTION'),
'table_prefix' => 'queue_monitor_',
],
This allows you to store monitoring data separately from your application data if desired.
Payload Storage
Control how job payloads are stored for replay functionality:
'storage' => [
// Store complete job payload for replay capability
'store_payload' => env('QUEUE_MONITOR_STORE_PAYLOAD', true),
// Maximum payload size in bytes (default: 64KB)
'payload_max_size' => 65535,
],
Important: Payload storage is required for job replay. If disabled, replay functionality will not work.
Data Retention
Configure automatic cleanup of old job records:
'retention' => [
// Number of days to retain job records
'days' => 30,
// Which statuses to prune (empty array = prune all statuses)
'prune_statuses' => ['completed'],
],
Run pruning manually or via scheduled task:
// In app/Console/Kernel.php
$schedule->command('queue-monitor:prune')->daily();
Worker Detection
Customize how workers and servers are identified:
'worker_detection' => [
// Custom callable for determining server name
// If null, uses gethostname()
'server_name_callable' => null,
// Enable Horizon detection
'horizon_detection' => true,
],
Example custom server name:
'server_name_callable' => function() {
return config('app.server_name', gethostname());
},
REST API
Configure the REST API for external integrations:
'api' => [
'enabled' => env('QUEUE_MONITOR_API_ENABLED', true),
'prefix' => 'api/queue-monitor',
'middleware' => ['api'],
'rate_limit' => '60,1', // 60 requests per minute
],
You can add custom middleware for authentication:
'middleware' => ['api', 'auth:sanctum'],
Metrics Storage
Queue Monitor depends on laravel-queue-metrics for per-job CPU and memory instrumentation. Queue-metrics also provides aggregate persistence (worker heartbeats, throughput, baselines), but Queue Monitor doesn't need it.
Disable persistence (simplest setup)
If you only use Queue Monitor, disable metrics persistence to skip any storage backend:
QUEUE_METRICS_PERSISTENCE=false
Per-job CPU/memory still works. Only aggregate persistence is skipped.
Note: cboxdk/laravel-queue-autoscale requires persistence enabled. It reads worker heartbeats, throughput, and baselines from queue-metrics to make scaling decisions.
With persistence enabled (default)
When persistence is on, configure a storage backend in config/queue-metrics.php:
'persistence' => [
'enabled' => env('QUEUE_METRICS_PERSISTENCE', true),
],
'storage' => [
'driver' => env('QUEUE_METRICS_STORAGE', 'redis'),
'connection' => env('QUEUE_METRICS_CONNECTION', 'default'),
'prefix' => 'queue_metrics',
// Recommended: 1000 for Redis, 500 for database driver
'max_samples_per_key' => env('QUEUE_METRICS_MAX_SAMPLES', 1000),
],
Redis is the recommended driver. Database is available for low-scale workloads (< 10 workers) without Redis. See the installation guide for setup.
For full metrics configuration options, see the laravel-queue-metrics documentation.
Repository Bindings
Override default repository implementations:
'repositories' => [
JobMonitorRepositoryContract::class => CustomJobMonitorRepository::class,
TagRepositoryContract::class => CustomTagRepository::class,
StatisticsRepositoryContract::class => CustomStatisticsRepository::class,
],
Action Bindings
Override default action implementations:
'actions' => [
'record_job_queued' => CustomRecordJobQueuedAction::class,
'replay_job' => CustomReplayJobAction::class,
// ... more actions
],