blib/lib/Log/Log4perl/OpenTracing.pm

filter: Statementstmt 100% 27 / 27 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 92.1% 35 / 38 CC 2 SCAR 2.3
CC
2
Cov
97%
get_opentracing_context_with_curlies
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
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
BranchTrueFalseTotal
my(%context) = %{get_opentracing_context();} or return $Log::Log4perl::OpenTracing::OPENTRACING_NOOP_PLACEHOLDER_VALUE 1 0 1
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;
↑ Summary