Skip to content

Commit

Permalink
Span processor's shutdown and force_flush are not async
Browse files Browse the repository at this point in the history
  • Loading branch information
jjatria committed Nov 22, 2023
1 parent a319150 commit d2fe432
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Revision history for OpenTelemetry

{{$NEXT}}

* The 'shutdown' and 'force_flush' methods of span processors
are no longer expected to return Future objects. This makes them
consistent with the equivalent methods in the exporter and the
SDK's tracer provider. So far, all internal uses of these methods
were blocking.

0.017 2023-11-19 12:39:37+00:00 Europe/London

* Undo conditional logic in Tracer's in_span introduced in 0.016.
Expand Down
2 changes: 0 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
"Exporter::Tiny" : "0.044",
"Feature::Compat::Defer" : "0",
"Feature::Compat::Try" : "0",
"Future" : "0.26",
"Future::AsyncAwait" : "0",
"List::Util" : "1.45",
"Log::Any" : "0",
"Module::Pluggable" : "0",
Expand Down
2 changes: 0 additions & 2 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ requires 'Class::Method::Modifiers';
requires 'Exporter::Tiny', '0.044'; # For -as => CODE support
requires 'Feature::Compat::Defer';
requires 'Feature::Compat::Try';
requires 'Future', '0.26'; # For Future->done
requires 'Future::AsyncAwait';
requires 'List::Util', '1.45'; # For uniq
requires 'Log::Any';
requires 'Module::Pluggable';
Expand Down
32 changes: 14 additions & 18 deletions lib/OpenTelemetry/Trace/Span/Processor.pod
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ OpenTelemetry::Trace::Span::Processor - Abstract interface of an OpenTelemetry s
=head1 SYNOPSIS

use Object::Pad;
use Future::AsyncAwait;

class My::Processor :does(OpenTelemetry::Trace::Span::Processor) {
method on_start ( $span, $context ) { ... }
method on_end ( $span ) { ... }

async method shutdown ( $timeout // undef ) { ... }
async method force_flush ( $timeout // undef ) { ... }
method shutdown ( $timeout // undef ) { ... }
method force_flush ( $timeout // undef ) { ... }
}

# Create it
Expand Down Expand Up @@ -82,35 +81,32 @@ The return value of this method is ignored.

=head2 shutdown

$result = await $processor->shutdown( $timeout // undef );
$result = $processor->shutdown( $timeout // undef );

Takes an optional timeout value and returns a L<Future> that will be done
when this span processor has completed shutting down. The shutdown process must
include the effects of L<force_flush>, described below. After shutting down,
the processor is not expected to do any further work, and should ignore any
subsequent calls.
Takes an optional timeout value and returns when this span processor has
completed shutting down. The shutdown process must include the effects of
L<force_flush>, described below. After shutting down, the processor is not
expected to do any further work, and should ignore any subsequent calls.

The value of the future will be one of the
The return value will be one of the
L<OpenTelemetry::Constants/Trace Export Results>.

=head2 force_flush

$result = await $processor->force_flush( $timeout // undef );
$result = $processor->force_flush( $timeout // undef );

Takes an optional timeout value and returns a L<Future> that will be done
when this span processor has finished flushing. Flushing signals to the span
processor that it should process the data for any unprocessed spans as soon as
possible. This could be due to an imminent shutdown, but does not have to be.
Takes an optional timeout value and returns when this span processor has
finished flushing. Flushing signals to the span processor that it should
process the data for any unprocessed spans as soon as possible. This could
be due to an imminent shutdown, but does not have to be.

The value of the future will be one of the
The return value will be one of the
L<OpenTelemetry::Constants/Trace Export Results>.

=head1 SEE ALSO

=over

=item L<Future>

=item L<OpenTelemetry::Constants>

=item L<OpenTelemetry::Exporter>
Expand Down

0 comments on commit d2fe432

Please sign in to comment.