File Coverage

blib/lib/OpenTracing/SpanContext.pm
Criterion Covered Total %
statement 15 21 71.4
branch n/a
condition n/a
subroutine 5 8 62.5
pod 3 3 100.0
total 23 32 71.8


line stmt bran cond sub pod time code
1             package OpenTracing::SpanContext;
2              
3 2     2   15 use strict;
  2         4  
  2         64  
4 2     2   10 use warnings;
  2         4  
  2         99  
5              
6             our $VERSION = '1.006'; # VERSION
7             our $AUTHORITY = 'cpan:TEAM'; # AUTHORITY
8              
9 2     2   11 use parent qw(OpenTracing::Common);
  2         3  
  2         18  
10              
11 2     2   105 no indirect;
  2         4  
  2         10  
12 2     2   101 use utf8;
  2         3  
  2         9  
13              
14             =encoding utf8
15              
16             =head1 NAME
17              
18             OpenTracing::SpanContext - tracks IDs and baggage for spans
19              
20             =head1 DESCRIPTION
21              
22             =cut
23              
24             =head2 span
25              
26             Returns the L instance that this wraps.
27              
28             =cut
29              
30 0     0 1   sub span { shift->{span} }
31              
32             =head2 log
33              
34             Writes a log entry to the L.
35              
36             =cut
37              
38 0     0 1   sub log { shift->span->log(@_) }
39              
40             =head2 new_span
41              
42             Creates a new sub-span under this L instance.
43              
44             =cut
45              
46             sub new_span {
47 0     0 1   my ($self, $name, %args) = @_;
48 0           my $parent = $self->span;
49 0           @args{qw(trace_id parent_id)} = (
50             $parent->trace_id,
51             $parent->id,
52             );
53 0           $parent->tracer->span(operation_name => $name, %args);
54             }
55              
56             =head2 DESTROY
57              
58             Called on destruction, will mark completion on the span by calling
59             L.
60              
61             =cut
62              
63             1;
64              
65             __END__