renoki-co/horizon-exporter

Export Laravel Horizon metrics using this Prometheus exporter.

1.1.0 2021-09-28 12:11 UTC

This package is auto-updated.

Last update: 2021-10-18 11:55:25 UTC


README

CI codecov StyleCI Latest Stable Version Total Downloads Monthly Downloads License

Export Laravel Horizon metrics using this Prometheus exporter. This package leverages Exporter Contracts.

🤝 Supporting

68747470733a2f2f6769746875622d636f6e74656e742e73332e66722d7061722e7363772e636c6f75642f7374617469632f32392e6a7067

If you are using one or more Renoki Co. open-source packages in your production apps, in presentation demos, hobby projects, school projects or so, spread some kind words about our work or sponsor our work via Patreon. 📦

68747470733a2f2f63352e70617472656f6e2e636f6d2f65787465726e616c2f6c6f676f2f6265636f6d655f615f706174726f6e5f627574746f6e2e706e67

🚀 Installation

You can install the package via composer:

composer require renoki-co/horizon-exporter

Publish the config:

$ php artisan vendor:publish --provider="RenokiCo\HorizonExporter\HorizonExporterServiceProvider" --tag="config"
$ php artisan vendor:publish --provider="RenokiCo\LaravelExporter\LaravelExporterServiceProvider" --tag="config"

🙌 Usage

This package is pretty straightforward. Upon installing it, it will register the route at /exporter/group/horizon-metrics and you can point Prometheus towards it for scraping.

Please keep in mind that the metrics are not calculated by-process, but as a whole across all supervisors. Point your Prometheus scraper to one of the instances for horizontally-scaled environments.

# HELP laravel_horizon_master_status That status of the Master Horizon process. 0 = inactive, 1 = paused, 2 = running.
# TYPE laravel_horizon_master_status gauge
laravel_horizon_master_status{name="master-1",pid="10082"} 2

# HELP laravel_horizon_queue_runtime Get total jobs runtime by queue.
# TYPE laravel_horizon_queue_runtime gauge
laravel_horizon_queue_runtime{queue="default"} 41.085

# HELP laravel_horizon_queue_throughput Get total jobs throughput by queue.
# TYPE laravel_horizon_queue_throughput gauge
laravel_horizon_queue_throughput{queue="default"} 4

# HELP laravel_horizon_job_runtime Get total workload runtime by job name.
# TYPE laravel_horizon_job_runtime gauge
laravel_horizon_job_runtime{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob"} 53.666666666667
laravel_horizon_job_runtime{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob2"} 3.34

# HELP laravel_horizon_job_throughput Get total workload throughput by job name.
# TYPE laravel_horizon_job_throughput gauge
laravel_horizon_job_throughput{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob"} 3
laravel_horizon_job_throughput{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob2"} 1

# HELP laravel_horizon_jobs_by_type Get total processed jobs into all queues by specific type (i.e. completed, pending, etc.).
# TYPE laravel_horizon_jobs_by_type gauge
laravel_horizon_jobs_by_type{type="completed"} 4
laravel_horizon_jobs_by_type{type="failed"} 1
laravel_horizon_jobs_by_type{type="pending"} 1
laravel_horizon_jobs_by_type{type="recent"} 6
laravel_horizon_jobs_by_type{type="recent_failed"} 1

# HELP php_info Information about the PHP environment.
# TYPE php_info gauge
php_info{version="8.0.10"} 1

🐛 Testing

vendor/bin/phpunit

🤝 Contributing

Please see CONTRIBUTING for details.

🔒 Security

If you discover any security related issues, please email alex@renoki.org instead of using the issue tracker.

🎉 Credits