PHP code example of pmg / metrics
1. Go to this page and download the library: Download pmg/metrics library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pmg / metrics example snippets
use PMG\Metrics\Metrics;
use PMG\Metrics\Gauge;
$collector = Metrics::collector();
// track `someName` with a count gauge with a value of 10
$collector->gauge('someName', Gauge::count(10));
// Same as the above but tag `someName` with dimensions
$collector->gauge(
Metrics::name('someName')->dimension('example', '1'),
Gauge::count(10)
);
/* @var Reporter $reporter **/
$reporter->reportOn($collector->flush());
// $collector is now empty and ready to go