Net-Hadoop-YARN

 view release on metacpan or  search on metacpan

lib/Net/Hadoop/YARN/Roles/JMX.pm  view on Meta::CPAN

package Net::Hadoop::YARN::Roles::JMX;
$Net::Hadoop::YARN::Roles::JMX::VERSION = '0.203';
use 5.10.0;
use strict;
use warnings;

use Carp  qw( confess );
use Clone qw( clone   );
use Constant::FromGlobal DEBUG => { int => 1, default => 0, env => 1 };
use JSON::XS ();
use Moo::Role;
use Ref::Util qw(
    is_arrayref
    is_coderef
    is_hashref
    is_ref
);
use Scalar::Util qw( blessed );
use Time::HiRes  qw( time );

has 'target_host_port' => (
    is => 'rw',
    default => sub {
        my $self = shift;
        return join q{:}, $self->target_host, $self->target_port;
    }
);

has 'target_host' => (
    is      => 'rw',
    default => sub {
        confess "target_host is not defined";
    }
);

has 'target_port' => (
    is      => 'rw',
    default => sub {
        confess "target_port is not defined";
    }
);

has stats => (
    is      => 'rw',
    default => sub {
        shift->all_available_stats;
    },
    isa => sub {
        my $thing = shift;
        if ( ref $thing ne 'ARRAY' ) {
            confess "$thing must be an ARRAY";
        }
        # TODO: verify somehow
    },
    lazy => 1,
);

has flat => (
    is      => 'rw',
    default => sub { 0 },
    lazy    => 1,
);

has decode_json_substrings => (
    is      => 'rw',
    default => sub { 0 },
    lazy    => 1,
);

sub all_available_stats {
    my $self = shift;
    my $c = $self->clone;



( run in 2.628 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )