Skip to content

stacyhorton/php-datadogstatsd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

PHP StatsD Client

This is an extremely simple PHP statsd client and CI spark.

Installation

  1. With Sparks - $ php tools/spark install statsd
  2. Without Sparks - Clone repository at github.com/seejohnrun/php-statsd

Setup

  1. With Sparks - $this->load->spark('statsd');
  2. Without Sparks - require './libraries/statsd.php';

Usage

Counting

To count things:

$numPoints = getNumberOfPoints();
Stats::counting('numpoints', $numPoints);

Timing

Record timings:

$timing = getTiming();
Stats::timing('timething', $timing);

Time Block

And a convenience mechanism for timing:

Stats::time_this('timething', function() {
    sleep(1);
});

Configuration

Host and Port

Stats::setHost('localhost'); // default localhost
Stats::setPort(7000); // default 8125

Sample Rate

Any of the methods descriped in the usage section can take an optional third argument $rate, which is the sample rate:

Stats::counting('numpoints', 123, 0.1);

Author

License

MIT License. See attached LICENSE

About

simple datadogstatsd library

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%