Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Latest commit

 

History

History
65 lines (48 loc) · 1.24 KB

README.md

File metadata and controls

65 lines (48 loc) · 1.24 KB

Metrix PHP Library

Metrix is a PHP library that provides a simple interface for sending metric data to a number of services. Currently Metrix supports StatsD and Librato.

Build Status

Configuration

Librato:

$client = new Metrix();
$client->config(array(
    'backend' => 'librato',
    'opts' => array(
      'email' => '[email protected]',
      'token' => '123'
    )
));

StatsD:

$client = new Metrix();
$client->config(array(
    'backend' => 'statsd',
    'opts' => array(
      'host' => '127.0.0.1', // defaults to this
      'port' => '8125' // defaults to this
    )
));

Counters

$client->increment('key', 10);
$client->increment(array('key1', 'key2', ...));
$client->increment(array(
  'key' => 1
));

$client->decrement('key', 10);
...

Gauges

$client->gauge('cputemp', 55);

Other Options

Custom key prefixes (prefix_delimeter defaults to '.'):

$client->config(array('
  'prefix' => 'foo',
  'prefix_delimeter' => ':',
  ...
));

TODO

  • Specify source for Metrics