Etsy::StatsD - Object-Oriented Client for Etsy's StatsD Server
use Etsy::StatsD; # Increment a counter my $statsd = Etsy::StatsD->new(); $statsd->increment( 'app.method.success' ); # Time something use Time::HiRes; my $start_time = time; $app->do_stuff; my $done_time = time; # Timers are expected in milliseconds $statsd->timing( 'app.method', ($done_time - $start_time) * 1000 ); # Send to two StatsD Endpoints simultaneously my $repl_statsd = Etsy::StatsD->new(["statsd1","statsd2"]); # On two different ports: my $repl_statsd = Etsy::StatsD->new(["statsd1","statsd1:8126"]); # Use TCP to a collector (you must specify a port) my $important_stats = Etsy::StatsD->new(["bizstats1:8125:tcp"]);
Create a new instance.
If the argument is a string, it must be a hostname or IP only. The default is 'localhost'. The argument may also be an array reference of strings in the form of "<host>", "<host>:<port>", or "<host>:<port>:<proto>". If the port is not specified, the default port specified by the PORT argument will be used. If the protocol is not specified, or is not "tcp" or "udp", "udp" will be set. The only way to change the protocol, is to specify the host, port and protocol.
Default is 8125. Will be used as the default port for any HOST argument not explicitly defining port.
Default is undefined, or no sampling performed. Specify a rate as a decimal between 0 and 1 to enable sampling. e.g. 0.5 for 50%.
Log timing information
Increment one of more stats counters.
Decrement one of more stats counters.
Update one of more stats counters by arbitrary amounts.
Sending logging data; implicitly called by most of the other methods.
http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/
Steve Sanbeg http://www.buzzfeed.com/stv
To install Etsy::StatsD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Etsy::StatsD
CPAN shell
perl -MCPAN -e shell install Etsy::StatsD
For more information on module installation, please visit the detailed CPAN module installation guide.