The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OpenTracing::Implementation::Test - In-Memory OpenTracing Test Implementation

SYNOPSIS

  use OpenTracing::Implementation::Test;
  use Data::Dumper;

  my $tracer = OpenTracing::Implementation::Test->bootstrap_tracer();
  
  my $scope = $tracer->start_active_span('foo');
  
  ...
  
  print Dumper $tracer->get_spans_as_struct();
  print $tracer->span_tree();

DESCRIPTION

This is a simple in-memory implementation useful for checking your instrumentation. Instead of sending the data off to another service, the tracer itself keeps track of spans and allows for easy inspection.

PROVIDED MODULES

All of these consume the appropriate OpenTracing::Role:

OpenTracing::Implementation::Test::Tracer

OpenTracing::Implementation::Test::Span

OpenTracing::Implementation::Test::SpanContext

OpenTracing::Implementation::Test::Scope

OpenTracing::Implementation::Test::ScopeManager

EXTRA METHODS

The modules below offer aditional functionallity specifacally for testing purposes.

Tracer

The test-tracer provides a few extra methods on top of the role, see OpenTracing::Implementation::Test::Tracer for details.

get_spans_as_struct

Returns a list of hashes representing all spans, including information from SpanContexts.

span_tree

Return a string representation of span relationships.

cmp_deeply

The test will compare current saved spans using cmp_deeply.

cmp_easy

Make testing more easy.

cmp_spans

Make testing more reliable, using easy testing on all spans, not skipping any.

clear_spans

Removes all saved spans from the tracer.

SpanContext

level

Returns the depth of the span.

context_item

Returns the value of a non-functional test attribute.

AUTHOR

Szymon Nieznanski <snieznanski@perceptyx.com>

COPYRIGHT AND LICENSE

'Test::OpenTracing::Integration' 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 package 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.