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.
To receive metrics from your applications using Prometheus, and visualize them using Grafana, you can use a docker image that is deployed on your server.
Here are the general steps to set up Prometheus and Grafana via Laravel Forge. This isn't meant as a full guide, but rather as a starting point for you to get started.
/etc/prometheus/prometheus.yml and add a new job to scrape metrics from your application. For example:scrape_configs:
- job_name: laravel
scrape_interval: 10s
metrics_path: /prometheus
static_configs:
- targets: ['your-laravel-app.com']
This configuration tells Prometheus to scrape metrics from your application every 10 seconds and store them in its database.
Name: Prometheus Type: Prometheus URL: http://localhost:9090
This configuration tells Grafana to connect to Prometheus at http://localhost:9090.
That's it! You should now have Prometheus and Grafana set up to monitor your application's metrics.
How can I help you explore Laravel packages today?