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. Calling this will convert the span into a readable instance and forward it to the configured exporter.

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

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.