| 1 | package Etcd::Stats; | ||||||||||||||||||||||||||||
| 2 | 4 | $Etcd::Stats::VERSION = '0.002'; | |||||||||||||||||||||||||||
| 3 | 4 | ▶ | use namespace::sweep; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use JSON qw(decode_json); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Types::Standard qw(Str); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 4 | requires qw(version_prefix api_exec); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 4 | has _stats_endpoint => ( is => 'lazy', isa => Str ); | |||||||||||||||||||||||||||
| 14 | sub _build__stats_endpoint { | ||||||||||||||||||||||||||||
| 15 | 0 | ▶ | shift->version_prefix . '/stats'; | ||||||||||||||||||||||||||
|
Subroutine
_build__stats_endpoint: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # XXX should return real objects | ||||||||||||||||||||||||||||
| 19 | sub stats { | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | my ($self, $type, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
stats: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | croak 'usage: $etcd->type("leader|store|self", [%args])' if !defined $type || $type !~ m/^(?:leader|store|self)$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $type and $type =~ /^(?:leader|store|self)$/
MC/DC0%0/2
defined $type and $type =~ /^(?:leader|store|self)$/
defined $type
$type =~ /^(?:leader|store|self)$/
Truth table0%0/3
A and B
A= defined $typeB= $type =~ /^(?:leader|store|self)$/
| |||||||||||||||||||||||||||||
| 22 | 0 | decode_json($self->api_exec($self->_stats_endpoint."/$type", 'GET', %args)->{content}); | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 4 | 1; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | __END__ | ||||||||||||||||||||||||||||