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.19'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Use statements {{{ |
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
30
|
use strict; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
150
|
|
11
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
157
|
|
12
|
4
|
|
|
4
|
|
17
|
use Time::HiRes (); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
992
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# }}} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
1
|
|
|
1
|
0
|
178
|
my ($class, $startup_time, $config) = @_; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
3
|
my $name = name($class); |
20
|
1
|
|
33
|
|
|
4
|
$class = ref $class || $class; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
4
|
my $self = { |
23
|
|
|
|
|
|
|
lastFlush => $startup_time, |
24
|
|
|
|
|
|
|
lastException => $startup_time, |
25
|
|
|
|
|
|
|
config => $config->{$name}, |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
2
|
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
|
15
|
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
|
|
|
|
|
2
|
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; |