The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Etsy::StatsD - Object-Oriented Client for Etsy's StatsD Server

SYNOPSIS

    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"]);

DESCRIPTION

new (HOST, PORT, SAMPLE_RATE)

Create a new instance.

HOST

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.

PORT

Default is 8125. Will be used as the default port for any HOST argument not explicitly defining port.

SAMPLE_RATE

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%.

timing(STAT, TIME, SAMPLE_RATE)

Log timing information

increment(STATS, SAMPLE_RATE)

Increment one of more stats counters.

decrement(STATS, SAMPLE_RATE)

Decrement one of more stats counters.

update(STATS, DELTA, SAMPLE_RATE)

Update one of more stats counters by arbitrary amounts.

send(DATA, SAMPLE_RATE)

Sending logging data; implicitly called by most of the other methods.

SEE ALSO

http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/

AUTHOR

Steve Sanbeg http://www.buzzfeed.com/stv