blib/lib/Dancer/Plugin/StatsD.pm

filter: Statementstmt 72.4% 21 / 29 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 53.0% 26 / 49 CC 5 SCAR 26.5
CC
5
Cov
55%
statsd_obj
30.0
__ANON__
1.1
BEGIN
1.0
CRAP 14.2
↑ Summary
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Dancer::Plugin::StatsD;
4 {
5 1 $Dancer::Plugin::StatsD::VERSION = '0.0001';
6 }
7 1 ▶use Dancer;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Dancer::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Etsy::StatsD;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # ABSTRACT: Dancer Plugin for StatsD support
12  
13 1 my $statsd;
14  
15 # Create statsd object, or return existing one
16 0 ▶sub statsd_obj {
Subroutine statsd_obj: not called CC=5 SCAR=34.0
Pod undocumented
17 # Return it if we got it
18 0 ▶ return $statsd if $statsd;
Branch: 1 branch
BranchTrueFalseTotal
if $statsd 0 0 0
19  
20 0 my $config = plugin_setting;
21 0 my $host = $config->{host};
22 0 my $port = $config->{port};
23 0 ▶ my $sample_rate = $config->{sample_rate} // 1;
Condition0%0/2
$config->{"sample_rate"} // 1
l!l
00
MC/DC0%0/1
$config->{"sample_rate"} // 1
$config->{"sample_rate"}
Truth table0%0/2
A
A= $config->{"sample_rate"}
Aresult
11
00
24  
25 0 ▶ die "No StatsD Host/Port found!" unless $host && $port;
Branch: 1 branch
BranchTrueFalseTotal
unless $host and $port 0 0 0
Condition0%0/3
$host and $port
!ll&&!rl&&r
000
MC/DC0%0/2
$host and $port
$host $port
Truth table0%0/3
A and B
A= $hostB= $port
ABresult
0X0
100
111
26  
27 0 return $statsd = Etsy::StatsD->new( $host, $port, $sample_rate );
28 }
29  
30 0 ▶register statsd => sub { statsd_obj };
Subroutine __ANON__: not called CC=1 SCAR=1.2
31  
32 1 register_plugin;
33  
34 1 1;
35  
36 __END__
↑ Summary