NewRelic/Agent/FFI.pm

filter: Statementstmt 91.9% 57 / 62 Branchbran 50.0% 1 / 2 Conditioncond 76.1% 16 / 21 MC/DCmcdc 33.3% 3 / 9 Subroutinesub 96.4% 27 / 28 Podpod 100% 24 / 24 totaltotal 87.6% 128 / 146 CC 10 SCAR 13.9
CC
10
Cov
87%
new
12.0
set_transaction_category
2.0
BEGIN
1.0
CRAP 4.0
↑ Summary NewRelic/Agent/FFI/Procedural.pm »
1 package NewRelic::Agent::FFI;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use NewRelic::Agent::FFI::Procedural ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: Perl Agent for NewRelic APM
9 3 our $VERSION = '0.08';
10  
11  
12 sub new
13 4 ▶{
Subroutine new: called CC=10 SCAR=24.9
Pod documented
14 4 my($class, %args) = @_;
15  
16 my $license_key = delete $args{license_key}
17 || $ENV{NEWRELIC_LICENSE_KEY}
18 4 ▶ || '';
Condition80%4/5
delete $args{'license_key'} || $ENV{'NEWRELIC_LICENSE_KEY'} || ''
l!l
22
delete $args{"license_key"} or $ENV{"NEWRELIC_LICENSE_KEY"}
l!l&&r!l&&!r
202
MC/DC50%1/2
delete $args{'license_key'} || $ENV{'NEWRELIC_LICENSE_KEY'} || ''
delete $args{"license_key"} $ENV{"NEWRELIC_LICENSE_KEY"}
Truth table66%2/3
A or B
A= delete $args{"license_key"}B= $ENV{"NEWRELIC_LICENSE_KEY"}
ABresult
1X1
011
000
19 my $app_name = delete $args{app_name}
20 || $ENV{NEWRELIC_APP_NAME}
21 4 ▶ || 'AppName';
Condition80%4/5
delete $args{'app_name'} || $ENV{'NEWRELIC_APP_NAME'} || 'AppName'
l!l
22
delete $args{"app_name"} or $ENV{"NEWRELIC_APP_NAME"}
l!l&&r!l&&!r
202
MC/DC50%1/2
delete $args{'app_name'} || $ENV{'NEWRELIC_APP_NAME'} || 'AppName'
delete $args{"app_name"} $ENV{"NEWRELIC_APP_NAME"}
Truth table66%2/3
A or B
A= delete $args{"app_name"}B= $ENV{"NEWRELIC_APP_NAME"}
ABresult
1X1
011
000
22 my $app_language = delete $args{app_language}
23 || $ENV{NEWRELIC_APP_LANGUAGE}
24 4 ▶ || 'perl';
Condition80%4/5
delete $args{'app_language'} || $ENV{'NEWRELIC_APP_LANGUAGE'} || 'perl'
l!l
13
delete $args{"app_language"} or $ENV{"NEWRELIC_APP_LANGUAGE"}
l!l&&r!l&&!r
103
MC/DC50%1/2
delete $args{'app_language'} || $ENV{'NEWRELIC_APP_LANGUAGE'} || 'perl'
delete $args{"app_language"} $ENV{"NEWRELIC_APP_LANGUAGE"}
Truth table66%2/3
A or B
A= delete $args{"app_language"}B= $ENV{"NEWRELIC_APP_LANGUAGE"}
ABresult
1X1
011
000
25 my $app_language_version = delete $args{app_language_version}
26 || $ENV{NEWRELIC_APP_LANGUAGE_VERSION}
27 4 ▶ || $];
Condition66%4/6
delete $args{'app_language_version'} || $ENV{'NEWRELIC_APP_LANGUAGE_VERSION'} || $]
l!l&&r!l&&!r
130
delete $args{"app_language_version"} or $ENV{"NEWRELIC_APP_LANGUAGE_VERSION"}
l!l&&r!l&&!r
103
MC/DC0%0/3
delete $args{'app_language_version'} || $ENV{'NEWRELIC_APP_LANGUAGE_VERSION'} || $]
delete $args{"app_language_version"} $ENV{"NEWRELIC_APP_LANGUAGE_VERSION"} $]
Truth table50%2/4
A or B || C
A= delete $args{"app_language_version"}B= $ENV{"NEWRELIC_APP_LANGUAGE_VERSION"}C= $]
ABCresult
1XX1
01X1
0011
0000
28  
29 4 ▶ if (%args) {
Branch: 1 branch
BranchTrueFalseTotal
if (%args) 0 4 4
30 0 require Carp;
31 0 Carp::croak("Invalid arguments: @{[ keys %args ]}");
32 }
33  
34 bless {
35 4 license_key => $license_key,
36 app_name => $app_name,
37 app_language => $app_language,
38 app_language_version => $app_language_version,
39 }, $class;
40 }
41  
42  
43 sub embed_collector
44 1 ▶{
Subroutine embed_collector: called CC=1 SCAR=0.0
Pod documented
45 1 NewRelic::Agent::FFI::Procedural::newrelic_register_message_handler(
46 NewRelic::Agent::FFI::Procedural::newrelic_message_handler
47 );
48 }
49  
50  
51 sub init
52 2 ▶{
Subroutine init: called CC=1 SCAR=0.0
Pod documented
53 2 my($self) = @_;
54 2 NewRelic::Agent::FFI::Procedural::newrelic_init(
55 $self->get_license_key,
56 $self->get_app_name,
57 $self->get_app_language,
58 $self->get_app_language_version,
59 );
60 }
61  
62  
63 sub begin_transaction
64 3 ▶{
Subroutine begin_transaction: called CC=1 SCAR=0.0
Pod documented
65 3 NewRelic::Agent::FFI::Procedural::newrelic_transaction_begin();
66 }
67  
68  
69 sub set_transaction_name
70 3 ▶{
Subroutine set_transaction_name: called CC=1 SCAR=0.0
Pod documented
71 3 shift @_;
72 3 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_name;
73 }
74  
75 sub set_transaction_request_url
76 2 ▶{
Subroutine set_transaction_request_url: called CC=1 SCAR=0.0
Pod documented
77 2 shift @_;
78 2 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_request_url;
79 }
80  
81 sub set_transaction_max_trace_segments
82 1 ▶{
Subroutine set_transaction_max_trace_segments: called CC=1 SCAR=0.0
Pod documented
83 1 shift @_;
84 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_max_trace_segments;
85 }
86  
87 sub set_transaction_category
88 0 ▶{
Subroutine set_transaction_category: not called CC=1 SCAR=6.9
Pod documented
89 0 shift @_;
90 0 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_category;
91 }
92  
93 sub set_transaction_type_web
94 2 ▶{
Subroutine set_transaction_type_web: called CC=1 SCAR=0.0
Pod documented
95 2 shift @_;
96 2 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_type_web;
97 }
98  
99 sub set_transaction_type_other
100 1 ▶{
Subroutine set_transaction_type_other: called CC=1 SCAR=0.0
Pod documented
101 1 shift @_;
102 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_type_other;
103 }
104  
105 sub add_transaction_attribute
106 3 ▶{
Subroutine add_transaction_attribute: called CC=1 SCAR=0.0
Pod documented
107 3 shift @_;
108 3 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_add_attribute;
109 }
110  
111 sub notice_transaction_error
112 1 ▶{
Subroutine notice_transaction_error: called CC=1 SCAR=0.0
Pod documented
113 1 shift @_;
114 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_notice_error;
115 }
116  
117  
118 sub end_transaction
119 3 ▶{
Subroutine end_transaction: called CC=1 SCAR=0.0
Pod documented
120 3 shift @_;
121 3 goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_end;
122 }
123  
124 sub record_metric
125 1 ▶{
Subroutine record_metric: called CC=1 SCAR=0.0
Pod documented
126 1 shift @_;
127 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_record_metric;
128 }
129  
130 sub record_cpu_usage
131 1 ▶{
Subroutine record_cpu_usage: called CC=1 SCAR=0.0
Pod documented
132 1 shift @_;
133 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_record_cpu_usage;
134 }
135  
136 sub record_memory_usage
137 1 ▶{
Subroutine record_memory_usage: called CC=1 SCAR=0.0
Pod documented
138 1 shift @_;
139 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_record_memory_usage;
140 }
141  
142  
143 sub begin_generic_segment
144 1 ▶{
Subroutine begin_generic_segment: called CC=1 SCAR=0.0
Pod documented
145 1 shift @_;
146 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_segment_generic_begin;
147 }
148  
149  
150 sub begin_datastore_segment
151 1 ▶{
Subroutine begin_datastore_segment: called CC=1 SCAR=0.0
Pod documented
152 1 NewRelic::Agent::FFI::Procedural::newrelic_segment_datastore_begin(
153 @_[1,2,3,4,5,6], NewRelic::Agent::FFI::Procedural::newrelic_basic_literal_replacement_obfuscator(),
154 )
155 }
156  
157  
158 sub begin_external_segment
159 1 ▶{
Subroutine begin_external_segment: called CC=1 SCAR=0.0
Pod documented
160 1 shift @_;
161 1 goto &NewRelic::Agent::FFI::Procedural::newrelic_segment_external_begin;
162 }
163  
164  
165 sub end_segment
166 3 ▶{
Subroutine end_segment: called CC=1 SCAR=0.0
Pod documented
167 3 shift @_;
168 3 goto &NewRelic::Agent::FFI::Procedural::newrelic_segment_end;
169 }
170  
171  
172 4 ▶sub get_license_key { shift->{license_key} }
Subroutine get_license_key: called CC=1 SCAR=0.0
Pod documented
173 4 ▶sub get_app_name { shift->{app_name} }
Subroutine get_app_name: called CC=1 SCAR=0.0
Pod documented
174 4 ▶sub get_app_language { shift->{app_language} }
Subroutine get_app_language: called CC=1 SCAR=0.0
Pod documented
175 4 ▶sub get_app_language_version { shift->{app_language_version} }
Subroutine get_app_language_version: called CC=1 SCAR=0.0
Pod documented
176  
177  
178 3 1;
179  
180 __END__
↑ Summary NewRelic/Agent/FFI/Procedural.pm »