This library provides base classes to collect and publish metrics.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 4 commits behind ekino:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Ekino PHP Metric

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