OpenTracing::Interface::ScopeManager - A role that defines the ScopeManager
package OpenTracing::Implementation::MyBackendService::ScopeManager; sub activate_span { ... } sub get_active_scope { ... } BEGIN { use Role::Tiny::With; with 'OpenTracing::Interface::ScopeManager' } # check at compile time, perl -c will work 1;
This 'role' describes the interface for any OpenTracing ScopeManager implementation.
The ScopeManager interface abstracts both the activation of Span instances via activate_Span and access to an active Scope via get_active_scope.
ScopeManager
Span
Scope
activate_span
Set the specified Span as the active instance for the current context (usually a thread).
my $span = $tracer->start_span( 'some operation' ignore_active_span => 1 ); my $scope_manager = $tracer->get_scope_manager; my $scope = $scope_manager->activate_span( $span, finish_span_on_close => 0 );
The returned Scope represents the active state for the span. Once its active period is due, $scope->close() ought to be called. Observe the span will be automatically finished when $scope->close() is called.
$scope->close()
The span to be activated.
finish_span_on_close
Bool
When set to false, the span will not be automatically finished when the scope is being closed. This is 'true' by default.
The scope object for the given span.
Return the currently active Scope which can be used to access the currently active Span, using $scope->get_span.
$scope->get_span
my $manager = $tracer->get_scope_manager; my $scope = $manager->get_activate_scope;
none
The currently active scope or undef if none.
undef
Describes the API definition for OpenTransport implementations written in the Perl5 language.
A library of Type::Tiny type constraints that provides Duck Type checks for all common elements that conform OpenTracing::Interface
Since this role does nothing else than checking input and output, it is useful during development. Most likely it can be switched off safely in production environments.
Theo van Hoesel <tvanhoesel@perceptyx.com>
'OpenTracing API for Perl' is Copyright (C) 2019 .. 2021, 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 library 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::Interface, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenTracing::Interface
CPAN shell
perl -MCPAN -e shell install OpenTracing::Interface
For more information on module installation, please visit the detailed CPAN module installation guide.