NAME

Net::Async::Statsd::Server - asynchronous server for Etsy's statsd protocol

VERSION

version 0.004

SYNOPSIS

use Future;
use IO::Async::Loop;
use Net::Async::Statsd::Server;
my $loop = IO::Async::Loop->new;
$loop->add(my $statsd = Net::Async::Statsd::Server->new(
  port => 3001,
));
$statsd->bus->subscribe_to_event(
 count => sub {
  my ($ev, $k, $delta, $type) = @_;
 }
);

DESCRIPTION

Provides an asynchronous server for the statsd API.

METHODS

All public methods return a Future indicating when the write has completed. Since writes are UDP packets, there is no guarantee that the remote will receive the value, so this is mostly intended as a way to detect when statsd writes are slow.

host

Which host to listen on. Probably want '0.0.0.0' (set via "configure") here if you want to listen on all addresses.

port

The UDP port we'll accept traffic on. Use "configure" to set it.

configure

Used for setting values.

listening

Resolves with the port number when the UDP server is listening.

listen

Establishes the underlying UDP socket.

bus

Returns the Net::Async::Statsd::Bus instance for this server.

This object exists purely for the purpose of dispatching events.

listen_backlog

Default listen backlog. Immutable, set to 4096 for no particular reason.

type_for_char

Badly-named lookup method - returns the type matching the given characters.

on_recv

Called if we receive data.

on_recv_error

Called if we had an error while receiving.

SEE ALSO

INHERITED METHODS

IO::Async::Notifier

add_child, adopt_future, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent

AUTHOR

Tom Molesworth <TEAM@cpan.org>

LICENSE

Copyright Tom Molesworth 2014-2016. Licensed under the same terms as Perl itself.