line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Etcd::Stats; |
2
|
|
|
|
|
|
|
$Etcd::Stats::VERSION = '0.003'; |
3
|
4
|
|
|
4
|
|
1623
|
use namespace::sweep; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
37
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
230
|
use JSON qw(decode_json); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
19
|
|
6
|
4
|
|
|
4
|
|
361
|
use Carp qw(croak); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
155
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
17
|
use Moo::Role; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
20
|
|
9
|
4
|
|
|
4
|
|
928
|
use Types::Standard qw(Str); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
22
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires qw(version_prefix api_exec); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has _stats_endpoint => ( is => 'lazy', isa => Str ); |
14
|
|
|
|
|
|
|
sub _build__stats_endpoint { |
15
|
0
|
|
|
0
|
|
|
shift->version_prefix . '/stats'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# XXX should return real objects |
19
|
|
|
|
|
|
|
sub stats { |
20
|
0
|
|
|
0
|
0
|
|
my ($self, $type, %args) = @_; |
21
|
0
|
0
|
0
|
|
|
|
croak 'usage: $etcd->type("leader|store|self", [%args])' if !defined $type || $type !~ m/^(?:leader|store|self)$/; |
22
|
0
|
|
|
|
|
|
decode_json($self->api_exec($self->_stats_endpoint."/$type", 'GET', %args)->{content}); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |