Andrew Rodland > Net-Statsd-Client-0.22 > Net::Statsd::Client

Download:
Net-Statsd-Client-0.22.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.22   Source   Latest Release: Net-Statsd-Client-0.31

NAME ^

Net::Statsd::Client - Send data to StatsD / Graphite

VERSION ^

version 0.22

SYNOPSIS ^

    use Net::Statsd::Client
    my $stats = Net::Statsd::Client->new(prefix => "service.frobnitzer.");
    $stats->increment("requests"); # service.frobnitzer.requests++ in graphite

    my $timer = $stats->timer("request_duration");
    # ... do something expensive ...
    $timer->finish;

ATTRIBUTES ^

prefix

Optional: A prefix to be added to all metric names logged throught his object.

sample_rate

Optional: A value between 0 and 1, determines what fraction of events will actually be sent to the server. This sets the default sample rate, which can be overridden on a case-by-case basis when sending an event (for instance, you might choose to send errors at a 100% sample rate, but other events at 1%).

warning_callback

Optional: A function that will be called with a message if a timer is destroyed unexpectedly (see Net::Statsd::Timer). If this is not set the builtin warn will be used.

METHODS ^

$stats->increment($metric, [$sample_rate])

Increment the named counter metric.

$stats->decrement($metric, [$sample_rate])

Decrement the named counter metric.

$stats->update($metric, $count, [$sample_rate])

Add $count to the value of the named counter metric.

$stats->timing_ms($metric, $time, [$sample_rate])

Record an event of duration $time milliseconds for the named timing metric.

$stats->timer($metric, [$sample_rate])

Returns a Net::Statsd::Client::Timer object for the named timing metric. The timer begins when you call this method, and ends when you call finish on the timer.

AUTHOR ^

Andrew Rodland <arodland@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Andrew Rodland.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: