DataDog/SpanContext.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 16 / 16 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« DataDog.pm ↑ Summary DataDog/Tracer.pm »
1 package OpenTracing::Implementation::DataDog::SpanContext;
2  
3 =head1 NAME
4  
5 OpenTracing::Implementation::DataDog::SpanContext - Keep track of traces
6  
7 =head1 SYNOPSIS
8  
9 use aliased OpenTracing::Implementation::DataDog::SpanContext;
10
11 my $span_context = SpanContext->new(
12 service_name => "MyFancyService",
13 service_type => "web",
14 resource_name => "/clients/{client_id}/contactdetails",
15 );
16 #
17 # please do not add parameter values in the resource,
18 # use tags instead, like:
19 # $span->set_tag( client_id => $request->query_params('client_id') )
20  
21 =cut
22  
23 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 with 'OpenTracing::Role::SpanContext';
26  
27 2 ▶use OpenTracing::Implementation::DataDog::Utils qw/random_64bit_int/;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 2 ▶use Types::Common::String qw/NonEmptyStr/;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 2 ▶use Types::Standard qw/Enum Int/;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32  
33  
34 has trace_id => (
35 is => 'ro',
36 default => sub { random_64bit_int() },
37 isa => Int,
38 );
39  
40  
41  
42 has service_name => (
43 is => 'ro',
44 required => 1,
45 isa => NonEmptyStr,
46 );
47  
48  
49  
50 has service_type => (
51 is => 'ro',
52 default => 'custom',
53 isa => Enum[qw/web db cache custom/],
54 );
55  
56  
57  
58 has resource_name => (
59 is => 'ro',
60 isa => NonEmptyStr,
61 required => 1,
62 );
63  
64  
65  
66 =head1 CONSTRUCTORS
67  
68  
69  
70 =head2 new
71  
72 my $span_context = SpanContext->new(
73 service_name => "MyFancyService",
74 resource_name => "/clients/{client_id}/contactdetails",
75 baggage_items => { $key => $value, .. },
76 );
77  
78 Creates a new SpanContext object;
79  
80  
81  
82 =head1 ATTRIBUTES
83  
84  
85  
86 =head2 trace_id
87  
88 =head2 service_name
89  
90 =head2 service_type
91  
92 =head2 resource_name
93  
94  
95  
96 =cut
97  
98 1;
« DataDog.pm ↑ Summary DataDog/Tracer.pm »