NAME

OpenTracing::Role::Scope - Role for OpenTracing implementations.

SYNOPSIS

    package OpenTracing::Implementation::MyBackendService::Scope;
    
    use Moo;
    
    with 'OpenTracing::Role::Scope'
    
    sub close => { ... }
    
    1;

DESCRIPTION

This Moo::Role provides the consuming class with most, if not all, of the methods being described in OpenTracing::Interface::Scope.

IMPLEMENTED OPENTRACING METHODS

The following methods from OpenTracing::Interface have been implemented. See their documentation for more details.

close

Mark the end of the active period for the current thread and Scope, updating the ScopeManager::active() in the process.

See "close" in OpenTracing::Interface::Scope.

get_span

Returns the Span that's been scoped by this Scope

See "get_span" in OpenTracing::Interface::Scope.

WARNING

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.

==head1 ATTRIBUTES

span

A Span type.

finish_span_on_close

A Bool type.

See start_active_span.

closed

A Bool type, that keeps the state of this scope, so one can not close a scope more than once, and unintentially would call the code in the on_close closure.

on_close

Maybe a CodeRef that will gets executed when close gets called. Itss only parameter, is the Scope invocant itself.

Before this code reference gets called, its span may recieve a finish call, depending wether or not finish_span_on_close has been set or not.

Its usefulnes currently is for dealing with scope and a ScopeManager.

SEE ALSO

OpenTracing::Types

Type constraints for checking Interfaces

OpenTracing::Interface::Scope

A role that defines the Scope interface

AUTHOR

Theo van Hoesel <tvanhoesel@perceptyx.com>

COPYRIGHT AND LICENSE

'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.