NAME

OpenTracing::Implementation - Use OpenTracing with a specific implementation

VERSION

'v0.33.2'

SYNOPSIS

use OpenTracing::Implementation;

OpenTracing::Implementation->bootstrap_global_default_tracer();

The above is the recommended usecase, which will instantiate the default tracer from PERL_OPENTRACING_IMPLEMENTATION environment variable and set the OpenTracing::GlobalTracer for general usage.

But you can still do the below:

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

Which instantiates the OpenTracing::GlobalTracer.

Or if you like

use OpenTracing::Implementation;

Which will only use the module. And then one can 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',
);

DESCRIPTION

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

CLASS METHODS

bootstrap_tracer

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

Required Positional Paramaters
implementation_name

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

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

Optional Parameters

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

Retruns
The build Tracer object

bootstrap_default_tracer

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

Do not pass in the name as first argument.

bootstrap_global_tracer

Same as bootstrap_tracer, but additionally sets the 'singleton' inside OpenTracing::GlabalTracer.

bootstrap_global_default_tracer

Same as bootstrap_global_tracer combined with bootstrap_default_tracer, it sets the 'singleton' inside OpenTracing::GlabalTracer with the default tracer from PERL_OPENTRACING_IMPLEMENTATION.

NB: it is considdered that (after years) this should be the ONLY method made available, and that all configuration SHOULD be done throughout environment variables, and not via code.

ENVIRONMENT VARIABLES

PERL_OPENTRACING_IMPLEMENTATION

Will be used when calling bootstrap_default_tracer or bootstrap_global_default_tracer.

NB: OPENTRACING_IMPLEMENTATION is being depricated.

When neither is set, and either bootstrap_default_tracer or bootstrap_global_default_tracer is called, instantiation will try to fall back to the OpenTracing::Implementation::NoOp Tracer.

PERL_OPENTRACING_DEBUG

This controls at OpenTracing level weather or not to enable or disable debugging messages. Its value being set will override a more generic DEBUG varaible.

NB: OPENTRACING_DEBUG is being depricated.

DEBUG

This module respects the generic DEBUG environment variable. But it will be (locally) overridden by the PERL_OPENTRACING_DEBUG envirtonment variable.

AUTHOR

Theo van Hoesel <tvanhoesel@perceptyx.com>

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.