Download the PHP package movemoveapp/laravel-prometheus without Composer
On this page you can find all versions of the php package movemoveapp/laravel-prometheus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download movemoveapp/laravel-prometheus
More information about movemoveapp/laravel-prometheus
Files in movemoveapp/laravel-prometheus
Package laravel-prometheus
Short Description Laravel SDK for working with prometheus metrics
License MIT
Informations about the package laravel-prometheus
Laravel Prometheus Metrics (Fork)
⚠️ This is a friendly fork of shureban/laravel-prometheus,
created to supportpredis/predis ^3.0until the original maintainer has a chance to fix it 😄
All original functionality is preserved.
The package is designed to collect Prometheus metrics from a Laravel application using a Redis-based storage backend.
Installation
Require this package with composer using the following command:
Add the following class to the providers array in config/app.php:
You can also publish the config file to change implementations (ie. interface to specific class).
Update .env config, change REDIS_CLIENT from redis to predis:
Creating metric class
CLI supporting
You may create metrics via CLI commands
| Option | Alias | Required | Description |
|---|---|---|---|
| name | false | Name of the metric | |
| label | false | The metric labels list (comma separated) | |
| description | false | The metric description | |
| dynamic | d | false | The metric description |
Manual
Create folder, where you will contain your custom metrics classes (for example app/Prometheus). Realise constructor
with metric static params.
Usages
General metrics flow
Using DI (or not), increase the metric value.
Or, if you have static list of events, you may realize following flow:
This way helps you encapsulate logic with labels, and the code seems pretty
Dynamic metrics flow
Dynamic flow may help you attach more labels with different sizes
Rendering
Render metrics data in text format
Using config
In config/prometheus.php, find web_route param and set preferred route path. Default is /prometheus/metrics.
Manual
For render metrics by route, you need to provide next code:
of using string type hinting
👋 A note to Shureban
Hey bro, just keeping the package warm for you.
When you're ready — feel free to take back control.
Until then, your code is doing great in the wild.
❤️ Pipisco