SDK/Trace/SpanLimits.pm

filter: Statementstmt 100% 43 / 43 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 100% 8 / 8 totaltotal 100% 64 / 64 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« SDK/Trace/Span/Readable.pm ↑ Summary
1 6 ▶use Object::Pad ':experimental( init_expr mop )';
Subroutine BEGIN: called CC=1 SCAR=0.0
2 # ABSTRACT: A class that governs the configuration of spans
3  
4 package OpenTelemetry::SDK::Trace::SpanLimits;
5  
6 6 our $VERSION = '0.101';
7  
8 class OpenTelemetry::SDK::Trace::SpanLimits {
9 6 ▶ use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶ use OpenTelemetry::Common 'config';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶ use Ref::Util 'is_arrayref';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶ use Scalar::Util 'looks_like_number';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 6 my $logger = OpenTelemetry::Common::internal_logger;
15  
16 8 field $attribute_count_limit :reader = config(qw( SPAN_ATTRIBUTE_COUNT_LIMIT ATTRIBUTE_COUNT_LIMIT )) // 128;
17 8 ▶ field $event_attribute_count_limit :reader = config(qw( EVENT_ATTRIBUTE_COUNT_LIMIT ATTRIBUTE_COUNT_LIMIT )) // 128;
Subroutine attribute_count_limit: called CC=1 SCAR=0.0
Pod documented
18 15 ▶ field $link_attribute_count_limit :reader = config(qw( LINK_ATTRIBUTE_COUNT_LIMIT ATTRIBUTE_COUNT_LIMIT )) // 128;
Subroutine event_attribute_count_limit: called CC=1 SCAR=0.0
Pod documented
19  
20 9 ▶ field $attribute_length_limit :reader = config(qw( SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT ATTRIBUTE_VALUE_LENGTH_LIMIT ));
Subroutine link_attribute_count_limit: called CC=1 SCAR=0.0
Pod documented
21 7 ▶ field $event_attribute_length_limit :reader = config(qw( EVENT_ATTRIBUTE_VALUE_LENGTH_LIMIT ATTRIBUTE_VALUE_LENGTH_LIMIT ));
Subroutine attribute_length_limit: called CC=1 SCAR=0.0
Pod documented
22 14 ▶ field $link_attribute_length_limit :reader = config(qw( LINK_ATTRIBUTE_VALUE_LENGTH_LIMIT ATTRIBUTE_VALUE_LENGTH_LIMIT ));
Subroutine event_attribute_length_limit: called CC=1 SCAR=0.0
Pod documented
23  
24 2 ▶ field $event_count_limit :reader = config(qw( SPAN_EVENT_COUNT_LIMIT )) // 128;
Subroutine link_attribute_length_limit: called CC=1 SCAR=0.0
Pod documented
25 16 ▶ field $link_count_limit :reader = config(qw( SPAN_LINK_COUNT_LIMIT )) // 128;
Subroutine event_count_limit: called CC=1 SCAR=0.0
Pod documented
26  
27 9 ▶ ADJUST {
Subroutine link_count_limit: called CC=1 SCAR=0.0
Pod documented
28 my $meta = Object::Pad::MOP::Class->for_caller;
29  
30 my $optional_number_with_min = sub ( $name, $min ) {
31 my $field = $meta->get_field( '$' . $name );
32 my $value = $field->value($self);
33  
34 return unless defined $value;
35 return if looks_like_number $value && int $value == $value && $value >= $min;
36  
37 $logger->warn(
38 "Invalid value for SpanLimits: $name must be an integer greater than $min if set",
39 { value => $value },
40 );
41  
42 $field->value($self) = undef;
43 };
44  
45 my $must_be_positive_int = sub ( $name, $default ) {
46 my $field = $meta->get_field( '$' . $name );
47 my $value = $field->value($self);
48  
49 return if looks_like_number $value && int $value == $value && $value > 0;
50  
51 $logger->warn(
52 "Invalid value for SpanLimits: $name must be a positive integer",
53 { value => $value },
54 );
55  
56 $field->value($self) = $default;
57 };
58  
59 $optional_number_with_min->( attribute_length_limit => 32 );
60 $optional_number_with_min->( event_attribute_length_limit => 32 );
61 $optional_number_with_min->( link_attribute_length_limit => 32 );
62  
63 $must_be_positive_int->( event_attribute_count_limit => 128 );
64 $must_be_positive_int->( link_attribute_count_limit => 128 );
65 $must_be_positive_int->( attribute_count_limit => 128 );
66 $must_be_positive_int->( event_count_limit => 128 );
67 $must_be_positive_int->( link_count_limit => 128 );
68 }
69 6 }
« SDK/Trace/Span/Readable.pm ↑ Summary