NAME

OpenTracing::Interface::Tracer - A role that defines the Tracer interface

SYNOPSIS

package OpenTracing::Implementation::MyBackendService::Tracer;

sub get_scope_manager {
    ...
}

sub get_active_span {
    ...
}

sub start_active_span {
    ...
}

sub start_span {
    ...
}

BEGIN {
    use Role::Tiny::With;
    with 'OpenTracing::Interface::Tracer'
        if $ENV{OPENTRACING_INTERFACE};
} # check at compile time, perl -c will work

1;

DESCRIPTION

This 'role' describes the interface for any OpenTracing Tracer implementation.

This description is using around method modifiers that basically wraps them around the real implementation. These method modifiers provide a 'readable' and reusable interface, describing the inputs and outputs, using type constraints.

Consumers of this role, or implementors of the interface are MUST implement each method mentioned below. Not doing so will result in compilation errors.

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.

METHODS

get_scope_manager

Returns the current ScopeManager, which may be a noop but may not be null.

get_active_span

This will return the 'active' span.

A shorthand for $tracer->get_scope_manager->get_active_scope->get_span

It will return undef if there is no active scope.

start_active_span

Required Positional Parameters

operation_name, as Str

Optional Dictionairy with Named Options

child_of

either

an object that does OpenTracing::Interface::Span

or

an object that does OpenTracing::Interface::SpanContext

references

an ArrayRef of 'references' ... # XXX Don't ask me now!

tags

a HashRef of tags, the values must be a Str

start_time

A Num, that is the number off seconds since epoch, and can have decimals, for example, up to nana-seconds accuracy

ignore_active_span

A Bool when set to 'true', will not use the current active span when creating an implicit parent span for a missing child_of, otherwise, that would be used.

finish_span_on_close

A Bool when set to false, it will not be automatically closed when it goes out of scope. This is 'true' by default.

Returns

An object that implements the Scope interface.

start_span

Required Positional Parameters

operation_name, as Str

Optional Dictionairy with Named Options

child_of

either

an object that does OpenTracing::Interface::Span

or

an object that does OpenTracing::Interface::SpanContext

references

an ArrayRef of 'references' ... # XXX Don't ask me now!

tags

a HashRef of tags, the values must be a Str

start_time

A Num, that is the number off seconds since epoch, and can have decimals, for example, up to nana-seconds accuracy

ignore_active_span

A Bool when set to 'true', will not use the current active span when creating an implicit parent span for a missing child_of, otherwise, that would be used.

Returns

An object that implements the OpenTracing::Interface::Span interface.