Prometheus Push Gateway client for PHP applications.
Installs: 311 155
Open Issues: 4
- php: ^7.2|^8.0
- guzzlehttp/guzzle: ^6.3|^7.0
- promphp/prometheus_client_php: ^1.0|^2.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.50
- phpstan/phpstan-phpunit: ^0.12.16
- phpstan/phpstan-strict-rules: ^0.12.5
- phpunit/phpunit: ^8.4|^9.4
- squizlabs/php_codesniffer: ^3.5
This package provides an easy PHP API for Prometheus Push Gateway. It was part of promphp/prometheus_client_php and was moved into a seperate package as of Prometheus Client PHP Version 2.0.0.
How does it work?
The PushGateway allows Prometheus to get Metrics from Systems that are not scrableable (Your Prometheus cannot access that systems). With this library you can easily send your metrics to the PushGateway.
Add as Composer dependency:
composer require promphp/prometheus_push_gateway_php
Let's assume you have that simple counter and want to send it to your PushGateway.
\Prometheus\CollectorRegistry::getDefault() ->getOrRegisterCounter('', 'some_quick_counter', 'just a quick measurement') ->inc(); // Now send it to the PushGateway: $pushGateway = new \PrometheusPushGateway\PushGateway('http://192.168.59.100:9091'); $pushGateway->push(\Prometheus\CollectorRegistry::getDefault(), 'my_job', ['instance' => 'foo']);
Also look at the examples.
- PHP ^7.2 | ^8.0
Black box testing
Just start the PushGateway by using docker-compose
Use composer to grab all dependencies
docker run --rm --interactive --tty --volume $PWD:/app composer install
Execute the tests:
docker-compose run phpunit vendor/bin/phpunit tests/Test/