App-ElasticSearch-Utilities
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/ElasticSearch/Utilities/Metrics.pm view on Meta::CPAN
package App::ElasticSearch::Utilities::Metrics;
# ABSTRACT: Fetches performance metrics about the node
use v5.16;
use warnings;
our $VERSION = '8.8'; # VERSION
use App::ElasticSearch::Utilities qw(es_connect);
use CLI::Helpers qw(:output);
use JSON::MaybeXS;
use Ref::Util qw(is_ref is_arrayref is_hashref);
use Types::Standard qw( ArrayRef Bool HashRef InstanceOf Int Str );
use Moo;
use namespace::autoclean;
has 'connection' => (
is => 'ro',
isa => InstanceOf['App::ElasticSearch::Utilities::Connection'],
default => sub { es_connect() },
handles => [qw(host port request)],
);
my @_IGNORES = qw(
_all _shards
attributes id timestamp uptime_in_millis
);
has 'ignore' => (
is => 'lazy',
isa => ArrayRef[Str],
default => sub {
my ($self) = @_;
my %roles = map { $_ => 1 } @{ $self->node_details->{roles} };
my @ignore = qw(adaptive_selection discovery);
# Easy roles and sections are the same
foreach my $section ( qw(ingest ml transform) ) {
push @ignore, $section
unless $roles{$section};
}
if( ! $roles{ml} ) {
push @ignore, qw(ml_datafeed ml_job_comms ml_utility);
}
# Skip some sections if we're not a data node
if( ! grep { /^data/ } keys %roles ) {
push @ignore, qw(force_merge indexing indices merges pressure recovery segments translog);
}
return \@ignore;
},
);
has 'node_details' => (
is => 'lazy',
isa => HashRef,
init_arg => undef,
);
sub _build_node_details {
my ($self) = @_;
if( my $res = $self->request('_nodes/_local')->content ) {
if( my $nodes = $res->{nodes} ) {
my ($id) = keys %{ $nodes };
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.582 second using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )