- What does srwiez/queue-size-health-check do?
- It is a Laravel package that adds a queue size check to spatie/laravel-health. The check inspects a queue and reports how many jobs are waiting, failing the health check when that number crosses a threshold you define. Because it plugs into laravel-health, queue backlogs show up in the same dashboard and alert channels as your other health checks.
- How do I install srwiez/queue-size-health-check?
- Install it with Composer using composer require srwiez/queue-size-health-check. The package is a standard Laravel package, so its service provider is picked up by auto-discovery and you normally do not need to register anything manually. After that, publish or edit the configuration if the README instructs you to, then register the check with spatie/laravel-health.
- How do I register the queue size check with spatie/laravel-health?
- You add the package's check class to the checks list in your laravel-health configuration, passing the queue name and maximum size you want to allow. Once registered, it runs whenever your health checks run, whether that is through the health command scheduled in the console kernel or an on-demand health endpoint. The exact class name and constructor arguments are shown in the package README.
- How do I configure which queue and threshold are checked?
- The check is configured per instance: you tell it which queue, and optionally which connection, to inspect and the maximum number of pending jobs that still counts as healthy. Anything above that limit is reported as a failure so laravel-health can notify you. Set the threshold based on your workers' throughput and the queue latency you are willing to accept, and see the README for the exact option names.
- Which Laravel and PHP versions does this package support?
- The authoritative answer is in the package's composer.json and README, which list the required PHP version and the Laravel and spatie/laravel-health version constraints. Check those constraints before installing, especially on older Laravel applications. If you are on an unsupported version, Composer will refuse the install or resolve an older tagged release.
- Can I monitor more than one queue or connection?
- Yes. Because the check takes its queue and connection as configuration, you can register several instances with different names and thresholds in your health configuration. That lets you apply a tight limit to a critical queue and a looser one to a bulk or low-priority queue, and each will report separately in the dashboard.
- How do I test the queue size health check in my application?
- In a feature test, push a known number of jobs onto a test queue using the database or sync driver, then run the check and assert the result object it returns. spatie/laravel-health also ships testing helpers that let you fake health results and assert what the dashboard would display, which you can combine with the check's own pass or fail result. Keep the queue empty between tests so counts stay predictable.
- Is the queue size check safe to run in production?
- The check performs a count against your queue backend, which for Redis or database queues is usually cheap, but a COUNT on a very large jobs table can take measurable time. Schedule it on a sensible interval, such as every few minutes alongside your other health checks, rather than on every web request. Also make sure the connection used by the check has permission to read the queue storage.
- Do I need spatie/laravel-health to use this package?
- Yes, it is built as a check for spatie/laravel-health, so that package is a dependency and provides the dashboard, scheduling, and notification plumbing. The package itself focuses on counting queue jobs and comparing them to your threshold. If you are not using laravel-health, Laravel's built-in queue:monitor command or Horizon may be a simpler fit.
- How does this compare to Laravel's queue:monitor or Horizon?
- Laravel's queue:monitor command and the Horizon dashboard already expose queue size, so the value here is consolidation: queue backlogs trigger the same laravel-health notifications as your database, cache, and disk checks. That is useful if you already standardise alerting on spatie/laravel-health. As with any small package, check the repository's recent commits, releases, and open issues to confirm it is actively maintained before adopting it.