OpenTracing::Implementation::Test - In-Memory OpenTracing Test Implementation
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();
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.
All of these consume the appropriate OpenTracing::Role:
The modules below offer aditional functionallity specifacally for testing purposes.
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.
level
Returns the depth of the span.
context_item
Returns the value of a non-functional test attribute.
Szymon Nieznanski <snieznanski@perceptyx.com>
'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.
To install Test::OpenTracing::Integration, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::OpenTracing::Integration
CPAN shell
perl -MCPAN -e shell install Test::OpenTracing::Integration
For more information on module installation, please visit the detailed CPAN module installation guide.