2017 © Pedro Peláez
 

library statsd

a PHP client for statsd

image

domnikl/statsd

a PHP client for statsd

  • Tuesday, July 10, 2018
  • by domnikl
  • Repository
  • 14 Watchers
  • 263 Stars
  • 1,581,560 Installations
  • PHP
  • 16 Dependents
  • 1 Suggesters
  • 53 Forks
  • 1 Open issues
  • 27 Versions
  • 8 % Grown

The README.md

statsd-php

⚠️ This repo is abandoned and will no longer be maintained. Please use slickdeals/statsd instead., (*1)

A PHP client library for the statistics daemon (statsd) intended to send metrics from PHP applications., (*2)

Build Status Donate, (*3)

Installation

The best way to install statsd-php is to use Composer and add the following to your project's composer.json file:, (*4)

{
    "require": {
        "domnikl/statsd": "~3.0"
    }
}

Usage

<?php
$connection = new \Domnikl\Statsd\Connection\UdpSocket('localhost', 8125);
$statsd = new \Domnikl\Statsd\Client($connection, "test.namespace");

// the global namespace is prepended to every key (optional)
$statsd->setNamespace("test");

// simple counts
$statsd->increment("foo.bar");
$statsd->decrement("foo.bar");
$statsd->count("foo.bar", 1000);

When establishing the connection to statsd and sending metrics, errors will be suppressed to prevent your application from crashing., (*5)

If you run statsd in TCP mode, there is also a \Domnikl\Statsd\Connection\TcpSocket adapter that works like the UdpSocket except that it throws a \Domnikl\Statsd\Connection\TcpSocketException if no connection could be established. Please consider that unlike UDP, TCP is used for reliable networks and therefor exceptions (and errors) will not be suppressed in TCP mode., (*6)

Timings

<?php
// timings
$statsd->timing("foo.bar", 320);
$statsd->time("foo.bar.bla", function() {
    // code to be measured goes here ...
});

// more complex timings can be handled with startTiming() and endTiming()
$statsd->startTiming("foo.bar");
// more complex code here ...
$statsd->endTiming("foo.bar");

Memory profiling

<?php
// memory profiling
$statsd->startMemoryProfile('memory.foo');
// some complex code goes here ...
$statsd->endMemoryProfile('memory.foo');

// report peak usage
$statsd->memory('foo.memory_peak_usage');

Gauges

statsd supports gauges, arbitrary values which can be recorded., (*7)

This method accepts both absolute (3) and delta (+11) values., (*8)

NOTE: Negative values are treated as delta values, not absolute., (*9)

<?php
// Absolute value
$statsd->gauge('foobar', 3);

// Pass delta values as a string. 
// Accepts both positive (+11) and negative (-4) delta values.
$statsd->gauge('foobar', '+11'); 

Sets

statsd supports sets, so you can view the uniqueness of a given value., (*10)

<?php
$statsd->set('userId', 1234);

disabling sending of metrics

To disable sending any metrics to the statsd server, you can use the Domnikl\Statsd\Connection\Blackhole connection 
class instead of the default socket abstraction. This may be incredibly useful for feature flags. Another options is to use Domnikl\Statsd\Connection\InMemory connection class, that will collect your messages but won't actually send them., (*11)

Authors

Original author: Dominik Liebler liebler.dominik@gmail.com Several other contributors - Thank you!, (*12)

The Versions

10/07 2018

dev-master

9999999-dev https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

10/07 2018

2.9.1

2.9.1.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

29/04 2018

2.9.0

2.9.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

29/04 2018

2.8.0

2.8.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

29/04 2018

2.7.0

2.7.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

04/04 2018

2.6.1

2.6.1.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

30/07 2017

2.6.0

2.6.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

10/04 2017

2.5.0

2.5.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.6.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

06/07 2016

2.4.1

2.4.1.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

23/04 2016

2.4.0

2.4.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

24/01 2016

2.3.0

2.3.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

29/10 2015

2.2.0

2.2.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

14/04 2015

2.1.4

2.1.4.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

07/04 2015

2.1.3

2.1.3.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

10/02 2015

2.1.2

2.1.2.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

10/02 2015

1.1.x-dev

1.1.9999999.9999999-dev https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statsd monitoring

10/02 2015

1.1.3

1.1.3.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statsd monitoring

10/02 2015

1.1.2

1.1.2.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statsd monitoring

10/02 2015

2.1.1

2.1.1.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

08/01 2015

2.1.0

2.1.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

09/12 2014

2.0.1

2.0.1.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

06/12 2014

2.0.0

2.0.0.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

The Development Requires

by Dominik Liebler

statistics metrics statsd monitoring udp

01/12 2014

1.1.1

1.1.1.0 https://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statsd monitoring

16/08 2014

1.1.0

1.1.0.0 http://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

The Development Requires

by Dominik Liebler

statsd monitoring

21/01 2014

1.0.2

1.0.2.0 http://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

by Dominik Liebler

statsd monitoring

16/08 2013

1.0.1

1.0.1.0 http://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

by Dominik Liebler

statsd monitoring

25/01 2013

1.0.0

1.0.0.0 http://domnikl.github.com/statsd-php

a PHP client for statsd

  Sources   Download

MIT

The Requires

  • php >= 5.3.0

 

by Dominik Liebler

statsd monitoring