NAME
OpenTelemetry::SDK::Trace::Span::Processor::Simple - A basic OpenTelemetry span processor
SYNOPSIS
...
DESCRIPTION
This is a simple span processor that receives read-only OpenTelemetry::Trace::Span instances and forwards them to an exporter as readable instances of OpenTelemetry::SDK::Trace::Span::Readable.
This processor will mostly be useful for testing. It could be suitable for use in production environments in cases where custom attributes should be added to spans based on code scopes, etc.
METHODS
This class implements the OpenTelemetry::Trace::Span::Processor role. Please consult that module's documentation for details on the behaviours it provides.
new
$processor = OpenTelemetry::SDK::Trace::Processor::Simple->new(
exporter => $span_exporter,
);
The constructor takes a mandatory exporter
parameter that must be set to an instance of a class that implements the OpenTelemetry::Exporter role.
on_start
$processor->on_start( $span, $parent_context );
Called when a span is started. In this class, this method does nothing.
on_end
$processor->on_end( $span );
Called when a span is ended, with the span that has just ended as its only parameter. This should be called after the span has been ended.
This method internally passes the span to "process", described in more detail below.
process
$processor->process( @spans );
Takes a list of spans that are ready for processing. Once called, this method will convert them into a readable instances and pass them to the configured exporter.
This processor handles each span as it becomes ready and blocks during the export step. For a non-blocking processor that batches spans for eventual processing (and is therefore more suitable for production environments), see OpenTelemetry::SDK::Trace::Processor::Batch.
force_flush
$result = await $processor->force_flush( $timeout );
Calls "force_flush" on the configured exporter and returns a Future that will hold the result of that operation.
shutdown
$result = await $processor->shutdown( $timeout );
Calls "shutdown" on the configured exporter and returns a Future that will hold the result of that operation.
SEE ALSO
- Future
- OpenTelemetry::Exporter
- OpenTelemetry::SDK::Trace::Span::Readable
- OpenTelemetry::Trace::Span
- OpenTelemetry::Trace::Span::Processor
- OpenTelemetry::Trace::Span::Processor::Batch
COPYRIGHT AND LICENSE
This software is copyright (c) 2023 by José Joaquín Atria.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.