lib/ForgeOps/Tracker/Reporter.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 93.1% 27 / 29 CC 3 SCAR 6.9
CC
3
Cov
100%
report
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/ForgeOps/Tracker/SpanDelivery.pm ↑ Summary lib/ForgeOps/Tracker/HistogramBucketer.pm »
1 package ForgeOps::Tracker::Reporter;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # Ties Configuration, EventBuilder, and DeliveryQueue together into the one thing callers actually
7 # need: report an exception. Mirrors gems/forge_ops_tracker's ErrorSubscriber#report: never
8 # throws. An error reporter that itself throws while reporting an error is the worst possible
9 # failure mode, so every path here is wrapped to guarantee this never propagates back into the
10 # host app.
11 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
12 6 my ($class, $configuration, $event_builder, $delivery_queue) = @_;
13 6 return bless {
14 configuration => $configuration,
15 event_builder => $event_builder,
16 delivery_queue => $delivery_queue,
17 }, $class;
18 }
19  
20 6 ▶sub report {
Subroutine report: called CC=3 SCAR=11.0
Pod undocumented
21 6 my ($self, $error, $context, $user, $breadcrumbs, $request) = @_;
22  
23 eval {
24 6 ▶ return unless $self->{configuration}->is_enabled;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"configuration"}->is_enabled 1 5 6
25  
26 5 my $payload = $self->{event_builder}->build($error, $context, $user, $breadcrumbs, $request);
27 4 $self->{delivery_queue}->push($payload);
28 3 1;
29 6 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { return unless $self->{"configuration"}->is_enabled; my $payload = $self->{"event_builder"}->build($error, $context, $user, $breadcrumbs, $request); $self->{"delivery_queue"}->push($payload); 1 } } or do { my $err = $@; eval { do { $self->{"configuration"}->log("[forge-ops-tracker] report failed: $err") } } } 3 3 6
30 3 my $err = $@;
31 3 eval { $self->{configuration}->log("[forge-ops-tracker] report failed: $err") };
32 };
33  
34 6 return;
35 }
36  
37 1 1;
« blib/lib/ForgeOps/Tracker/SpanDelivery.pm ↑ Summary lib/ForgeOps/Tracker/HistogramBucketer.pm »