spatie/laravel-prometheus
Export Laravel app metrics to Prometheus via a /prometheus endpoint. Register custom gauges/counters with simple callbacks, use built-in queue and Horizon metrics, and optionally secure the endpoint. Ideal for scraping by Prometheus and charting in Grafana.
This packages make it easy to export the key metrics of your Laravel application with Prometheus. Typically, you would use this package in combination with Prometheus / Grafana to monitor the health of your application.
Exporting data to Prometheus is very straightforward.
// typically in a service provider
use \Spatie\Prometheus\Facades\Prometheus;
Prometheus::addGauge('Number of users')
->value(fn() => User::count());
This will expose a metric named Number of users with the current number of users as value. By default, the metric will be exposed on the /prometheus endpoint.
Additionally, this package can export Horizon metrics, so you can easily build a graph that shows the number of jobs in the queue.
// TODO insert screenshot
How can I help you explore Laravel packages today?