line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenTracing::SpanProxy; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
86
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
149
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.003'; # VERSION |
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TEAM'; # AUTHORITY |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
14
|
use parent qw(OpenTracing::Common); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
19
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
178
|
no indirect; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
21
|
|
12
|
3
|
|
|
3
|
|
167
|
use utf8; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
31
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=encoding utf8 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
OpenTracing::SpanProxy - wrapper around an L |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This is the wrapper class that user code would normally receive when working |
23
|
|
|
|
|
|
|
with spans. It allows the creation of nested subspans, and will automatically |
24
|
|
|
|
|
|
|
mark the span as complete when the proxy object is discarded. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
For methods available here, see L. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 span |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Returns the L instance that this wraps. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
19
|
|
|
19
|
1
|
91
|
sub span { shift->{span} } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 log |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Writes a log entry to the L. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
0
|
4
|
sub id { shift->span->id } |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
2
|
0
|
6
|
sub trace_id { shift->span->trace_id } |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
0
|
4
|
sub parent_id { shift->span->parent_id } |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
1
|
0
|
sub log { shift->span->log(@_) } |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
0
|
0
|
sub logs { shift->span->logs } |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
0
|
0
|
sub tags { shift->span->tags } |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
0
|
0
|
0
|
sub tag { shift->span->tag(@_) } |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
0
|
0
|
sub start_time { shift->span->start_time } |
59
|
|
|
|
|
|
|
|
60
|
3
|
|
|
3
|
0
|
18
|
sub duration { shift->span->duration(@_) } |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
1
|
0
|
4
|
sub finish { shift->span->finish(@_) } |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
1
|
0
|
4
|
sub is_finished { shift->span->is_finished } |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
0
|
0
|
sub operation_name { shift->span->operation_name } |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
0
|
0
|
0
|
sub flags { shift->span->flags } |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 new_span |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Creates a new sub-span under this L instance. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub new_span { |
77
|
1
|
|
|
1
|
1
|
7
|
my ($self, $name, %args) = @_; |
78
|
1
|
|
|
|
|
4
|
my $parent = $self->span; |
79
|
1
|
|
|
|
|
5
|
@args{qw(trace_id parent_id)} = ( |
80
|
|
|
|
|
|
|
$parent->trace_id, |
81
|
|
|
|
|
|
|
$parent->id, |
82
|
|
|
|
|
|
|
); |
83
|
1
|
|
|
|
|
39
|
$parent->tracer->span( |
84
|
|
|
|
|
|
|
operation_name => $name, |
85
|
|
|
|
|
|
|
%args |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 DESTROY |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Called on destruction, will mark completion on the span by calling |
92
|
|
|
|
|
|
|
L. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub DESTROY { |
97
|
4
|
|
|
4
|
|
12488
|
my ($self) = @_; |
98
|
4
|
50
|
|
|
|
61
|
return if ${^GLOBAL_PHASE} eq 'DESTRUCT'; |
99
|
4
|
100
|
|
|
|
35
|
$self->span->finish unless $self->span->is_finished; |
100
|
4
|
|
|
|
|
41
|
delete $self->{span}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |