17 Aug 2018 15:28:30 UTC
- Distribution: Net-Statsd-Client
- Module version: 0.34
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (881 / 9 / 0)
- KwaliteeBus factor: 1
- 85.83% Coverage
- License: perl_5
- Activity24 month
- Download (12.65KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- $stats->increment($metric, [$sample_rate])
- $stats->decrement($metric, [$sample_rate])
- $stats->update($metric, $count, [$sample_rate])
- $stats->timing_ms($metric, $time, [$sample_rate])
- $stats->timer($metric, [$sample_rate])
- $stats->gauge($metric, $value, [$sample_rate])
- $statsd->set_add($metric, $value, [$sample_rate])
- COPYRIGHT AND LICENSE
Net::Statsd::Client - Send data to StatsD / Graphite
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 ... my $elapsed_ms = $timer->finish;
Optional: The hostname of the StatsD server to connect to. Defaults to localhost.
Optional: The port number to connect to. Defaults to 8125.
Optional: A prefix to be added to all metric names logged throught his object.
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%).
Optional: A function that will be called with a message if a
timeris destroyed unexpectedly (see Net::Statsd::Timer). If this is not set the builtin
warnwill be used.
Increment the named counter metric.
Decrement the named counter metric.
$countto the value of the named counter metric.
Record an event of duration
$timemilliseconds for the named timing metric.
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
finishon the timer. Calling
finishon the timer returns the elapsed time in milliseconds.
Send a value for the named gauge metric. Instead of adding up like counters or producing a large number of quantiles like timings, gauges simply take the last value sent in any time period, and don't require scaling.
Add a value to the named set metric. Sets count the number of *unique* values they see in each time period, letting you estimate, for example, the number of users using a site at a time by adding their userids to a set each time they load a page.
Andrew Rodland <email@example.com>
This software is copyright (c) 2018 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.
Module Install Instructions
To install Net::Statsd::Client, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Net::Statsd::Client
For more information on module installation, please visit the detailed CPAN module installation guide.