OpenTracing::Implementation - Use OpenTracing with a specific implementation
'v0.33.2'
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.
PERL_OPENTRACING_IMPLEMENTATION
OpenTracing::GlobalTracer
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', );
This module provides an easy way to bootstrap a specific OpenTracing::Implementation compliant tracer and have it globally available.
OpenTracing::Implementation
bootstrap_tracer
Bootstraps a given tracer implementation with various options for that tracer.
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.
Str
NoOp
Test
DataDog
If a tracer lives outside that namespace, it would need to be prepended with a +, like in +My::Iplementation.
+
+My::Iplementation
Any parameters required to bootstrap the given implementation according to their specifications and documentation.
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.
Will be used when calling bootstrap_default_tracer or bootstrap_global_default_tracer.
NB: OPENTRACING_IMPLEMENTATION is being depricated.
OPENTRACING_IMPLEMENTATION
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.
OpenTracing::Implementation::NoOp
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.
DEBUG
NB: OPENTRACING_DEBUG is being depricated.
OPENTRACING_DEBUG
This module respects the generic DEBUG environment variable. But it will be (locally) overridden by the PERL_OPENTRACING_DEBUG envirtonment variable.
Theo van Hoesel <tvanhoesel@perceptyx.com>
'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.
To install OpenTracing::Implementation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenTracing::Implementation
CPAN shell
perl -MCPAN -e shell install OpenTracing::Implementation
For more information on module installation, please visit the detailed CPAN module installation guide.