2017 © Pedro Peláez
 

library php-statsd

Sends stats to Statsd.

image

infratools/php-statsd

Sends stats to Statsd.

  • Thursday, November 2, 2017
  • by picahielos
  • Repository
  • 12 Watchers
  • 2 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

php-statsd

Simple PHP library to send stats to statsd., (*1)

Installation

Add the dependency to your composer.json., (*2)

{
    "require": {
        "shazam/php-statsd": "2.*"
    }
}

Usage

An example of how to send metrics of how long it takes to load a page., (*3)

<?php

use Statsd;

// $config = array(...);
// $path = ...

// initialize client
$configuration = new Statsd\Client\Configuration();
$configuration->setHost($config['host'])
    ->setNamespace($config['namespace']);

$statsClient = new Statsd\Client($configuration);

// add stats (you can also add an array of stats with addStats())
$statsClient->addStat(
    array(
        'namespace' => 'endpoints.' . $path, // that will be your stat namespace
        'value' => $executionTime, // calculate it in microseconds
        'type' => 'ms'
    )
);

// send them
$statsClient->sendStats();

You can use TIME_MS, COUNT, GAUGE or SET (ms, c, g, s) as type of stats., (*4)

Configuration

  • A host to push metrics (use 127.0.0.1 if you have netpipes installed in your box).
  • A port (by default, 8126).
  • A namespace (where all your metrics will be added. Use "." to separate folders.
  • Optionally, a Monolog\Logger object, to log the metrics.

An example of a config file for that client could be:, (*5)

stats:
  enable: true
  client:
    host: 127.0.0.1
    namespace: shazam.twitterhose

The Versions

02/11 2017

dev-master

9999999-dev

Sends stats to Statsd.

  Sources   Download

Apache-2.0

by Toni Lopez

statsd

22/04 2015

3.0.1

3.0.1.0

Sends stats to Statsd.

  Sources   Download

Apache-2.0

by Toni Lopez

statsd

31/03 2015

2.0.2

2.0.2.0

Sends stats to Statsd.

  Sources   Download

Apache-2.0

by Toni Lopez

statsd

31/03 2015

2.0.1

2.0.1.0

Sends stats to Statsd.

  Sources   Download

by Toni Lopez

statsd

26/02 2015

1.0.9

1.0.9.0

Sends stats to Statsd.

  Sources   Download

by Toni Lopez

statsd

26/03 2014

1.0.8

1.0.8.0

Sends stats to Statsd.

  Sources   Download

by Toni Lopez

statsd

26/03 2014

1.0.7

1.0.7.0

Sends stats to Statsd.

  Sources   Download

by Toni Lopez

statsd

26/03 2014

1.0.6

1.0.6.0

Sends stats to Statsd.

  Sources   Download

by Toni Lopez

statsd

26/03 2014

1.0.5

1.0.5.0

Sends stats to Statsd.

  Sources   Download

by Toni Lopez

statsd

25/03 2014

1.0.4

1.0.4.0

Sends metrics to Graphite.

  Sources   Download

by Toni Lopez

statsd

25/03 2014

1.0.3

1.0.3.0

Sends metrics to Graphite.

  Sources   Download

by Toni Lopez

statsd

25/03 2014

1.0.1

1.0.1.0

Sends metrics to Graphite.

  Sources   Download

by Toni Lopez

24/03 2014

1.0.0

1.0.0.0

Sends metrics to Graphite.

  Sources   Download

by Toni Lopez