| 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
| |||||||||||||||||||||||
| 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 | } | |||||||||||||||||||||