CGI-Application-Plugin-OpenTracing

 view release on metacpan or  search on metacpan

lib/CGI/Application/Plugin/OpenTracing.pm  view on Meta::CPAN

    $plugin->add_tags(TRC_ACTIVE_SCOPE,
        error   => 1,
        message => $error,
        grep_error_tags( $plugin->get_tags(TRC_ACTIVE_SCOPE) ),
    );
    
    # run span should continue
    my $root = $plugin->get_scope(CGI_RUN)->get_span;
    
    my $tracer = $plugin->get_tracer();
    _cascade_set_failed_spans($tracer, $error, $root);
    
    return;
}



################################################################################
#
#   Plugin methods - These do not require the CGI-App
#

lib/CGI/Application/Plugin/OpenTracing.pm  view on Meta::CPAN

                @implementation_import_opts,
                @bootstrap_options,
            )
    ;
        
    return $bootstrapped_tracer;
}



sub _cascade_set_failed_spans {
    my ($tracer, $error, $root_span) = @_;
    my $root_addr = refaddr($root_span) if defined $root_span;

    while (my $scope = $tracer->get_scope_manager->get_active_scope()) {
        my $span = $scope->get_span();
        last if defined $root_addr and $root_addr eq refaddr($span);
        
#       $span->add_tags(error => 1, message => $error);
        $scope->close();
    }

lib/CGI/Application/Plugin/OpenTracing.pm  view on Meta::CPAN

            message => $error,
        );
        
        $plugin->add_tags(TRC_ACTIVE_SCOPE,
            error   => 1,
            message => $error,
            grep_error_tags( $plugin->get_tags(TRC_ACTIVE_SCOPE) ),
        );
        
        my $tracer = $plugin->get_tracer();
        _cascade_set_failed_spans($tracer, $error);

        die $error;
    };
}



1;



( run in 0.978 second using v1.01-cache-2.11-cpan-49f99fa48dc )