This is an extremely simple PHP statsd client and CI spark.
- With Sparks -
$ php tools/spark install statsd
- Without Sparks - Clone repository at github.com/seejohnrun/php-statsd
- With Sparks -
$this->load->spark('statsd');
- Without Sparks -
require './libraries/statsd.php';
To count things:
$numPoints = getNumberOfPoints();
Stats::counting('numpoints', $numPoints);
Record timings:
$timing = getTiming();
Stats::timing('timething', $timing);
And a convenience mechanism for timing:
Stats::time_this('timething', function() {
sleep(1);
});
Stats::setHost('localhost'); // default localhost
Stats::setPort(7000); // default 8125
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);
- John Crepezzi - [email protected]
MIT License. See attached LICENSE