Skip to content

FarrukhNaeem/php-statsd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP StatsD Client

This is an extremely simple PHP StatsD client for caremerge built on top of php-statsd and php-datadogstatsd

Requires PHP >= 5.3.0.

Installation

Composer

Use the composer.json file

composer install

Note: The first version shipped in composer is 0.0.3

Or manually

Clone repository at github.com/FarrukhNaeem/php-statsd

Setup: require './src/CareStats.php';

Usage

instantiation

To instantiate a DogStatsd object using composer:

require __DIR__ . '/vendor/autoload.php';

use StatsDC\CareStats;

$statsd = new CareStats();

CareStats constructor, takes a configuration array. The configuration can take any of the following values (all optional):

  • host: the host of your Statsd server, default to localhost
  • port: the port of your Statsd server. default to 8125

Tags

The 'tags' argument can be a array or a string. Value can be set to null.

Increment

To increment things:

$statsd->increment('your.data.point');
$statsd->increment('your.data.point', .5);

Decrement

To decrement things:

$statsd->decrement('your.data.point');

Timing

To time things:

$start_time = microtime(true);
run_function();
$statsd->microtiming('your.data.point', microtime(true) - $start_time);

$statsd->microtiming('your.data.point', microtime(true) - $start_time, 1, array('tagname' => 'value'));

About

A PHP client for DogStatsd

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%