line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenTracing::Role::SpanContext; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = 'v0.86.0'; |
4
|
|
|
|
|
|
|
|
5
|
19
|
|
|
19
|
|
1084601
|
use Moo::Role; |
|
19
|
|
|
|
|
17029
|
|
|
19
|
|
|
|
|
125
|
|
6
|
19
|
|
|
19
|
|
10998
|
use MooX::HandlesVia; |
|
19
|
|
|
|
|
8472
|
|
|
19
|
|
|
|
|
156
|
|
7
|
19
|
|
|
19
|
|
4840
|
use MooX::Should; |
|
19
|
|
|
|
|
21787
|
|
|
19
|
|
|
|
|
157
|
|
8
|
|
|
|
|
|
|
|
9
|
19
|
|
|
19
|
|
10746
|
use Data::GUID; |
|
19
|
|
|
|
|
286093
|
|
|
19
|
|
|
|
|
140
|
|
10
|
19
|
|
|
19
|
|
12018
|
use Sub::Trigger::Lock; |
|
19
|
|
|
|
|
49757
|
|
|
19
|
|
|
|
|
265
|
|
11
|
19
|
|
|
19
|
|
9779
|
use Types::Standard qw/HashRef Str/; |
|
19
|
|
|
|
|
550425
|
|
|
19
|
|
|
|
|
178
|
|
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
|
4434
|
my $self = shift; |
46
|
6
|
|
|
|
|
10
|
my $item_key = shift; |
47
|
|
|
|
|
|
|
|
48
|
6
|
|
|
|
|
111
|
return { $self->get_baggage_items() }->{ $item_key } |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new_clone { |
52
|
3
|
|
|
3
|
1
|
194
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
7
|
my $class = ref $self; |
55
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
59
|
$class->new( %$self ) |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
2
|
|
|
2
|
1
|
615
|
sub with_trace_id { $_[0]->clone_with( trace_id => $_[1] ) } |
60
|
|
|
|
|
|
|
|
61
|
6
|
|
|
6
|
1
|
636
|
sub with_span_id { $_[0]->clone_with( span_id => $_[1] ) } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub with_baggage_item { |
64
|
1
|
|
|
1
|
1
|
1455
|
my ( $self, $key, $value ) = @_; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
35
|
$self->clone_with( |
67
|
|
|
|
|
|
|
baggage_items => { $self->get_baggage_items(), $key => $value }, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub with_baggage_items { |
72
|
3
|
|
|
3
|
1
|
13381
|
my ( $self, %args ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
3
|
|
|
|
|
61
|
$self->clone_with( |
75
|
|
|
|
|
|
|
baggage_items => { $self->get_baggage_items(), %args }, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub clone_with { |
80
|
12
|
|
|
12
|
0
|
649
|
my ( $self, @args ) = @_; |
81
|
|
|
|
|
|
|
|
82
|
12
|
|
|
|
|
93
|
bless { %$self, @args }, ref $self; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
BEGIN { |
89
|
|
|
|
|
|
|
# use Role::Tiny::With; |
90
|
19
|
|
|
19
|
|
56504
|
with 'OpenTracing::Interface::SpanContext' |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |