| 1 | 2 | ▶ | use Object::Pad ':experimental(init_expr)'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | # ABSTRACT: A batched OpenTelemetry span processor | ||||||||||
| 3 | |||||||||||
| 4 | package OpenTelemetry::SDK::Trace::Span::Processor::Batch; | ||||||||||
| 5 | |||||||||||
| 6 | 2 | our $VERSION = '0.101'; | |||||||||
| 7 | |||||||||||
| 8 | class OpenTelemetry::SDK::Trace::Span::Processor::Batch | ||||||||||
| 9 | :isa(OpenTelemetry::Processor::Batch) | ||||||||||
| 10 | :does(OpenTelemetry::Trace::Span::Processor) | ||||||||||
| 11 | 2 | ▶ | { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use OpenTelemetry::Common (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 2 | ▶ | use OpenTelemetry::Constants -export; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 2 | my $logger = OpenTelemetry::Common::internal_logger; | |||||||||
| 16 | |||||||||||
| 17 | 2 | ▶ | use Metrics::Any '$metrics', strict => 1, | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 2 | name_prefix => [qw( otel processor batch )]; | |||||||||
| 19 | |||||||||||
| 20 | 2 | $metrics->make_counter( 'failure', | |||||||||
| 21 | description => 'Number of times the span processing pipeline failed irrecoverably', | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 2 | $metrics->make_counter( 'success', | |||||||||
| 25 | description => 'Number of spans that were successfully processed', | ||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | 2 | $metrics->make_counter( 'dropped', | |||||||||
| 29 | name => [qw( spans dropped )], | ||||||||||
| 30 | description => 'Number of spans that could not be processed and were dropped', | ||||||||||
| 31 | labels => [qw( reason )], | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | 2 | $metrics->make_counter( 'processed', | |||||||||
| 35 | name => [qw( spans processed )], | ||||||||||
| 36 | description => 'Number of spans that were successfully processed', | ||||||||||
| 37 | ); | ||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | method report_dropped ( $reason, $count ) { | ||||||||
|
Subroutine
report_dropped: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 40 | 0 | $metrics->inc_counter_by( dropped => $count => [ reason => $reason ] ); | |||||||||
| 41 | 0 | $self; | |||||||||
| 42 | 2 | } | |||||||||
| 43 | |||||||||||
| 44 | 1 | ▶ | method report_result ( $result, $count ) { | ||||||||
|
Subroutine
report_result: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 45 | 1 | ▶ | if ( $result == EXPORT_RESULT_SUCCESS ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 1 | $metrics->inc_counter('success'); | |||||||||
| 47 | 1 | $metrics->inc_counter_by( processed => $count ); | |||||||||
| 48 | } | ||||||||||
| 49 | else { | ||||||||||
| 50 | 0 | $metrics->inc_counter('failure'); | |||||||||
| 51 | 0 | $self->report_dropped( 'export-failure' => $count ); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 1 | return $result; | |||||||||
| 55 | 2 | } | |||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | method on_start ( $span, $context ) { } | ||||||||
|
Subroutine
on_start: not called CC=1 SCAR=4.1
Pod
documented
| |||||||||||
| 58 | |||||||||||
| 59 | 4 | ▶ | method on_end ($span) { | ||||||||
|
Subroutine
on_end: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 60 | 4 | ▶ | return if $self->done; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 4 | ▶ | return unless $span->context->trace_flags->sampled; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 2 | $self->process( $span->snapshot ); | |||||||||
| 63 | 2 | } | |||||||||
| 64 | 2 | } | |||||||||