2017 © Pedro Peláez
 

library statsd-php-client

Statsd (Object Oriented) client library for PHP

image

liuggio/statsd-php-client

Statsd (Object Oriented) client library for PHP

  • Friday, June 10, 2016
  • by liuggio
  • Repository
  • 11 Watchers
  • 107 Stars
  • 970,933 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 27 Forks
  • 6 Open issues
  • 28 Versions
  • 6 % Grown

The README.md

statsd-php-client

Build Status Latest Stable Version Total Downloads, (*1)

statsd-php-client is an Open Source, and Object Oriented Client for etsy/statsd written in php, (*2)

Install with composer

composer require liuggio/statsd-php-client

Simple Usage

$statsd = new StatsdService();

$service->timing('usageTime', 100);
$service->increment('visitor');
$service->decrement('click');
$service->gauge('gaugor', 333);
$service->set('uniques', 765);

$service->flush();

Why use this library instead the statsd/php-example?

  • You are wise., (*3)

  • You could also use monolog to redirect data to statsd, (*4)

  • This library is tested., (*5)

  • This library optimizes the messages to send, compressing multiple messages in individual UDP packets., (*6)

  • This library pays attention to the maximum length of the UDP., (*7)

  • This library is made by Objects not array, but it also accepts array., (*8)

  • You do want to debug the packets, and using SysLogSender the packets will be logged in your syslog log (on debian-like distro: tail -f /var/log/syslog), (*9)

Advanced Instantiation

use Liuggio\StatsdClient\StatsdClient,
    Liuggio\StatsdClient\Factory\StatsdDataFactory,
    Liuggio\StatsdClient\Sender\SocketSender,
    Liuggio\StatsdClient\Service\StatsdService;
// use Liuggio\StatsdClient\Sender\SysLogSender;

$sender = new SocketSender(/*'localhost', 8126, 'udp'*/);
// $sender = new SysLogSender(); // enabling this, the packet will not send over the socket

$client  = new StatsdClient($sender);
$factory = new StatsdDataFactory('\Liuggio\StatsdClient\Entity\StatsdData');
$service = new StatsdService($client, $factory);

// create the metrics with the service
$service->timing('usageTime', 100);

//...

// send the data to statsd
$service->flush();

Usage with Monolog

use Liuggio\StatsdClient\StatsdClient,
    Liuggio\StatsdClient\Factory\StatsdDataFactory,
    Liuggio\StatsdClient\Sender\SocketSender;
// use Liuggio\StatsdClient\Sender\SysLogSender;

use Monolog\Logger;
use Liuggio\StatsdClient\Monolog\Handler\StatsDHandler;

$sender = new SocketSender(/*'localhost', 8126, 'udp'*/);
// $sender = new SysLogSender(); // enabling this, the packet will not send over the socket
$client = new StatsdClient($sender);
$factory = new StatsdDataFactory();

$logger = new Logger('my_logger');
$logger->pushHandler(new StatsDHandler($client, $factory, 'prefix', Logger::DEBUG));

$logger->addInfo('My logger is now ready');

the output will be: prefix.my_logger.INFO.My-logger:1|c" 36 Bytes, (*10)

Short Theory

Easily Install StatSD and Graphite

In order to try this application monitor you have to install etsy/statsd and Graphite, (*11)

see this blog post to install it with vagrant Easy install statsd graphite., (*12)

StatsD

StatsD is a simple daemon for easy stats aggregation, (*13)

Graphite

Graphite is a Scalable Realtime Graphing, (*14)

The Client sends data with UDP (faster)

https://www.google.com/search?q=tcp+vs+udp, (*15)

Contribution

Active contribution and patches are very welcome. To keep things in shape we have quite a bunch of unit tests. If you're submitting pull requests please make sure that they are still passing and if you add functionality please take a look at the coverage as well it should be pretty high :), (*16)

  • First fork or clone the repository
git clone git://github.com/liuggio/statsd-php-client.git
cd statsd-php-client
  • Install vendors:

``` bash composer.phar install, (*17)


- This will give you proper results: ``` bash phpunit --coverage-html reports

Core developers:

This project is actively maintained by David Moreau AKA @dav-m85 and @liuggio, (*18)

The Versions

10/06 2016

dev-master

9999999-dev https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

24/07 2015

v1.0.18

1.0.18.0 https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

24/07 2015

dev-simplifing

dev-simplifing https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

24/07 2015

dev-no_interface

dev-no_interface https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

23/07 2015

dev-travis_legacy

dev-travis_legacy https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

27/04 2015

v1.0.16

1.0.16.0 https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

22/04 2015

dev-feature/prefix_suffix

dev-feature/prefix_suffix https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

22/04 2015

v1.0.15

1.0.15.0 https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

01/04 2015

v1.0.14

1.0.14.0 https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

19/03 2015

dev-liuggio-patch-socket

dev-liuggio-patch-socket https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

13/03 2015

v1.0.13

1.0.13.0 https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

17/09 2014

v1.0.12

1.0.12.0 https://github.com/liuggio/statsd-php-client/

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

by Giulio De Donato

php statsd etsy monitoring

18/12 2013

2.0.x-dev

2.0.9999999.9999999-dev http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

php statsd etsy monitoring

18/12 2013

dev-better_algo

dev-better_algo http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

php statsd etsy monitoring

18/12 2013

dev-ad

dev-ad http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

php statsd etsy monitoring

19/11 2013

dev-fix_v1

dev-fix_v1 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

php statsd etsy monitoring

02/11 2013

v1.0.11

1.0.11.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

php statsd etsy monitoring

11/10 2013

v1.0.10

1.0.10.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

php statsd etsy monitoring

19/04 2013

v1.0.9

1.0.9.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

php statsd etsy monitoring

27/03 2013

v1.0.8

1.0.8.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

26/03 2013

v1.0.7

1.0.7.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

24/03 2013

v1.0.6

1.0.6.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

10/02 2013

v1.0.4

1.0.4.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

05/11 2012

v1.0.0

1.0.0.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

05/11 2012

v1.0.2

1.0.2.0 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

02/11 2012

v1.0.0-RC3

1.0.0.0-RC3 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

31/10 2012

v1.0.0-RC2

1.0.0.0-RC2 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring

31/10 2012

v1.0.0-RC1

1.0.0.0-RC1 http://github.com/liuggio/statsd-client

Statsd (Object Oriented) client library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2

 

php statsd etsy monitoring