NAME

OpenTelemetry::Propagator::Composite - A composite context propagator for OpenTelemetry

SYNOPSIS

use OpenTelemetry::Propagator::Composite;
use OpenTelemetry::Propagator::Baggage;
use OpenTelemetry::Propagator::TraceContext;

my $propagator = OpenTelemetry::Propagator::Composite->new(
    OpenTelemetry::Propagator::Baggage->new,
    OpenTelemetry::Propagator::TraceContext->new,
);

# Inject data from the context to a carrier using all injectors in order
my $carrier = {};
$propagator->inject( $carrier, $context );

# Extract data from a carrier to the context using all extractors in order
my $new_context = $propagator->extract( $carrier, $context );

DESCRIPTION

This package defines a propagator class that interact with the context (which can be either an implicit or explicit instance of OpenTelemetry::Context) and inject or extract data using a composite of objects implementing the OpenTelemetry::Propagator interface. Injectors and extractors can be set separately, and will be called in order when they are used.

This composite propagator itself implements the OpenTelemetry::Propagator interface.

METHODS

new

$propagator = OpenTelemetry::Propagator::Composite->new(@propagators)

Constructs a new instance of this propagator. Takes a potentially empty list of objects that implement the OpenTelemetry::Propagator interface. Calls to inject and extract will be delegated to these in the order they were specified.

SEE ALSO

OpenTelemetry::Context
OpenTelemetry::Propagator

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.