Skip to content

Commit

Permalink
Add missing methods to OTLP mock in test
Browse files Browse the repository at this point in the history
  • Loading branch information
jjatria committed Nov 23, 2023
1 parent 7c33d7a commit 722d696
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions t/OpenTelemetry/Exporter/OTLP.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use experimental 'signatures';

use HTTP::Tiny;
use OpenTelemetry::Constants
'HEX_INVALID_SPAN_ID',
'INVALID_SPAN_ID',
-trace_export,
-span_kind,
Expand All @@ -25,15 +26,18 @@ my $span_mock = mock 'Local::Span' => add => [
dropped_links => 0,
end_timestamp => 100,
events => sub { },
hex_parent_span_id => sub { HEX_INVALID_SPAN_ID },
hex_span_id => sub { shift->{context}->hex_span_id },
hex_trace_id => sub { shift->{context}->hex_trace_id },
kind => sub { SPAN_KIND_INTERNAL },
links => sub { },
name => sub { shift->{name} //= 'X' },
parent_span_id => sub { INVALID_SPAN_ID },
span_id => sub { shift->{context}->span_id },
span_id => sub { shift->{context}->span_id },
start_timestamp => 0,
status => sub { OpenTelemetry::Trace::Span::Status->ok },
trace_flags => sub { shift->{context}->trace_flags },
trace_id => sub { shift->{context}->trace_id },
trace_id => sub { shift->{context}->trace_id },
trace_state => sub { shift->{context}->trace_state },
new => sub ( $class, %data ) {
$data{context} //= OpenTelemetry::Trace::SpanContext->new;
Expand Down

0 comments on commit 722d696

Please sign in to comment.