File Coverage

blib/lib/Sentry/Tracing/Transaction.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 24 26 92.3


line stmt bran cond sub pod time code
1             package Sentry::Tracing::Transaction;
2 9     9   355883 use Mojo::Base 'Sentry::Tracing::Span', -signatures;
  9         18  
  9         86  
3              
4             # https://develop.sentry.dev/sdk/unified-api/tracing
5              
6 9     9   2871 use Mojo::Util 'dumper';
  9         19  
  9         3700  
7              
8             has _hub => undef;
9             has sampled => undef;
10             has context => undef;
11             has name => '<unlabeled transaction>';
12             has spans => sub { [] };
13             has transaction => sub ($self) {$self};
14              
15 12     12 0 1619 sub finish ($self) {
  12         22  
  12         30  
16 12         59 $self->SUPER::finish();
17              
18 12 100       115 return unless $self->sampled;
19              
20 11         78 my %transaction = (
21             contexts => { trace => $self->get_trace_context(), },
22             spans => $self->_collect_spans(),
23             start_timestamp => $self->start_timestamp,
24             tags => $self->tags,
25             timestamp => $self->timestamp,
26             transaction => $self->name,
27             request => $self->request,
28             type => 'transaction',
29             );
30              
31 11         212 $self->_hub->capture_event(\%transaction);
32             }
33              
34 2     2 0 480398 sub set_name ($self, $name) {
  2         4  
  2         4  
  2         3  
35 2         8 $self->name($name);
36             }
37              
38             1;