krenor / prometheus-client
A PHP Client for Prometheus
Installs: 18 140
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ^7.2
- ext-json: *
- guzzlehttp/guzzle: ^6.3
- tightenco/collect: ^6.0
Requires (Dev)
- ext-apcu: *
- ext-memcached: *
- ext-redis: *
- codedungeon/phpunit-result-printer: ^0.26.2
- mockery/mockery: ^1.2
- phpunit/phpunit: ^8.3
- predis/predis: ^1.1
Suggests
- ext-apcu: Required to use the APCu storage.
- ext-memcached: Required to use the Memcached storage.
- ext-redis: Required to use the Redis storage with a native client.
- predis/predis: Required to use the Redis storage with the predis client.
This package is auto-updated.
Last update: 2024-10-29 05:22:34 UTC
README
Monitor your PHP applications using Prometheus.
Features
- Support for Counters, Gauges, Histograms, Summaries and custom metrics
- Various storage repositories
- Easy usage in style of Laravels Eloquent ORM
- Initialization of Metrics without labels
- Support of float values
- Push Gateway
- State exporters (for
fpm_get_status()
oropcache_get_status()
)
Planned features
- PHP 7.4 rewrite
- Laravel integration
Project State
This library is currently under development.
As long as it's not tagged in a >= 1.* version I could commit incompatible changes!
Quickstart
<?php use Krenor\Prometheus\Metrics\Metric; use Krenor\Prometheus\Metrics\Counter; use Krenor\Prometheus\CollectorRegistry; use Krenor\Prometheus\Renderer\TextRenderer; use Krenor\Prometheus\Storage\StorageManager; use Krenor\Prometheus\Storage\Repositories\InMemoryRepository; use Krenor\Prometheus\Tests\Stubs\MultipleLabelsCounterStub as ExampleCounter; Metric::storeUsing(new StorageManager(new InMemoryRepository)); $registry = new CollectorRegistry; $counter = $registry->register(new ExampleCounter); $counter->increment(['some', 'label', 'values']); $counter->incrementBy(3, ['foo', 'bar', 'baz']); $samples = $registry->collect(); $metrics = (new TextRenderer)->render($samples);
A more detailed documentation can be found here.
Note: Since this project is in the works, some parts may lack documentation.
You can orient yourself on the tests if something's unclear.
Contributing
Please see CONTRIBUTING for more information.
Licence
The MIT License. Please see LICENSE for more information.