line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenTracing::AutoScope; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
384830
|
use strict; |
|
3
|
|
|
|
|
26
|
|
|
3
|
|
|
|
|
108
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
119
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 'v0.103.0'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
901
|
use OpenTracing::GlobalTracer; |
|
3
|
|
|
|
|
22886
|
|
|
3
|
|
|
|
|
19
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
1628
|
use Scope::Context; |
|
3
|
|
|
|
|
13061
|
|
|
3
|
|
|
|
|
450
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# start_guarded_span |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
# This class-method will take an optional list of key/value pairs (same as |
18
|
|
|
|
|
|
|
# start_active_span) which should be an even sized list. |
19
|
|
|
|
|
|
|
# If not, we asume there is a given operation name. |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
sub start_guarded_span { |
22
|
14
|
|
|
14
|
1
|
67301
|
my $class = shift; |
23
|
14
|
100
|
|
|
|
70
|
my $operation_name = scalar @_ % 2 ? shift : _context_sub_name( ); |
24
|
14
|
|
|
|
|
985
|
my %options = @_; |
25
|
|
|
|
|
|
|
|
26
|
14
|
|
|
|
|
47
|
my $scope = OpenTracing::GlobalTracer |
27
|
|
|
|
|
|
|
->get_global_tracer->start_active_span( $operation_name, %options ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# use a closure, so we can carry over $scope until the end of the scope |
30
|
|
|
|
|
|
|
# where this coderef will be 'reaped' |
31
|
|
|
|
|
|
|
# |
32
|
14
|
|
|
14
|
|
161702634
|
Scope::Context->up->reap( sub { $scope->close } ); |
|
14
|
|
|
|
|
44032
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return |
35
|
14
|
|
|
|
|
1304
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# _context_sub_name |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# Returns the sub_name of our caller (caller of `start_guarded_span`) |
42
|
5
|
|
|
5
|
|
17
|
sub _context_sub_name { Scope::Context->up->up->sub_name } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |