DataDog/Span.pm

filter: Statementstmt 54.5% 12 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod n/a totaltotal 47.0% 16 / 34 CC 3 SCAR 11.6
CC
3
Cov
46%
parent_span_id
6.0
DEMOLISH
6.0
nano_seconds_start_time
2.0
CRAP 3.2
« DataDog/Scope.pm ↑ Summary DataDog/Agent.pm »
1 package OpenTracing::Implementation::DataDog::Span;
2  
3  
4 4 ▶use syntax 'maybe';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 with 'OpenTracing::Role::Span';
9  
10 4 use OpenTracing::Implementation::DataDog::Utils qw(
11 random_64bit_int
12 nano_seconds
13 4 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 ▶use Types::Standard qw/CodeRef Object/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18  
19 has span_id => (
20 is => 'ro',
21 init_arg => undef,
22 default => sub{ random_64bit_int() }
23 );
24  
25  
26  
27 has child_of => (
28 is => 'ro',
29 isa =>Object, # does Span or does SpanContext
30 required => 1,
31 );
32  
33  
34  
35 has on_DEMOLISH => (
36 is => 'ro',
37 isa => CodeRef,
38 default => sub { sub { } }
39 );
40  
41  
42  
43 sub parent_span_id {
44 0 ▶ my $self = shift;
Subroutine parent_span_id: not called CC=2 SCAR=17.9
45
46 0 my $parent = $self->{ child_of };
47 0 ▶ return unless $parent->does('OpenTracing::Role::Span');
Branch: 1 branch
BranchTrueFalseTotal
unless $parent->does("OpenTracing::Role::Span") 0 0 0
48
49 0 return $parent->span_id
50 }
51 #
52 # This may not be the right way to implement it, for the `child_of` attribute
53 # may not be such a good idea, maybe it should use references, but not sure how
54 # those are used
55  
56  
57  
58  
59  
60 0 ▶sub nano_seconds_start_time { nano_seconds( $_[0]->start_time ) }
Subroutine nano_seconds_start_time: not called CC=1 SCAR=6.9
61  
62 0 ▶sub nano_seconds_duration { nano_seconds( $_[0]->duration ) }
Subroutine nano_seconds_duration: not called CC=1 SCAR=6.9
63  
64  
65  
66 sub DEMOLISH {
67 0 ▶ my $self = shift;
Subroutine DEMOLISH: not called CC=2 SCAR=17.9
68 0 my $in_global_destruction = shift;
69
70 0 ▶ $self->on_DEMOLISH->( $self )
Branch: 1 branch
BranchTrueFalseTotal
unless $in_global_destruction 0 0 0
71 unless $in_global_destruction;
72
73 return
74 0 }
75  
76  
77  
78 1;
« DataDog/Scope.pm ↑ Summary DataDog/Agent.pm »