2017 © Pedro Peláez
 

librairie metric

Provide base class to collect and store metric

image

ekino/metric

Provide base class to collect and store metric

  • Friday, February 22, 2013
  • by ekino
  • Repository
  • 10 Watchers
  • 32 Stars
  • 18 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Ekino PHP Metric

Build Status, (*1)

This library provides base classes to collect and publish metrics., (*2)

Metric Reporters :, (*3)

  • CollectD
  • StatsD
  • NewRelic
  • XHGui

Metric Collectors :, (*4)

  • Doctrine
  • Xhprof
  • Timer
  • Memory Usage

Installation

Using Composer

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

Usage with CollectD

<?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();

The Versions

22/02 2013

dev-master

9999999-dev https://github.com/ekino/php-metric

Provide base class to collect and store metric

  Sources   Download

MIT

The Requires

 

The Development Requires

debug performance newrelic monitoring metric xhprof new relic