Download the PHP package zlodes/prometheus-client-laravel without Composer
On this page you can find all versions of the php package zlodes/prometheus-client-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zlodes/prometheus-client-laravel
More information about zlodes/prometheus-client-laravel
Files in zlodes/prometheus-client-laravel
Package prometheus-client-laravel
Short Description The Prometheus Metrics client adapter for Laravel Framework
License MIT
Informations about the package prometheus-client-laravel
PHP Prometheus Exporter for Laravel
This is a Laravel adapter/bridge package for zlodes/prometheus-client.
First steps
Installation
Register a route for the metrics controller
Your application is responsible for metrics route registration. There is a controller ready to use. You can configure groups, middleware or prefixes as you want.
Example:
Configure Storage for metrics [optional]
By default, it uses Redis storage. If you want to use other storage, you can do it easily following these three steps:
- Create a class implements
Storage
interface. -
Publish a config:
- Set your
storage
class in the config.
Metrics registration
In your ServiceProvider::register
:
Metrics Collector usage
You can work with your metrics whenever you want. Just use Collector
:
Schedulable collectors
At times, there may be a need to gather metrics on a scheduled basis. The package offers a feature to register a SchedulableCollector that executes every minute using the Laravel Scheduler.
You can define your SchedulableCollectors
using a config or register it in SchedulableCollectorRegistry directly in a ServiceProvider
:
Note For further details, see zlodes/prometheus-client
Available console commands
Command | Description |
---|---|
php artisan metrics:list |
Lists all registered metrics |
php artisan metrics:clear |
Clears metrics storage |
metrics:collect-scheduled |
Runs ScheduledCollectors . Using by Scheduler |
Upgrade guide
From 1.x to 2.x
- Run
php artisan vendor:publish --tag=prometheus-client
to publish a brand-new config - Configure the new config based on the previous one (
prometheus-exporter.php
) - Drop legacy config (
prometheus-exporter.php
)
Testing
Run tests
All versions of prometheus-client-laravel with dependencies
ext-redis Version *
laravel/framework Version ^9.0 || ^10.0 || ^11.0
webmozart/assert Version ^1.11
zlodes/prometheus-client Version ^2.0.0