NAME
OpenTracing::WrapScope - Automatically add spans to selected subroutines
SYNOPSIS
use OpenTracing::WrapScope qw/foo Foo::bar/;
use Foo;
sub foo { ... }
package Foo {
sub bar { ... }
}
Roughly equivalent to:
use OpenTracing::AutoScope;
sub foo {
OpenTracing::AutoScope->start_guarded_span();
...
}
package Foo {
sub bar {
OpenTracing::AutoScope->start_guarded_span();
...
}
}
IMPORT ARGUMENTS
import takes subroutine names as arguments, these need to be fully qualified if they are not in the current package. All specified subroutines will have spans attached to them. Context and caller frames will be preserved. Additionally, if a wrapped subroutine dies, an additional error
tag will be added to the span.
CAVEATS
caller
Because this module overrides caller, it's best to use it as soon as possible, before caller-using code is compiled. It likely won't work well with other modules which override caller themselves.
Exporter
Subroutines exported using Exporter or a similar module could split into two versions. If the export happens before the span handling is applied to a subroutine, only the original version will have a span, the exported version will be unmodified.
In order to wrap subroutines in modules utilising Exporter, use OpenTracing::WrapScope directly in those modules.
AUTHOR
Szymon Nieznanski <snieznanski@perceptyx.com>
COPYRIGHT AND LICENSE
'OpenTracing::WrapScope' is Copyright (C) 2020, Perceptyx Inc
This library 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.