This package is abandoned and no longer maintained. No replacement package was suggested.

Provide base class to collect and store metric

dev-master 2013-02-22 14:21 UTC

This package is auto-updated.

Last update: 2024-02-25 21:56:21 UTC


Build Status

This library provides base classes to collect and publish metrics.

Metric Reporters :

  • CollectD
  • StatsD
  • NewRelic
  • XHGui

Metric Collectors :

  • Doctrine
  • Xhprof
  • Timer
  • Memory Usage


Using Composer

Use composer.phar:

$ 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.

Or you can do it by yourself, first, add the following to your composer.json file:

// 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:

$ php composer.phar update ekino/php-metric

Usage with CollectD


// 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);

// store execution time of one callback function
$heavy = function() { sleep(1); };
$collector = new Ekino\Metric\Collector\TimerFunctionCollector('php.function.heavy', $heavy);


// send metric to the reporter