Skip to content

Commit

Permalink
Make all shutdown and force_flush methods async
Browse files Browse the repository at this point in the history
  • Loading branch information
jjatria committed Nov 23, 2023
1 parent 9e89b42 commit 747a323
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Revision history for OpenTelemetry

{{$NEXT}}

* Document all shutdown and force_flush methods as async

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
35 changes: 20 additions & 15 deletions lib/OpenTelemetry/Exporter.pod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ OpenTelemetry::Exporter - Abstract interface of an OpenTelemetry exporter

use Object::Pad;
use OpenTelemetry::SDK::Trace::Span::Processor::Batch;
use Future::AsyncAwait;

class My::Exporter :does(OpenTelemetry::Exporter) {
method export ( $spans, $timeout // undef ) { ... }
method shutdown ( $timeout // undef ) { ... }
method force_flush ( $timeout // undef ) { ... }
method export ( $spans, $timeout // undef ) { ... }

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

# Use it with a span processor
Expand Down Expand Up @@ -51,32 +53,35 @@ L<OpenTelemetry::Constants/Trace Export Results>.

=head2 shutdown

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

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

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

=head2 force_flush

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

Takes an optional timeout value and returns the outcome of the flushing
process. Flushing signals to the exporter that it should export the data for
any unexported 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 a L<Future> that will be done
when this exporter has finished flushing. Flushing signals to the exporter
that it should export 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 return value will be one of the
The value of the future 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::Trace::Span::Processor>
Expand Down

0 comments on commit 747a323

Please sign in to comment.