OpenTracing::Role::SpanContext - Role for OpenTracing implementations.
package OpenTracing::Implementation::MyBackendService::SpanContext use Moo; ... with 'OpenTracing::Role::SpanContext' 1;
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.
with_...
Returns a single value for a given key.
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.
Creates a clone of the current object, with new kew/value pair added.
Creates a clone of the current object, with list of kew/value pairs added.
To install OpenTracing::Role::Span, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenTracing::Role::Span
CPAN shell
perl -MCPAN -e shell install OpenTracing::Role::Span
For more information on module installation, please visit the detailed CPAN module installation guide.