NAME

OpenTelemetry::Processor - An abstract interface for OpenTelemetry processors

SYNOPSIS

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

class My::Processor :does(OpenTelemetry::Processor) {
          method process     { ... }
    async method shutdown    { ... }
    async method force_flush { ... }

    # Any additional methods in your processor
    ...
}

my $processor = My::Processor->new;

DESCRIPTION

This package provides an Object::Pad role that defines the interface that OpenTelemetry processor classes should implement. Processors are objects that represent the start of a pipeline that starts with a provider and will, in most cases, end with a class implementing the OpenTelemetry::Exporter role.

METHODS

Although there is unfortunately no way to currently enforce it, this document describes the way the methods of a class implementing this role are expected to behave.

process

$processor->process(@items)

Takes a list of elements to process, and calls "export" on the configured exporter on those elements. Returns nothing.

shutdown

$result = await $processor->shutdown( ... )

Calls "shutdown" on the configured exporter and returns a Future that will hold the result of that operation.

force_flush

$result = await $processor->force_flush( ... )

Calls "force_flush" on the configured exporter and returns a Future that will hold the result of that operation.

SEE ALSO

Future
Object::Pod
OpenTelemetry::Exporter

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 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.