line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Backend base class for Net::Statsd::Server |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Net::Statsd::Server::Backend; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Net::Statsd::Server::Backend::VERSION = '0.17'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Use statements {{{ |
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
33
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
148
|
|
11
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
118
|
|
12
|
4
|
|
|
4
|
|
20
|
use Time::HiRes (); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1377
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# }}} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
1
|
|
|
1
|
0
|
204
|
my ($class, $startup_time, $config) = @_; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
4
|
my $name = name($class); |
20
|
1
|
|
33
|
|
|
5
|
$class = ref $class || $class; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
5
|
my $self = { |
23
|
|
|
|
|
|
|
lastFlush => $startup_time, |
24
|
|
|
|
|
|
|
lastException => $startup_time, |
25
|
|
|
|
|
|
|
config => $config->{$name}, |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
3
|
bless $self, $class; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Subclass way of doing special things |
31
|
1
|
|
|
|
|
5
|
$self->init($startup_time, $config); |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
2
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub config { |
37
|
0
|
|
|
0
|
0
|
0
|
$_[0]->{config}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub name { |
41
|
1
|
|
|
1
|
0
|
20
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
33
|
|
|
7
|
my $backend_name = ref($self) || $self; |
44
|
1
|
|
|
|
|
7
|
$backend_name =~ s{^ .* :: ([^:]+) $}{$1}x; |
45
|
1
|
|
|
|
|
3
|
$backend_name = lc $backend_name; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
3
|
return $backend_name; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub flush { |
51
|
0
|
|
|
0
|
0
|
|
die "Base class. Implement your own flush()"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub status { |
55
|
0
|
|
|
0
|
0
|
|
die "Base class. Implement your own status()"; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub since { |
59
|
0
|
|
|
0
|
0
|
|
my ($self, $hires_ts) = @_; |
60
|
0
|
|
|
|
|
|
return int(Time::HiRes::tv_interval($hires_ts)); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |