NAME

OpenTracing::Role::SpanContext - Role for OpenTracing implementations.

SYNOPSIS

package OpenTracing::Implementation::MyBackendService::SpanContext

use Moo;

...

with 'OpenTracing::Role::SpanContext'

1;

DESCRIPTION

This is a role for OpenTracing implenetations that are compliant with the OpenTracing::Interface.

It has been suggested that an object that implements the OpenTracing SpanContext interface SHOULD be immutable, to avoid lifetime issues. Therefore, the attributes are read/write-protected. Any changes tried to make, will trigger a Sub::Trigger::Lock exception.

The only way to 'mutate' the bagage items, is by using with_baggage_item or with_baggage_items.

Most likely, the new constructor would only be called during the extraction phase. Depending on the framework the OpenTracing implementation is being used for, it will be initialised with request depenent information. From there on, additional bagage-items can be added.

Implementors should be aware of the immutable desired behavbior and should use methods like with_... to clone this object with new values, rather than just updating any values of the the attributes.

ATTRIBUTES

baggage_items

METHODS

get_baggage_item

Returns a single value for a given key.

get_baggage_items

Returns a hash that contains all key/value pairs for the current baggage items. By returning a hash and not a reference, it purposefully makes it hard to mutate any of the key/value pairs in the baggage_items.

with_baggage_item

Creates a clone of the current object, with new kew/value pair added.

with_baggage_items

Creates a clone of the current object, with list of kew/value pairs added.

SEE ALSO

OpenTracing::Role
OpenTracing::Implementation
OpenTracing::Interface::SpanContext