
=head1 NAME

OpenTracing::Implementation - Use OpenTracing with a specific implementation

=head1 VERSION

'v0.32.0'

=head1 SYNOPSIS

    use OpenTracing::Implementation 'YourBackend', option_one => 'foo';

Or if you like

    use OpenTracing::Implementation;

And one can then do a manual bootstrap

    OpenTracing::Implementation->bootstrap_global_tracer( '+My::Implementation',
        option_one => 'foo',
        option_two => 'bar',
    );

Alternativly, when you like to rely on environment variables

    my $tracer = OpenTracing::Implementation->bootstrap_default_tracer(
        option_one => 'foo',
        option_two => 'bar',
    );
    # but maybe not all options make sense to every tracer, be warned
    
    OpenTracing::GlobalTracer->set_global_tracer( $tracer );

Or if you just want a bootastrapped tracer:

    my $tracer = OpenTracing::Implementation->bootstrap_tracer( 'ProviderFoo'
        option_one => 'foo',
        option_two => 'bar',
    );



=head1 DESCRIPTION

This module provides an easy way to bootstrap a specific
C<OpenTracing::Implementation> compliant tracer and have it globally available.



=head1 CLASS METHODS



=head2 C<bootstrap_tracer>

Bootstraps a given tracer implementation with various options for that tracer.

=over

=item Required Positional Paramaters

=over

=item implementation_name

Must be a C<Str> type. It will look for the implementation inside the
C<OpenTracing::Implementation> namespace, so it is easy to specify any of the
exisitng ones like C<NoOp>, C<Test>, and C<DataDog>.

If a tracer lives outside that namespace, it would need to be prepended with a
C<+>, like in C<+My::Iplementation>.

=back

=item Optional Parameters

Any parameters required to bootstrap the given implementation according to their
specifications and documentation.

=item Retruns

=over

=item The build Tracer object

=back

=back



=head2 C<bootstrap_default_tracer>

Same as C<bootstrap_tracer>, except that it will use whatever is specified in
the C<OPENTRACING_IMPLEMENTATION> environment variable, Or C<NoOp> if not set.

Do not pass in the name as first argument.



=head2 C<bootstrap_global_tracer>

Same as C<bootstrap_tracer>, but additionally sets the 'singleton' inside
L<OpenTracing::GlabalTracer>.



=head1 ENVIRONMENT VARIABLES



=head2 C<OPENTRACING_IMPLEMENTATION>

Will be used when calling C<bootstrap_default_tracer>.

=head1 AUTHOR

Theo van Hoesel <tvanhoesel@perceptyx.com>

=head1 COPYRIGHT AND LICENSE

'OpenTracing Implementation' is Copyright (C) 2020, Perceptyx Inc

This package is free software; you can redistribute it and/or modify it under
the terms of the Artistic License 2.0.

This package is distributed in the hope that it will be useful, but it is
provided "as is" and without any express or implied warranties.

For details, see the full text of the license in the file LICENSE.


=cut

1;
