https://github.com/throughnothing/plack-middleware-statsd
https://github.com/throughnothing/plack-middleware-statsd
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/throughnothing/plack-middleware-statsd
- Owner: throughnothing
- Created: 2012-12-11T22:02:22.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2014-12-31T18:41:22.000Z (over 11 years ago)
- Last Synced: 2023-04-14T01:26:35.086Z (about 3 years ago)
- Language: Perl
- Size: 163 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NAME
Plack::Middleware::StatsD - Plack middleware for logging request/response data with StatsD
# VERSION
version 0.0200
# SYNOPSIS
use Plack::Builder;
use Plack::Middleware::StatsD;
my $app = sub { ... } # as usual
# StatsD Options
my %options = (
host => '127.0.0.1',
port => 8125,
sample_rate => 0.5,
prefix => 'myapp',
whitelist => sub {
my ($req) = @_;
...
# Return true to process, false to ignore
},
stat_name_mapper => sub {
my ($req) = @_;
...
# Return what to name the stat for this request
return $req->path;
},
);
builder {
enable "Plack::Middleware::StatsD", %options;
$app;
};
With the above in place, [Plack::Middleware::StatsD](http://search.cpan.org/perldoc?Plack::Middleware::StatsD) will increment counters to
`PREFIX.STATUS_CODE` and `PREFIX./url/path.STATUS_CODE` to your statsd server.
It will also time your responses under `PREFIX./url/path.time` to your statsd
server as well.
# AUTHOR
William Wolf
# COPYRIGHT AND LICENSE
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.