-
-
12 Feb 2021 21:05:04 UTC
- Distribution: OpenTracing-Role
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers
- Kwalitee
Bus factor: 2- 79.00% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (25.69KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Data::GUID
- Moo::Role
- MooX::Enumeration
- MooX::HandlesVia
- MooX::ProtectedAttributes
- MooX::Should
- OpenTracing::Interface
- OpenTracing::Types
- Role::Declare::Should
- Sub::Trigger::Lock
- Time::HiRes
- Try::Tiny
- Types::Common::Numeric
- Types::Standard
- Types::TypeTiny
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- DESCRIPTION
- IMPLEMENTED OPENTRACING METHODS
- WARNING
- ATTRIBUTES
- REQUIRED METHODS
- SEE ALSO
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
OpenTracing::Role::Tracer - Role for OpenTracin implementations.
SYNOPSIS
package OpenTracing::Implementation::MyBackendService::Tracer; use Moo; sub build_span { my $self = shift; my %opts = @_; Span->new( %opts, on_finish => sub { my $span = shift; $self->do_something_with_span( $span ) }, ) } sub build_context { ... } my $self = shift; my %opts = @_; SpanContext->new( %opts ) } sub extract_context { ... } sub inject_context { ... } ... with 'OpenTracing::Role::Tracer'; 1;
DESCRIPTION
This
Moo::Role
provides the consuming class with most, if not all, of the methods being described in OpenTracing::Interface::Tracer.IMPLEMENTED OPENTRACING METHODS
The following methods from OpenTracing::Interface have been implemented. See their documentation for more details.
get_scope_manager
Returns the current
ScopeManager
, which may be a NoOp but may not beundef
.See "get_scope_manager" in OpenTracing::Interface::Tracer.
get_active_span
This will return the 'active' span.
See "get_active_span" in OpenTracing::Interface::Tracer.
start_active_span
Starts AND activates a
Span
and returns itsScope
.See "start_active_span" in OpenTracing::Interface::Tracer.
start_span
Starts, but does not activate a
Span
See "start_span" in OpenTracing::Interface::Tracer.
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.
ATTRIBUTES
The attributes below become part of the consuming class, but because of its in-mutable design, those can not be set after instantiation, one will need to use the provided methods to clone with the data.
scope_manager
A required read-only ScopeManager that can
get_active_scope
andactivate_span
See ScopeManager.
default_span_context_args
An optional
HashRef
that defaults to an empty hash reference.These key/value pairs are being used to build a new
SpanContext
object (usingbuild_context
for a rootspan if no active <SpanContext> is provided or available duringstart_span
. These key/value pairs are typically implementation dependent.See
build_context
.REQUIRED METHODS
The following method(s) are required to be implemented by a consuming class.
build_span
An implementation specific build method that allows the implementation to do its own settings and requirements, where needed. One typical responsabillity of the builder is to set the
on_finish
.The first argument of the method call, is as usual, the
Tracer
invocant self.- Expected Named Parameters
-
operation_name
-
A required <Str> representing the name of this span
context
-
The required current
SpanContext
the new <Span> belongs to at the time of creation. child_of
-
An optional
span
orSpanContext
that this decends from start_time
-
An optional
PositiveOrZeroNum
, the (fractional) number of seconds since epoch tags
-
An optional <HashRef> of <Str>.
- Returns
-
- MUST return a
Span
- MUST return a
build_context
An implementation specific build method that allows the implementation to do its own settings and requirements, where needed.
The first argument of the method call, is as usual, the
Tracer
invocant self.It will get followed by the (dereferenced) list of
default_span_context_args
.- Returns
-
- MUST return a
Span
- MUST return a
extract_context
See
extract_context
for a description.inject_context
See
extract_context
for a description.SEE ALSO
- OpenTracing::Types
-
Type constraints for checking Interfaces
- OpenTracing::Interface::Tracer
-
A role that defines the Tracer 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.
Module Install Instructions
To install OpenTracing::Role, copy and paste the appropriate command in to your terminal.
cpanm OpenTracing::Role
perl -MCPAN -e shell install OpenTracing::Role
For more information on module installation, please visit the detailed CPAN module installation guide.