| 1 | package Log::Log4perl::OpenTracing; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | our $VERSION = 'v0.1.2'; | |||||||||
| 7 | |||||||||||
| 8 | 3 | ▶ | use Log::Log4perl::Layout::PatternLayout; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 3 | ▶ | use OpenTracing::GlobalTracer; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 3 | ▶ | use Hash::Fold qw/flatten/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 3 | our $OPENTRACING_NOOP_PLACEHOLDER_VALUE = '[ NoOp missing SpanContext ]'; | |||||||||
| 14 | |||||||||||
| 15 | 3 | do { | |||||||||
| 16 | 3 | local $Log::Log4perl::ALLOW_CODE_IN_CONFIG_FILE = 1; | |||||||||
| 17 | |||||||||||
| 18 | 3 | Log::Log4perl::Layout::PatternLayout::add_global_cspec( | |||||||||
| 19 | O => \&get_opentracing_context_with_curlies | ||||||||||
| 20 | ); | ||||||||||
| 21 | }; | ||||||||||
| 22 | |||||||||||
| 23 | 1 | ▶ | sub get_opentracing_context_with_curlies { | ||||||||
|
Subroutine
get_opentracing_context_with_curlies: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 24 | 1 | my ($layout, $message, $category, $priority, $caller_level) = @_; | |||||||||
| 25 | |||||||||||
| 26 | 1 | my $curlies = $layout->{curlies}; | |||||||||
| 27 | 1 | ▶ | my %context = %{ get_opentracing_context() } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | or return $OPENTRACING_NOOP_PLACEHOLDER_VALUE; | ||||||||||
| 29 | |||||||||||
| 30 | 1 | return flatten( \%context )->{$curlies} | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 2 | ▶ | sub get_opentracing_context { | ||||||||
|
Subroutine
get_opentracing_context: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 34 | 2 | OpenTracing::GlobalTracer->get_global_tracer->inject_context( {} ); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 3 | 1; | |||||||||