| 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
| |||||||||||||||||||||||||||||
| 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
MC/DC0%0/1
$config->{"sample_rate"} // 1
$config->{"sample_rate"}
Truth table0%0/2
A
A= $config->{"sample_rate"}
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | die "No StatsD Host/Port found!" unless $host && $port; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$host and $port
MC/DC0%0/2
$host and $port
$host
$port
Truth table0%0/3
A and B
A= $hostB= $port
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||