Download the PHP package vend/statsd without Composer
On this page you can find all versions of the php package vend/statsd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package statsd
Short Description Simple extensible StatsD client library for PHP 5.5+
License MIT
Homepage https://github.com/vend/statsd/
Informations about the package statsd
vend/statsd
Simple extensible StatsD client for PHP 5.5+
Features
- Correctly splits large numbers of metrics across multiple datagrams
- Can substitute out the underlying format of the metrics being sent, to support things like Datadog's tags and histograms
- Supports sample rates, but leaves skipping the send to the caller (use the factory and socket directly)
- Doesn't block during metric sending, and only supports UDP (opinionated, but that's all you should need)
Usage
This library uses dependency injection throughout. To instantiate a Client, you'll need a Socket and a Factory:
Once you have a client, you can use the familiar statsd methods to enqueue metrics on the client. The client doesn't send
them until ->flush()
is called.
These methods return the MetricInterface
produced by the factory (so you can then attach extra information).
You can also use the factory and socket to directly and immediately send metrics. The ->getData()
method on MetricInterface
provides the serialized string that should be sent to the statsd server.
Extending
For an example of how to extend the library, see the Vend\Statsd\Datadog
namespace. A different Factory
is used
by passing it to the Client. The Datadog-specific factory will allow the metrics to carry tag information.
NullClient
, ClientAwareInterface
and ClientAwareTrait
Helpful utility classes for performing optional (setter) injection of statsd clients into your classes. Use them in pretty much the same way as their PSR3 equivalents.