SDK/Trace/Sampler/ParentBased.pm

filter: Statementstmt 63.6% 21 / 33 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 55.1% 27 / 49 CC 5 SCAR 27.4
CC
5
Cov
51%
should_sample
30.0
description
1.5
BEGIN
1.0
CRAP 15.6
« SDK/Resource.pm ↑ Summary SDK.pm »
1 4 ▶use Object::Pad ':experimental(init_expr)';
Subroutine BEGIN: called CC=1 SCAR=0.0
2 # ABSTRACT: A composite sampler
3  
4 package OpenTelemetry::SDK::Trace::Sampler::ParentBased;
5  
6 4 our $VERSION = '0.101';
7  
8 class OpenTelemetry::SDK::Trace::Sampler::ParentBased
9 :does(OpenTelemetry::SDK::Trace::Sampler)
10 {
11 4 ▶ use OpenTelemetry::Trace;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶ use OpenTelemetry::SDK::Trace::Sampler::AlwaysOff;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶ use OpenTelemetry::SDK::Trace::Sampler::AlwaysOn;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 field $root :param;
16 field $remote_parent_sampled :param //= OpenTelemetry::SDK::Trace::Sampler::AlwaysOn->new;
17 4 field $remote_parent_not_sampled :param //= OpenTelemetry::SDK::Trace::Sampler::AlwaysOff->new;
18 4 field $local_parent_sampled :param //= OpenTelemetry::SDK::Trace::Sampler::AlwaysOn->new;
19 4 field $local_parent_not_sampled :param //= OpenTelemetry::SDK::Trace::Sampler::AlwaysOff->new;
20  
21 0 ▶ method description () {
Subroutine description: not called CC=1 SCAR=4.1
Pod documented
22 0 sprintf 'ParentBased{root=%s,remote_parent_sampled=%s,remote_parent_not_sampled=%s,local_parent_sampled=%s,local_parent_not_sampled=%s}',
23 map $_->description,
24 $root,
25 $remote_parent_sampled,
26 $remote_parent_not_sampled,
27 $local_parent_sampled,
28 $local_parent_not_sampled;
29 4 }
30  
31 0 ▶ method should_sample (%args) {
Subroutine should_sample: not called CC=5 SCAR=34.0
Pod documented
32 my $span_context = OpenTelemetry::Trace
33 0 ->span_from_context($args{context})->context;
34  
35 0 my $sampled = $span_context->trace_flags->sampled;
36  
37 0 ▶ my $delegate = !$span_context->valid
Branch: 4 branches
BranchTrueFalseTotal
!$span_context->valid ? : 0 0 0
$span_context->remote ? : 0 0 0
$sampled ? : 0 0 0
$sampled ? : 0 0 0
38 ? $root
39 : $span_context->remote
40 ? $sampled
41 ? $remote_parent_sampled
42 : $remote_parent_not_sampled
43 : $sampled
44 ? $local_parent_sampled
45 : $local_parent_not_sampled;
46  
47 0 $delegate->should_sample(%args);
48 4 }
49 4 }
« SDK/Resource.pm ↑ Summary SDK.pm »