OpenTracing-Implementation-DataDog
view release on metacpan or search on metacpan
lib/OpenTracing/Implementation/DataDog/Span.pm view on Meta::CPAN
package OpenTracing::Implementation::DataDog::Span;
=head1 NAME
OpenTracing::Implementation::DataDog::Span - A DataDog Implementation for a Span
=cut
our $VERSION = 'v0.47.2';
use syntax 'maybe';
use Moo;
use MooX::Should;
with 'OpenTracing::Role::Span';
use aliased 'OpenTracing::Implementation::DataDog::SpanContext';
use Types::Standard qw/Str/;
use Ref::Util qw/is_plain_hashref/;
use Carp;
=head1 DESCRIPTION
This is a L<OpenTracing Span|OpenTracing::Interface::Span> compliant
implementation whit DataDog specific extentions
=cut
=head1 EXTENDED ATTRIBUTES
=cut
=head2 C<operation_name>
DataDog requires that its length should not exceed 100 characters.
=cut
has '+operation_name' => (
should => Str->where( 'length($_) <= 100' ),
);
=head2 C<context>
Add coercion from plain hashref
=cut
has '+context' => (
coerce
=> sub { is_plain_hashref $_[0] ? SpanContext->new( %{$_[0]} ) : $_[0] },
default
=> sub { croak "Can not construct a default SpanContext" },
);
# OpenTracing does not provide any public method to instantiate a SpanContext.
# But rootspans do need to have a context which comes from
# the `$TRACER->extract_context` call, or it returns `undef` if there was no
# such context.
# Passing in a plain hash reference instead of a SpanContext will
# instantiate such context with a 'fresh' `trace_id`
=head1 SEE ALSO
=over
=item L<OpenTracing::Implementation::DataDog>
Sending traces to DataDog using Agent.
=item L<OpenTracing::Role::Span>
( run in 0.843 second using v1.01-cache-2.11-cpan-39bf76dae61 )