blib/lib/CGI/Application/Plugin/OpenTracing/DataDog.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 38 / 38 CC 4 SCAR 8.5
CC
4
Cov
100%
_get_implementation_name
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
↑ Summary
1 package CGI::Application::Plugin::OpenTracing::DataDog;
2  
3 10 ▶use parent 'CGI::Application::Plugin::OpenTracing';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 10 our $VERSION = 'v0.1.0';
6  
7 10 ▶use Carp qw( croak carp );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use Import::Into;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 10 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 10 Readonly $IMPLEMENTATION_NAME_PACKAGE => 'DataDog';
13 10 Readonly $IMPLEMENTATION_NAME_NOOP => 'NoOp';
14  
15  
16  
17 10 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
18 10 my $package = shift;
19 10 my @implementation_import_opts = @_;
20
21 10 my $caller = caller;
22 10 my $implementation_name = _get_implementation_name();
23
24 9 CGI::Application::Plugin::OpenTracing->import::into(
25 $caller,
26 $implementation_name,
27 default_service_name => $caller,
28 default_service_type => 'web',
29 default_resource_name => '',
30 @implementation_import_opts
31 );
32
33 9 return;
34 }
35  
36  
37  
38 10 ▶sub _get_implementation_name {
Subroutine _get_implementation_name: called CC=4 SCAR=13.9
39 defined ($ENV{OPENTRACING_IMPLEMENTATION} )
40 10 ▶ or
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{"OPENTRACING_IMPLEMENTATION"} or return $IMPLEMENTATION_NAME_PACKAGE 3 7 10
41 return $IMPLEMENTATION_NAME_PACKAGE;
42
43 3 ▶ $ENV{OPENTRACING_IMPLEMENTATION} eq $IMPLEMENTATION_NAME_PACKAGE
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"OPENTRACING_IMPLEMENTATION"} eq $IMPLEMENTATION_NAME_PACKAGE and return $IMPLEMENTATION_NAME_PACKAGE 1 2 3
44 and
45 return $IMPLEMENTATION_NAME_PACKAGE;
46
47 2 ▶ $ENV{OPENTRACING_IMPLEMENTATION} eq $IMPLEMENTATION_NAME_NOOP
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"OPENTRACING_IMPLEMENTATION"} eq $IMPLEMENTATION_NAME_NOOP and return $IMPLEMENTATION_NAME_NOOP 1 1 2
48 and
49 return $IMPLEMENTATION_NAME_NOOP;
50
51 1 croak join q{ },
52 "Environment variable 'OPENTRACING_IMPLEMENTION' must be",
53 "'$IMPLEMENTATION_NAME_PACKAGE' or '$IMPLEMENTATION_NAME_NOOP'",
54 "not '$ENV{OPENTRACING_IMPLEMENTATION}'",
55 ;
56
57 }
58  
59 10 1;
↑ Summary