OpenTracing::Integration - top-level class for integrating OpenTracing with other Perl modules


 # Apply tracing for specific modules
 use OpenTracing::Integration qw(HTTP::Tiny DBI);

 # Trace every module we know about
 use OpenTracing::Integration qw(:all);


This is the base rôle for handling tracing integration with other CPAN modules.

It provides functionality for loading available integrations via the import list on a use statement:

  • with :all, any module that supports OpenTracing will be pulled in, if the module-to-be-traced is already loaded

  • with a specific list of modules, these will be applied unconditionally, loading the modules-to-be-traced as required

This means that you can expect HTTP::Tiny to be traced if you do this:

 use OpenTracing::Integration qw(HTTP::Tiny);

or this:

 use HTTP::Tiny;
 use OpenTracing::Integration qw(:all);

but it will not be traced if you do this:

 use OpenTracing::Integration qw(:all);
 use HTTP::Tiny;

The reason for this inconsistent behaviour is simple: with a large install, :all might pull in a lot of unwanted modules. Instead, you'd do this at the end of your module imports, and any functionality that you're actively using in the code would gain tracing, if available.


Tom Molesworth


Copyright Tom Molesworth 2018-2020. Licensed under the same terms as Perl itself.