DataDog/Scope.pm

filter: Statementstmt 67.8% 19 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 1 totaltotal 55.8% 24 / 43 CC 4 SCAR 16.1
CC
4
Cov
56%
DEMOLISH
12.0
_trigger_closed_time
6.0
__ANON__
2.0
CRAP 5.0
« DataDog/ScopeManager.pm ↑ Summary DataDog/Span.pm »
1 package OpenTracing::Implementation::DataDog::Scope;
2  
3 =head1 NAME
4  
5 OpenTracing::Implementation::DataDog::Scope - Formailzing active spans
6  
7 =head SYNOPSIS
8  
9 duno
10  
11 =cut
12  
13 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 with 'OpenTracing::Role::Scope';
16  
17 1 ▶use OpenTracing::Implementation::DataDog::Utils qw/epoch_floatingpoint/;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use Types::Interface qw/ObjectDoesInterface/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Types::Standard qw/CodeRef Num/;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23  
24  
25 1 has closed_time => (
26 is => 'rwp',
27 isa => Num,
28 predicate => 'has_closed',
29 # trigger => 1,
30 init_arg => undef,
31 );
32  
33 sub _trigger_closed_time {
34 0 ▶ my $self = shift;
Subroutine _trigger_closed_time: not called CC=2 SCAR=17.9
35
36 0 ▶ croak "Can't close an already closed scope"
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_closed 0 0 0
37 if $self->has_closed;
38 }
39  
40  
41  
42 has after_close => (
43 is => 'ro',
44 isa => CodeRef,
45 0 ▶ default => sub { sub { } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
46 1 );
47  
48  
49  
50 sub close {
51 my $self = shift;
52
53 croak "Can't close an already closed scope"
54 if $self->has_closed;
55
56 $self->_set_closed_time( epoch_floatingpoint() );
57
58 return $self->after_close->( $self )
59
60 }
61  
62  
63  
64 sub DEMOLISH {
65 0 ▶ my $self = shift;
Subroutine DEMOLISH: not called CC=3 SCAR=24.8
Pod undocumented
66 0 my $in_global_destruction = shift;
67
68 0 ▶ return if $self->has_closed;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_closed 0 0 0
69
70 0 croak "Scope not programmatically closed before being demolished";
71 #
72 # below might be appreciated behaviour, but you should close yourself
73 #
74 0 ▶ $self->close( )
Branch: 1 branch
BranchTrueFalseTotal
unless $in_global_destruction 0 0 0
75 unless $in_global_destruction;
76
77 return
78 0 }
79  
80  
81  
82 1 1;
« DataDog/ScopeManager.pm ↑ Summary DataDog/Span.pm »