Monitor Laravel Queues, Commands, and Schedulers on Any Driver with Vigilance
Laravel Composer Pacakge #Laravel #Queue Monitoring #Laravel Packages #Open Source #PHP

Monitor Laravel Queues, Commands, and Schedulers on Any Driver with Vigilance

4 min read Mohamed Said Mohamed Said

What Is Vigilance?

Vigilance is an open-source monitoring dashboard for Laravel applications. It records queued jobs, Artisan commands, and scheduled tasks as they move through their lifecycle—from queued to running to completed or failed—capturing execution parameters, exit codes, and redacted exception traces along the way.

The key differentiator: Vigilance is queue-driver agnostic. Horizon only covers Redis queues, and Telescope is aimed at local debugging. Vigilance writes a single row per run and updates it throughout the run's lifecycle, giving you one timeline regardless of whether you use database, Redis, SQS, Beanstalkd, or sync.

Requirements: PHP 8.2+, Laravel 12 or 13, Livewire 3.5+ or 4, MIT license.


One Record Per Run, Across Every Driver

Each record stores execution parameters, final state, and a redacted exception trace when something goes wrong. Secrets are stripped automatically before storage.

To keep storage costs manageable on busy queues, Vigilance samples successful runs at dispatch time while always retaining failures:

VIGILANCE_SAMPLE_RATE=0.1
VIGILANCE_RETENTION_DAYS=7
VIGILANCE_DB_CONNECTION=monitoring

Pointing VIGILANCE_DB_CONNECTION to a dedicated database isolates monitoring writes from your primary connection. Pruning is handled automatically based on the retention setting.


Manual Dispatch From Typed Forms

When control features are enabled, Vigilance can dispatch jobs directly from the dashboard. Mark a job with the Dispatchable contract and Vigilance reads the constructor signature via reflection to generate a form:

use Vigilance\Contracts\Dispatchable;

class ProcessPodcast implements ShouldQueue, Dispatchable
{
    public static string $vigilanceLabel = 'Process a podcast';

    public function __construct(public Podcast $podcast, public bool $notify = true) {}
}

The generated form handles scalars, enums, dates, and Eloquent model binding automatically. The same mechanism lets you run allowlisted Artisan commands from the UI. Both features are off by default:

VIGILANCE_CONTROL_ENABLED=true

Custom Metrics and Core Web Vitals

Vigilance also collects application-level data. Use the counter and gauge API from your own code:

use Vigilance\Vigilance;

Vigilance::increment('signups');
Vigilance::gauge('cart_value', $cart->total());

For frontend performance, enable Real User Monitoring (RUM) and add the Blade directive to your layout:

VIGILANCE_RUM=true
@vigilanceRum

This collects Core Web Vitals (LCP, INP, CLS, FCP, TTFB) from real visitors and surfaces p50, p95, and p99 latencies alongside your queue and command timelines.


Installation and Securing the Dashboard

composer require anousss007/vigilance
php artisan vigilance:install
php artisan migrate

The dashboard is local-only until you explicitly authorise access via a callback or Gate:

use Vigilance\Vigilance;

Vigilance::auth(fn ($request) => in_array($request->user()?->email, [
    'you@example.com',
]));

The dashboard is available at /vigilance by default.


Beyond Queue History

Vigilance includes several additional optional features:

  • Issues inbox — fingerprinted exceptions grouped across web requests, jobs, commands, and the browser
  • SLO tracking — error budgets and burn-rate alerts
  • Release health — error rate comparisons before and after a deploy
  • Request and job tracing — per-request waterfalls with N+1 detection
  • Uptime checks — availability and latency monitoring
  • Log explorer — searchable logs correlated to traces
  • Alerting — Slack, Discord, Teams, or webhook
  • Worker supervisor — fills Horizon's role for non-Redis drivers
  • AI agent access — read-only access over an MCP server

Key Takeaways

  • Works with any Laravel queue driver, not just Redis
  • Configurable sample rate keeps storage costs low while retaining all failures
  • Reflection-based dispatch forms reduce the need for manual tooling
  • RUM and custom metrics bring frontend and business data into the same dashboard
  • All sensitive data is redacted before storage
  • MIT-licensed and self-hosted

Source: Laravel News — Monitor Laravel Queues, Commands, and Schedulers on Any Driver with Vigilance

Found this useful?

Frequently Asked Questions

3 questions
Q01 How is Vigilance different from Laravel Horizon and Telescope?
Horizon only monitors Redis-backed queues, and Telescope is designed for local debugging. Vigilance works with any queue driver—database, Redis, SQS, Beanstalkd, and sync—and is built for production use, writing a single record per run updated throughout its lifecycle.
Q02 How does Vigilance handle storage costs on high-throughput queues?
Vigilance samples successful runs at dispatch time using a configurable sample rate (e.g., VIGILANCE_SAMPLE_RATE=0.1 keeps 10% of successes) while always retaining failed runs. You can also point it to a separate database connection and set a retention period for automatic pruning.
Q03 Can Vigilance dispatch jobs and run Artisan commands from the dashboard?
Yes, when VIGILANCE_CONTROL_ENABLED=true is set, Vigilance uses reflection to read a job's constructor signature and generates a typed form for dispatching it. The same mechanism supports running allowlisted Artisan commands from the UI. Both features are off by default.

Continue reading

More Articles

View all