| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Etcd::Stats; | 
| 2 |  |  |  |  |  |  | $Etcd::Stats::VERSION = '0.004'; | 
| 3 | 4 |  |  | 4 |  | 2067 | use namespace::autoclean; | 
|  | 4 |  |  |  |  | 6 |  | 
|  | 4 |  |  |  |  | 40 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 4 |  |  | 4 |  | 289 | use JSON qw(decode_json); | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 24 |  | 
| 6 | 4 |  |  | 4 |  | 444 | use Carp qw(croak); | 
|  | 4 |  |  |  |  | 7 |  | 
|  | 4 |  |  |  |  | 181 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 4 |  |  | 4 |  | 18 | use Moo::Role; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 19 |  | 
| 9 | 4 |  |  | 4 |  | 1164 | use Types::Standard qw(Str); | 
|  | 4 |  |  |  |  | 7 |  | 
|  | 4 |  |  |  |  | 70 |  | 
| 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__ |