Skip to content

Export Laravel Horizon metrics using this Prometheus exporter.

License

Notifications You must be signed in to change notification settings

blueoceanideas/horizon-exporter

 
 

Repository files navigation

Laravel Horizon Prometheus Exporter

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

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, sponsor our work with Github Sponsors. 📦

🚀 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 [email protected] instead of using the issue tracker.

🎉 Credits

About

Export Laravel Horizon metrics using this Prometheus exporter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%