| 1 | package Net::Hadoop::Oozie::SLA; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | $Net::Hadoop::Oozie::SLA::VERSION = '0.113'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Carp qw( confess ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Date::Format; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Date::Parse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | with 'Net::Hadoop::Oozie::Role::Common'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # appname is mandatory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | has 'appname' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | isa => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | confess "no valid appname provided" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
Condition0%0/3
length $_[0] && $_[0] =~ m[ ^ [0-9a-z_/-]+ $ ]xi
MC/DC0%0/2
length $_[0] && $_[0] =~ m[ ^ [0-9a-z_/-]+ $ ]xi
length $_[0]
$_[0] =~ m[ ^ [0-9a-z_/-]+ $ ]xi
Truth table0%0/3
A && B
A= length $_[0]B= $_[0] =~ m[ ^ [0-9a-z_/-]+ $ ]xi
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | if !length $_[0] || $_[0] !~ m{ ^ [0-9a-z_/-]+ $ }xi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | default => sub { undef }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | lazy => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # start and end are boundaries for search by nominal time; defaults are -24h and now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # they can be specified using unix timestamps or any date format Date::Parse accepts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | has 'start' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | isa => sub { confess "no valid start time or date provided" if !$_[0] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if ( $_[0] =~ /^1[0-9]{9}$/ ) { # unix timestamp | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | return time2str( '%Y-%m-%dT%H:%MZ', $_[0], 'UTC' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | elsif ( my $time = str2time( $_[0] ) ) { # date/time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | return time2str( '%Y-%m-%dT%H:%MZ', $time, 'UTC' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | default => sub { time - 3600 * 24 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | lazy => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # TODO Would be nice to add a check for end time later than start time; was | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # thinking of doing it in isa() but the object isn't passed as an argument; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # builder() or default()? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | has 'end' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | isa => sub { confess "no valid end time or date provided" if !$_[0] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ( $_[0] =~ /^1[0-9]{9}$/ ) { # unix timestamp | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | return time2str( '%Y-%m-%dT%H:%MZ', $_[0], 'UTC' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | elsif ( my $time = str2time( $_[0] ) ) { # date/time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | return time2str( '%Y-%m-%dT%H:%MZ', $time, 'UTC' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | default => sub { 0 + time }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | lazy => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # regex for filtering by status (only retrieve the task in slaStatus matching the regex) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | has 'sla_status' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | isa => sub {1}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | coerce => sub { return qr/$_[0]/ }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | default => '.*', | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # regex for excluding by status (only retrieve the tasks in slaStatus that don't match the regex) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | has 'sla_status_ignore' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | isa => sub {1}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | coerce => sub { return qr/$_[0]/ }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | default => 'some silly value', | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # maximum number of items returned; this is applied *before* filtering by status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # NOTE the len parameter is undocumented in the oozie API, support may be removed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | has 'limit' => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | isa => sub { confess "no valid limit provided" if $_[0] !~ /^[1-9][0-9]*$/ }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | default => 10_000, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | sub sla { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sla: not called CC=24 SCAR=64.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $filter = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | app_name => $self->appname, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | nominal_start => $self->start, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | nominal_end => $self->end, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $uri = URI->new( $self->oozie_uri ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | $uri->query_form( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | len => $self->limit, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | timezone => 'GMT', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | filter => join ';', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | map {"$_=$filter->{$_}"} keys %$filter | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $uri->path( sprintf "%s/%s", $uri->path, '/v2/sla' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $res = $self->agent_request($uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | return if !$res->{slaSummaryList}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my @res = @{ $res->{slaSummaryList} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # add meta info to the individual alerts and process the misses; these are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # not individual SLA events, but a summary, so a job that had a duration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # miss will still be in status MET when its end time is ok; the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # documentation says there should be an eventStatus key, but it is likely | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # only present in the coordinator SLA, at least it is not there to be found | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # in the data that we extract | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | for my $sla_row (@res) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | for my $key (qw( lastModified expectedStart actualStart expectedEnd actualEnd)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | if ($sla_row->{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $sla_row->{$key . "Epoch"} = str2time $sla_row->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # both of these can be undef (if not set by config) or -1 (if still | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # running); they're in ms too, so convert them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | $sla_row->{expectedDuration} = int($sla_row->{expectedDuration} / 1000) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | if (($sla_row->{expectedDuration} || 0) > 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$sla_row->{'expectedDuration'} || 0
MC/DC0%0/1
$sla_row->{'expectedDuration'} || 0
$sla_row->{'expectedDuration'}
Truth table0%0/2
A
A= $sla_row->{'expectedDuration'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | $sla_row->{actualDuration} = int($sla_row->{actualDuration} / 1000) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if (($sla_row->{actualDuration} || 0) > 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$sla_row->{'actualDuration'} || 0
MC/DC0%0/1
$sla_row->{'actualDuration'} || 0
$sla_row->{'actualDuration'}
Truth table0%0/2
A
A= $sla_row->{'actualDuration'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if (($sla_row->{parentId} || '') =~ /\@[0-9]+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$sla_row->{'parentId'} || ''
MC/DC0%0/1
$sla_row->{'parentId'} || ''
$sla_row->{'parentId'}
Truth table0%0/2
A
A= $sla_row->{'parentId'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ($sla_row->{coordId} = $sla_row->{parentId}) =~ s/\@.*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | for (qw(Start End)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ($sla_row->{ 'expected' . $_ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/7
$$sla_row{'expected' . $_} and (my $missed_by = ($$sla_row{'actual' . $_ . 'Epoch'} || 0) - ($$sla_row{'expected' . $_ . 'Epoch'} || 0)) > 0
$$sla_row{'actual' . $_ . 'Epoch'} || 0
$$sla_row{'expected' . $_ . 'Epoch'} || 0
MC/DC0%0/2
$$sla_row{'expected' . $_} and (my $missed_by = ($$sla_row{'actual' . $_ . 'Epoch'} || 0) - ($$sla_row{'expected' . $_ . 'Epoch'} || 0)) > 0
$$sla_row{'expected' . $_}
$$sla_row{'actual' . $_ . 'Epoch'}
MC/DC0%0/1
$$sla_row{'expected' . $_ . 'Epoch'} || 0
$$sla_row{'expected' . $_ . 'Epoch'}
Truth table0%0/3
A and B
A= $$sla_row{'expected' . $_}B= $$sla_row{'actual' . $_ . 'Epoch'}
Truth table0%0/2
A
A= $$sla_row{'expected' . $_ . 'Epoch'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | && ( my $missed_by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | = ( $sla_row->{ 'actual' . $_ . 'Epoch' } || 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | - ( $sla_row->{ 'expected' . $_ . 'Epoch' } || 0 ) ) > 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | push @{$sla_row->{slaMisses}}, [ uc $_ . "_MISS", $missed_by ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # actual duration is -1 when running, so we won't get a duration_miss | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # until the job is done; we need to figure it out sooner, by checking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # the actual start and adding the expected duration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if ( ( $sla_row->{expectedDuration} || 0 ) < ( $sla_row->{actualDuration} || 0 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/4
$sla_row->{'expectedDuration'} || 0
$sla_row->{'actualDuration'} || 0
MC/DC0%0/1
$sla_row->{'expectedDuration'} || 0
$sla_row->{'expectedDuration'}
MC/DC0%0/1
$sla_row->{'actualDuration'} || 0
$sla_row->{'actualDuration'}
Truth table0%0/2
A
A= $sla_row->{'expectedDuration'}
Truth table0%0/2
A
A= $sla_row->{'actualDuration'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | push @{ $sla_row->{slaMisses} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | [ 'DURATION_MISS', $sla_row->{actualDuration} - $sla_row->{expectedDuration} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | ▶ | elsif ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/11
($sla_row->{"expectedDuration"} || 0) > 0 and $sla_row->{"actualDuration"} == -1 and $sla_row->{"actualStartEpoch"} and (my $missed_by = $sla_row->{"lastModifiedEpoch"} - $sla_row->{"actualStartEpoch"} - $sla_row->{"expectedDuration"}) > 0
($sla_row->{"expectedDuration"} || 0) > 0 and $sla_row->{"actualDuration"} == -1 and $sla_row->{"actualStartEpoch"}
($sla_row->{"expectedDuration"} || 0) > 0 and $sla_row->{"actualDuration"} == -1
$sla_row->{'expectedDuration'} || 0
MC/DC0%0/4
($sla_row->{"expectedDuration"} || 0) > 0 and $sla_row->{"actualDuration"} == -1 and $sla_row->{"actualStartEpoch"} and (my $missed_by = $sla_row->{"lastModifiedEpoch"} - $sla_row->{"actualStartEpoch"} - $sla_row->{"expectedDuration"}) > 0
$sla_row->{'expectedDuration'}
$sla_row->{"actualDuration"} == -1
$sla_row->{"actualStartEpoch"}
(my $missed_by = $sla_row->{"lastModifiedEpoch"} - $sla_row->{"actualStartEpoch"} - $sla_row->{"expectedDuration"}) > 0
Truth table0%0/5
A and B and C and D
A= $sla_row->{'expectedDuration'}B= $sla_row->{"actualDuration"} == -1C= $sla_row->{"actualStartEpoch"}D= (my $missed_by = $sla_row->{"lastModifiedEpoch"} - $sla_row->{"actualStartEpoch"} - $sla_row->{"expectedDuration"}) > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | ($sla_row->{expectedDuration} || 0) > 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | && $sla_row->{actualDuration} == -1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | && $sla_row->{actualStartEpoch} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | && ( my $missed_by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | = $sla_row->{lastModifiedEpoch} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | - $sla_row->{actualStartEpoch} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | - $sla_row->{expectedDuration} ) > 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | push @{ $sla_row->{slaMisses} }, [ 'DURATION_MISS', $missed_by ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | @res = grep { $_->{slaStatus} =~ $self->sla_status } @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | @res = grep { $_->{slaStatus} !~ $self->sla_status_ignore } @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # splice @res, $self->limit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | return @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||