| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package OpenTracing::Role::Scope; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = 'v0.85.0'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
875538
|
use Moo::Role; |
|
|
10
|
|
|
|
|
17743
|
|
|
|
10
|
|
|
|
|
71
|
|
|
6
|
10
|
|
|
10
|
|
6660
|
use MooX::Should; |
|
|
10
|
|
|
|
|
25064
|
|
|
|
10
|
|
|
|
|
91
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
1231
|
use Carp; |
|
|
10
|
|
|
|
|
26
|
|
|
|
10
|
|
|
|
|
672
|
|
|
9
|
10
|
|
|
10
|
|
2539
|
use OpenTracing::Types qw/Span/; |
|
|
10
|
|
|
|
|
299376
|
|
|
|
10
|
|
|
|
|
112
|
|
|
10
|
10
|
|
|
10
|
|
8280
|
use Types::Standard qw/Bool CodeRef Maybe/; |
|
|
10
|
|
|
|
|
334665
|
|
|
|
10
|
|
|
|
|
122
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has span => ( |
|
13
|
|
|
|
|
|
|
is => 'ro', |
|
14
|
|
|
|
|
|
|
should => Span, |
|
15
|
|
|
|
|
|
|
reader => 'get_span', |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has finish_span_on_close => ( |
|
19
|
|
|
|
|
|
|
is => 'ro', |
|
20
|
|
|
|
|
|
|
should => Bool, |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has closed => ( |
|
24
|
|
|
|
|
|
|
is => 'rwp', |
|
25
|
|
|
|
|
|
|
should => Bool, |
|
26
|
|
|
|
|
|
|
init_arg => undef, |
|
27
|
|
|
|
|
|
|
default => !!undef, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has on_close => ( |
|
31
|
|
|
|
|
|
|
is => 'ro', |
|
32
|
|
|
|
|
|
|
should => Maybe[CodeRef], |
|
33
|
|
|
|
|
|
|
predicate => 1, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub close { |
|
37
|
7
|
|
|
7
|
1
|
24327
|
my $self = shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
7
|
100
|
50
|
|
|
62
|
carp "Can't close an already closed scope" and return $self |
|
40
|
|
|
|
|
|
|
if $self->closed; |
|
41
|
|
|
|
|
|
|
|
|
42
|
6
|
|
|
|
|
125
|
$self->_set_closed( !undef ); |
|
43
|
|
|
|
|
|
|
|
|
44
|
6
|
50
|
|
|
|
212
|
$self->get_span->finish |
|
45
|
|
|
|
|
|
|
if $self->finish_span_on_close; |
|
46
|
|
|
|
|
|
|
|
|
47
|
6
|
100
|
|
|
|
33
|
$self->on_close->( $self ) |
|
48
|
|
|
|
|
|
|
if $self->has_on_close; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# return $self->get_scope_manager()->deactivate_scope( $self ); |
|
51
|
|
|
|
|
|
|
|
|
52
|
6
|
|
|
|
|
66
|
return $self |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
}; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub DEMOLISH { |
|
57
|
5
|
|
|
5
|
0
|
11496
|
my $self = shift; |
|
58
|
5
|
|
|
|
|
11
|
my $in_global_destruction = shift; |
|
59
|
|
|
|
|
|
|
|
|
60
|
5
|
100
|
|
|
|
49
|
return if $self->closed; |
|
61
|
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
26
|
croak "Scope not programmatically closed before being demolished"; |
|
63
|
|
|
|
|
|
|
# |
|
64
|
|
|
|
|
|
|
# below might be appreciated behaviour, but you should close yourself |
|
65
|
|
|
|
|
|
|
# |
|
66
|
0
|
0
|
|
|
|
|
$self->close( ) |
|
67
|
|
|
|
|
|
|
unless $in_global_destruction; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return |
|
70
|
0
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
BEGIN { |
|
75
|
10
|
|
|
10
|
|
16423
|
use Role::Tiny::With; |
|
|
10
|
|
|
|
|
1722
|
|
|
|
10
|
|
|
|
|
566
|
|
|
76
|
10
|
|
|
10
|
|
52
|
with 'OpenTracing::Interface::Scope' |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |