$t = Test::Statsd->new({
binary => './bin/statsd',
config => './bin/sample-config.json'
});
# Brings up the statsd server in the background
# with the specified configurat
sdIndex . '/_bulk',
method => 'POST',
headers => {
'Content-Type' => 'application/json',
'Content-Length' => length($payload),
}
};
my $req = HTTP::Request->new();
$re
e flush code wasn't doing this previously.
Fixed management commands (:8126) to output correct JSON data
structures.
This is the first fully functional statsd server release.
=head2 Net::St
JSON::XS ();
use base qw(Net::Statsd::Server::Backend);
sub init {
my ($self) = @_;
=cut
$self->{statsCache} = {
counters => {},
timers => {},
};
=cut
$self->{json_emitter} = JSON
=> $metrics->{sets},
pctThreshold => $metrics->{pctThreshold},
};
print STDERR $self->{json_emitter}->encode($out), "\n";
return;
}
sub status {
my ($self) = @_;
return {
last_fl
atsd *server*
package Net::Statsd::Server;
# Use statements {{{
use strict;
#se warnings;
use JSON::XS ();
use Socket qw(SOL_SOCKET SO_RCVBUF);
use Time::HiRes ();
use AnyEvent;
use AnyEvent::Han
f->{$_} = $opt->{$_}
for keys %{ $opt };
bless $self, $class;
}
# Flatten JSON booleans to avoid calls to JSON::XS::bool
# in the performance-critical code paths
sub _flatten_bools {
my ($se
$conf_hash->{$_} = !! $conf_hash->{$_};
}
return $conf_hash;
}
sub _json_emitter {
my ($self) = @_;
my $js = JSON::XS->new()
->utf8(1)
->shrink(1)
->space_before(0)
->space