line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenTracing::Implementation; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
388348
|
use strict; |
|
3
|
|
|
|
|
33
|
|
|
3
|
|
|
|
|
85
|
|
4
|
3
|
|
|
3
|
|
23
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
435
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 'v0.33.2'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub OT_IMPLEMENTATION_NAME { |
9
|
|
|
|
|
|
|
exists $ENV{ PERL_OPENTRACING_IMPLEMENTATION } ? |
10
|
|
|
|
|
|
|
$ENV{ PERL_OPENTRACING_IMPLEMENTATION } : |
11
|
|
|
|
|
|
|
exists $ENV{ OPENTRACING_IMPLEMENTATION } ? |
12
|
|
|
|
|
|
|
$ENV{ OPENTRACING_IMPLEMENTATION } : |
13
|
4
|
100
|
|
4
|
0
|
23
|
'NoOp' |
|
|
50
|
|
|
|
|
|
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub OT_DEBUG { |
17
|
|
|
|
|
|
|
exists $ENV{ PERL_OPENTRACING_DEBUG } ? |
18
|
|
|
|
|
|
|
$ENV{ PERL_OPENTRACING_DEBUG } : |
19
|
|
|
|
|
|
|
exists $ENV{ OPENTRACING_DEBUG } ? |
20
|
|
|
|
|
|
|
$ENV{ OPENTRACING_DEBUG } : |
21
|
|
|
|
|
|
|
exists $ENV{ DEBUG } ? |
22
|
|
|
|
|
|
|
$ENV{ DEBUG } : |
23
|
|
|
|
|
|
|
undef |
24
|
6
|
50
|
|
6
|
0
|
27
|
} |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# it was meant to be a constant, but during test, these seem to be dynamic |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
|
1366
|
use OpenTracing::GlobalTracer; |
|
3
|
|
|
|
|
7226
|
|
|
3
|
|
|
|
|
19
|
|
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
3
|
|
211
|
use Carp; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
159
|
|
33
|
3
|
|
|
3
|
|
27
|
use Module::Load; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
12
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our @CARP_NOT; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub import { |
38
|
3
|
|
|
3
|
|
26
|
my $package = shift; |
39
|
3
|
50
|
|
|
|
1604
|
return unless @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
__PACKAGE__->bootstrap_global_tracer( @_ ) |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
1
|
1590
|
sub bootstrap_tracer { shift->_build_tracer( @_ ) } |
45
|
|
|
|
|
|
|
|
46
|
3
|
|
|
3
|
1
|
22739
|
sub bootstrap_default_tracer { shift->_build_tracer( undef, @_ ) } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub bootstrap_global_tracer { |
49
|
1
|
|
|
1
|
1
|
4651
|
OpenTracing::GlobalTracer->set_global_tracer( shift->_build_tracer( @_ ) ); |
50
|
1
|
|
|
|
|
16
|
return OpenTracing::GlobalTracer->get_global_tracer |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub bootstrap_global_default_tracer { |
54
|
1
|
|
|
1
|
1
|
4705
|
OpenTracing::GlobalTracer->set_global_tracer( shift->_build_tracer( undef, @_ ) ); |
55
|
1
|
|
|
|
|
12
|
return OpenTracing::GlobalTracer->get_global_tracer |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# _build_tracer |
59
|
|
|
|
|
|
|
# |
60
|
|
|
|
|
|
|
# passing undef as implementation name will cause to use the $ENV |
61
|
|
|
|
|
|
|
# |
62
|
|
|
|
|
|
|
sub _build_tracer { |
63
|
6
|
|
|
6
|
|
13
|
my $package = shift; |
64
|
6
|
|
|
|
|
12
|
my $implementation_name = shift; |
65
|
6
|
|
|
|
|
26
|
my @implementation_args = @_; |
66
|
|
|
|
|
|
|
|
67
|
6
|
|
|
|
|
15
|
my $implementation_class = |
68
|
|
|
|
|
|
|
__PACKAGE__->_get_implementation_class( $implementation_name ); |
69
|
|
|
|
|
|
|
|
70
|
6
|
50
|
|
|
|
18
|
carp "Loading implementation $implementation_class" |
71
|
|
|
|
|
|
|
if OT_DEBUG; |
72
|
|
|
|
|
|
|
|
73
|
6
|
|
|
|
|
13
|
eval { load $implementation_class }; |
|
6
|
|
|
|
|
15
|
|
74
|
6
|
50
|
|
|
|
654
|
croak "GlobalTracer can't load implementation [$implementation_class]" |
75
|
|
|
|
|
|
|
if $@; |
76
|
|
|
|
|
|
|
|
77
|
6
|
|
|
|
|
209
|
my $tracer = $implementation_class->bootstrap_tracer( @implementation_args); |
78
|
|
|
|
|
|
|
|
79
|
6
|
|
|
|
|
627
|
return $tracer |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub _get_implementation_class { |
83
|
6
|
|
|
6
|
|
11
|
my $class = shift; |
84
|
6
|
|
66
|
|
|
25
|
my $implementation_name = shift // OT_IMPLEMENTATION_NAME; |
85
|
|
|
|
|
|
|
|
86
|
6
|
100
|
|
|
|
24
|
my $implementation_class = substr( $implementation_name, 0, 1) eq '+' ? |
87
|
|
|
|
|
|
|
substr( $implementation_name, 1 ) |
88
|
|
|
|
|
|
|
: |
89
|
|
|
|
|
|
|
'OpenTracing::Implementation::' . $implementation_name; |
90
|
|
|
|
|
|
|
|
91
|
6
|
|
|
|
|
14
|
return $implementation_class |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |