dev-master
9999999-dev https://github.com/ekino/php-metricProvide base class to collect and store metric
MIT
The Requires
The Development Requires
debug performance newrelic monitoring metric xhprof new relic
Provide base class to collect and store metric
This library provides base classes to collect and publish metrics., (*2)
Metric Reporters :, (*3)
Metric Collectors :, (*4)
Use composer.phar
:, (*5)
$ php composer.phar require ekino/metric
You just have to specify the version you want : master-dev
.
It will add the package in your composer.json
file and install it., (*6)
Or you can do it by yourself, first, add the following to your composer.json
file:, (*7)
// composer.json { // ... require: { // ... "ekino/metric": "dev-master" } }
Then, you can install the new dependencies by running Composer's update
command from the directory where your composer.json
file is located:, (*8)
$ php composer.phar update ekino/php-metric
<?php // initialize a reporter $collectd = new Ekino\Metric\Reporter\CollectDReporter('web1-php', new Ekino\Metric\Writer\UdpWriter('localhost', 25826)); // initialize the metric manager $manager = new Ekino\Metric\MetricManager($collectd); // store the current memory usage $collector = new Ekino\Metric\Collector\MemoryUsageCollector('memory.usage.', true); $manager->addMetric($collector->get()); // store execution time of one callback function $heavy = function() { sleep(1); }; $collector = new Ekino\Metric\Collector\TimerFunctionCollector('php.function.heavy', $heavy); $collector->run(); $manager->addMetric($collector->get()); // send metric to the reporter $manager->flush();
Provide base class to collect and store metric
MIT
debug performance newrelic monitoring metric xhprof new relic