jtl / go-prometrics-client
PHP-Client to use the JTL GoPrometrics Service
Installs: 12 385
Dependents: 1
Suggesters: 1
Security: 0
Stars: 0
Watchers: 6
Forks: 0
Open Issues: 5
Type:jtl-library
Requires
- php: ^8.0
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^7.2
- jtl/php-generic-collection: ^0.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v2.19
- infection/infection: ^0.26.2
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.9
Suggests
- guzzlehttp/guzzle: Required to interact with GoProm
- jtl/php-generic-collection: Required for TagList
- dev-master
- 2.0.2
- 2.0.1
- 2.0.0
- 1.2.0
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- dev-dependabot/composer/phpstan/phpstan-1.9.17
- dev-dependabot/composer/phpstan/phpstan-1.9.16
- dev-dependabot/composer/phpunit/phpunit-9.6.3
- dev-dependabot/composer/friendsofphp/php-cs-fixer-3.14.3
- dev-dependabot/composer/vimeo/psalm-5.6.0
- dev-dependabot/composer/phpstan/phpstan-1.9.14
- dev-dependabot/composer/guzzlehttp/guzzle-7.5.0
- dev-404_on_observe
- dev-EA-4298
- dev-composer_allow_plugins
- dev-php81-compatibility
- dev-EA-4270
- dev-feature/client_interfaces_and_dummies
- dev-feature/client_interfaces_and_dummies_php_8
This package is auto-updated.
Last update: 2023-02-09 04:02:07 UTC
README
Usage
This library use semantic visioning. You can use composer to install jtl/go-prometrics-client
in your project.
Counter
//simple counter $counter = new Counter(new Client(), "http://127.0.0.1:9111"); $counter->counter('BEER', 'BITBURGER'); //counter with labels $labelList = new LabelList(); $labelList->add(new Label('type', 'Pils')); $labelList->add(new Label('alc', '4.8')); $counter = new Counter(new Client(), "http://127.0.0.1:9111"); $counter->counter('BEER', 'BITBURGER', $labelList); //counter with labels and help text $counter->counter('BEER', 'BITBURGER', $labelList, 'It could help');
Histogram
//simple histogramm $bucketList = [0.1, 0.5, 1.0, 5.0]; $histogram = new Histogram(new Client(), "http://127.0.0.1:9111"); $histogram->observe('BEER', 'BITBURGER', 0.33, $bucketList); //histogramm with labels $labelList = new LabelList(); $labelList->add(new Label('type', 'Pils')); $labelList->add(new Label('alc', '4.8')); $histogram = new Histogram(new Client(), "http://127.0.0.1:9111"); $histogram->observe('BEER', 'BITBURGER', 0.33, $bucketList , $labelList); //histogramm with labels and help text $histogram->observe('BEER', 'BITBURGER', 0.33, $bucketList, $labelList, 'It could help');
Gauge
//simple gauge $gauge = new Gauge(new Client(), "http://127.0.0.1:9111"); $gauge->inc('BEER', 'BITBURGER'); // Increase by one $gauge->dec('BEER', 'BITBURGER'); // Decrease by one $gauge->set('BEER', 'BITBURGER', 3); // Set value to three $gauge->incBy('BEER', 'BITBURGER', 3); // Increase by three $gauge->decBy('BEER', 'BITBURGER', 3); // Decrease by three //gauge with labels $labelList = new LabelList(); $labelList->add(new Label('type', 'Pils')); $labelList->add(new Label('alc', '4.8')); $gauge = new Gauge(new Client(), "http://127.0.0.1:9111"); $gauge->inc('BEER', 'BITBURGER', $labelList); $gauge->dec('BEER', 'BITBURGER', $labelList); $gauge->set('BEER', 'BITBURGER', 3, $labelList); $gauge->incBy('BEER', 'BITBURGER', 2, $labelList); $gauge->decBy('BEER', 'BITBURGER', 2, $labelList); //gauge with labels and help text $gauge->inc('BEER', 'BITBURGER', $labelList, 'It could help'); $gauge->dec('BEER', 'BITBURGER', $labelList, 'It could help'); $gauge->set('BEER', 'BITBURGER', 3, $labelList, 'It could help'); $gauge->incBy('BEER', 'BITBURGER', 3, $labelList, 'It could help'); $gauge->decBy('BEER', 'BITBURGER', 3, $labelList, 'It could help');