line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenTracing::Role::SpanContext; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = 'v0.86.1'; |
4
|
|
|
|
|
|
|
|
5
|
19
|
|
|
19
|
|
1123460
|
use Moo::Role; |
|
19
|
|
|
|
|
18340
|
|
|
19
|
|
|
|
|
140
|
|
6
|
19
|
|
|
19
|
|
11448
|
use MooX::HandlesVia; |
|
19
|
|
|
|
|
8840
|
|
|
19
|
|
|
|
|
209
|
|
7
|
19
|
|
|
19
|
|
5027
|
use MooX::Should; |
|
19
|
|
|
|
|
22222
|
|
|
19
|
|
|
|
|
178
|
|
8
|
|
|
|
|
|
|
|
9
|
19
|
|
|
19
|
|
11784
|
use Data::GUID; |
|
19
|
|
|
|
|
296526
|
|
|
19
|
|
|
|
|
140
|
|
10
|
19
|
|
|
19
|
|
12797
|
use Sub::Trigger::Lock; |
|
19
|
|
|
|
|
52384
|
|
|
19
|
|
|
|
|
291
|
|
11
|
19
|
|
|
19
|
|
10013
|
use Types::Standard qw/HashRef Str/; |
|
19
|
|
|
|
|
593693
|
|
|
19
|
|
|
|
|
184
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has trace_id => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
# should => Uuid, # not restraints here, do so when consuming this |
16
|
|
|
|
|
|
|
init_arg => undef, |
17
|
|
|
|
|
|
|
default => sub { Data::GUID->new }, |
18
|
|
|
|
|
|
|
trigger => Lock, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has span_id => ( |
22
|
|
|
|
|
|
|
is => 'rw', |
23
|
|
|
|
|
|
|
# should => Uuid, # not restraints here, do so when consuming this |
24
|
|
|
|
|
|
|
init_arg => undef, |
25
|
|
|
|
|
|
|
default => sub { Data::GUID->new }, |
26
|
|
|
|
|
|
|
trigger => Lock, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has baggage_items => ( |
30
|
|
|
|
|
|
|
is => 'rwp', |
31
|
|
|
|
|
|
|
should => HashRef[Str], |
32
|
|
|
|
|
|
|
handles_via => 'Hash', |
33
|
|
|
|
|
|
|
handles => { |
34
|
|
|
|
|
|
|
# get_baggage_item => 'get', |
35
|
|
|
|
|
|
|
get_baggage_items => 'all', |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
default => sub{ {} }, |
38
|
|
|
|
|
|
|
trigger => Lock, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# XXX: trigger and $obj->get_baggage_item( 'foo' ) do not play well together |
42
|
|
|
|
|
|
|
# feels like a bug in Moo or Sub::Trigger::Lock |
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
sub get_baggage_item { |
45
|
6
|
|
|
6
|
1
|
4190
|
my $self = shift; |
46
|
6
|
|
|
|
|
13
|
my $item_key = shift; |
47
|
|
|
|
|
|
|
|
48
|
6
|
|
|
|
|
112
|
return { $self->get_baggage_items() }->{ $item_key } |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new_clone { |
52
|
3
|
|
|
3
|
1
|
236
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
9
|
my $class = ref $self; |
55
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
60
|
$class->new( %$self ) |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
2
|
|
|
2
|
1
|
621
|
sub with_trace_id { $_[0]->clone_with( trace_id => $_[1] ) } |
60
|
|
|
|
|
|
|
|
61
|
6
|
|
|
6
|
1
|
1198
|
sub with_span_id { $_[0]->clone_with( span_id => $_[1] ) } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub with_baggage_item { |
64
|
1
|
|
|
1
|
1
|
1033
|
my ( $self, $key, $value ) = @_; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
40
|
$self->clone_with( |
67
|
|
|
|
|
|
|
baggage_items => { $self->get_baggage_items(), $key => $value }, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub with_baggage_items { |
72
|
3
|
|
|
3
|
1
|
12797
|
my ( $self, %args ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
3
|
|
|
|
|
64
|
$self->clone_with( |
75
|
|
|
|
|
|
|
baggage_items => { $self->get_baggage_items(), %args }, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub clone_with { |
80
|
12
|
|
|
12
|
0
|
690
|
my ( $self, @args ) = @_; |
81
|
|
|
|
|
|
|
|
82
|
12
|
|
|
|
|
100
|
bless { %$self, @args }, ref $self; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
BEGIN { |
89
|
|
|
|
|
|
|
# use Role::Tiny::With; |
90
|
19
|
|
|
19
|
|
57329
|
with 'OpenTracing::Interface::SpanContext' |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |