line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use Mojo::Base 'Mojolicious::Plugin', -signatures; |
2
|
1
|
|
|
1
|
|
207801
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
5
|
|
3
|
|
|
|
|
|
|
use Sentry::SDK; |
4
|
1
|
|
|
1
|
|
1168
|
use Try::Tiny; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
5
|
1
|
|
|
1
|
|
37
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
501
|
|
6
|
|
|
|
|
|
|
$app->hook( |
7
|
3
|
|
|
3
|
1
|
47821
|
before_server_start => sub ($server, $app) { |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
6
|
|
8
|
6
|
|
|
|
|
17
|
Sentry::SDK->init($conf); |
9
|
6
|
|
|
6
|
|
11
|
} |
|
6
|
|
|
|
|
10467
|
|
|
6
|
|
|
|
|
12
|
|
10
|
6
|
|
|
|
|
58
|
); |
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
|
|
29
|
$app->hook( |
13
|
|
|
|
|
|
|
around_action => sub ($next, $c, $action, $last) { |
14
|
3
|
|
|
|
|
9
|
return $next->() unless $last; |
15
|
3
|
|
|
3
|
|
7
|
|
|
3
|
|
|
|
|
41833
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
6
|
|
16
|
3
|
50
|
|
|
|
16
|
my $req = $c->req; |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
17
|
Sentry::Hub->get_current_hub()->with_scope(sub ($scope) { |
19
|
|
|
|
|
|
|
my %cookies = map { ($_->name, $_->value) } ($req->cookies // [])->@*; |
20
|
3
|
|
|
|
|
6
|
my $transaction = Sentry::SDK->start_transaction( |
21
|
3
|
|
50
|
|
|
31
|
{ |
|
0
|
|
|
|
|
0
|
|
22
|
3
|
|
100
|
|
|
273
|
name => $c->match->endpoint->pattern->unparsed || '/', |
23
|
|
|
|
|
|
|
op => 'http.server', |
24
|
|
|
|
|
|
|
request => { |
25
|
|
|
|
|
|
|
url => $req->url->to_abs->to_string, |
26
|
|
|
|
|
|
|
cookies => \%cookies, |
27
|
|
|
|
|
|
|
method => $req->method, |
28
|
|
|
|
|
|
|
query_string => $req->url->query->to_hash, |
29
|
|
|
|
|
|
|
headers => $req->headers->to_hash, |
30
|
|
|
|
|
|
|
env => \%ENV, |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Sentry::SDK->configure_scope(sub ($scope) { |
36
|
|
|
|
|
|
|
$scope->set_span($transaction); |
37
|
3
|
|
|
|
|
6
|
}); |
38
|
3
|
|
|
|
|
15
|
|
39
|
3
|
|
|
|
|
44
|
try { |
40
|
|
|
|
|
|
|
$next->(); |
41
|
|
|
|
|
|
|
} catch { |
42
|
3
|
|
|
|
|
226
|
Sentry::SDK->capture_exception($_); |
43
|
|
|
|
|
|
|
$c->reply->exception($_) |
44
|
1
|
|
|
|
|
825
|
} finally { |
45
|
1
|
|
|
|
|
24
|
my $status = $c->res->code; |
46
|
|
|
|
|
|
|
$transaction->set_http_status($status) if $status; |
47
|
3
|
|
|
|
|
56043
|
$transaction->finish(); |
48
|
3
|
50
|
|
|
|
82
|
}; |
49
|
3
|
|
|
|
|
34
|
}); |
50
|
3
|
|
|
|
|
38
|
} |
51
|
3
|
|
|
|
|
61
|
); |
52
|
|
|
|
|
|
|
} |
53
|
3
|
|
|
|
|
50
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding utf8 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Mojolicious::Plugin::SentrySDK - Sentry plugin for Mojolicious |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 OPTIONS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 register |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $config = $plugin->register(Mojolicious->new); |
71
|
|
|
|
|
|
|
my $config = $plugin->register(Mojolicious->new, \%options); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Register Sentry in L<Mojolicious> application. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SEE ALSO |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L<Sentry::SDK>. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |