OpenTracing::Role::ScopeManager - Role for OpenTracing implementations.
package OpenTracing::Implementation::MyBackendService::ScopeManager; use Moo; with 'OpenTracing::Role::ScopeManager' sub build_scope{ my $self = shift; my $options = { @_ }; my $current_scope = $self->get_active_scope; my $scope = OpenTracing::Implementation::DataDog::Scope->new( span => $options->{ span }, finish_span_on_close => $options->{ finish_span_on_close }, on_close => sub { $self->set_active_scope( $current_scope ); } ); return $scope } 1;
This Moo::Role provides the consuming class with most, if not all, of the methods being described in OpenTracing::Interface::ScopeManager.
Moo::Role
The following methods from OpenTracing::Interface have been implemented. See their documentation for more details.
activate_span
Set the specified Span as the active instance for the current context (usually a thread).
See "activate_span" in OpenTracing::Interface::ScopeManager.
get_active_scope
Return the currently active Scope which can be used to access the currently active Span, using $scope->get_span.
Scope
Span
$scope->get_span
See "get_active_scope" in OpenTracing::Interface::ScopeManager.
Never use any of attributes or methods below in any integration!
Only methods mentioned in the Public OpenTracing::Interface are safe to be used in any integration or when instrumenting applications.
active_scope
A Span type.
The following method(s) are required to be implemented by a consuming class.
build_scope
This method should return a Scope
span
A OpenTracing compliant Span object.
finish_span_on_close
A Bool type.
Bool
Unlike the OpenTracing API interface specification, build_scope does not let it up for discusion, span and finish_span_on_close are expected named parameters.
Type constraints for checking Interfaces
A role that defines the ScopeManager interface
Theo van Hoesel <tvanhoesel@perceptyx.com>
'OpenTracing API for Perl' is Copyright (C) 2019 .. 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 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::Role, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenTracing::Role
CPAN shell
perl -MCPAN -e shell install OpenTracing::Role
For more information on module installation, please visit the detailed CPAN module installation guide.