line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Log4perl::OpenTracing; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
345697
|
use strict; |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
74
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
100
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 'v0.1.1'; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
949
|
use Log::Log4perl::Layout::PatternLayout; |
|
3
|
|
|
|
|
26732
|
|
|
3
|
|
|
|
|
68
|
|
9
|
3
|
|
|
3
|
|
1462
|
use OpenTracing::GlobalTracer; |
|
3
|
|
|
|
|
27575
|
|
|
3
|
|
|
|
|
16
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
1413
|
use Hash::Fold qw/flatten/; |
|
3
|
|
|
|
|
393152
|
|
|
3
|
|
|
|
|
19
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $OPENTRACING_NOOP_PLACEHOLDER_VALUE = '[ NoOp missing SpanContext ]'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
do { |
16
|
|
|
|
|
|
|
local $Log::Log4perl::ALLOW_CODE_IN_CONFIG_FILE = 1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Log::Log4perl::Layout::PatternLayout::add_global_cspec( |
19
|
|
|
|
|
|
|
O => \&get_opentracing_context_with_curlies |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get_opentracing_context_with_curlies { |
24
|
1
|
|
|
1
|
0
|
6454
|
my ($layout, $message, $category, $priority, $caller_level) = @_; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
3
|
my $curlies = $layout->{curlies}; |
27
|
1
|
50
|
|
|
|
3
|
my $context = get_opentracing_context() |
28
|
|
|
|
|
|
|
or return $OPENTRACING_NOOP_PLACEHOLDER_VALUE; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
14
|
return flatten( $context )->{$curlies} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub get_opentracing_context { |
34
|
2
|
|
|
2
|
0
|
3403
|
OpenTracing::GlobalTracer->get_global_tracer->inject_context( {} ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |