Dancer::Plugin::StatsD - Dancer Plugin for StatsD support
version 0.0001
Dancer::Plugin::StatsD is a Dancer plugin that lets you log events and track times using StatsD.
StatsD
use Dancer; use Dancer::Plugin::StatsD qw( statsd increment decrement update timing ); use Time::HiRes qw( time ); hook before_error_renden => sub { my ($err) = @_; statsd->increment( 'errors.' . $err->code ); }; get '/' => sub { # Increment the homepage hits counter statsd->increment( 'hits.homepage' ); my $t1 = time; # Do something that takes a while # Log the time taken in ms statsd->timing( 'something.slow', (time - $t1) / 1000 ); }; dance;
William Wolf <throughnothing@gmail.com>
William Wolf has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.
Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.
To install Dancer::Plugin::StatsD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::StatsD
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::StatsD
For more information on module installation, please visit the detailed CPAN module installation guide.