line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewRelic::Agent::FFI; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
704968
|
use strict; |
|
3
|
|
|
|
|
23
|
|
|
3
|
|
|
|
|
101
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
78
|
|
5
|
3
|
|
|
3
|
|
91
|
use 5.010; |
|
3
|
|
|
|
|
13
|
|
6
|
3
|
|
|
3
|
|
1578
|
use NewRelic::Agent::FFI::Procedural (); |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
2397
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Perl Agent for NewRelic APM |
9
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
4
|
|
|
4
|
1
|
15400
|
my($class, %args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $license_key = delete $args{license_key} |
17
|
|
|
|
|
|
|
|| $ENV{NEWRELIC_LICENSE_KEY} |
18
|
4
|
|
50
|
|
|
28
|
|| ''; |
19
|
|
|
|
|
|
|
my $app_name = delete $args{app_name} |
20
|
|
|
|
|
|
|
|| $ENV{NEWRELIC_APP_NAME} |
21
|
4
|
|
50
|
|
|
18
|
|| 'AppName'; |
22
|
|
|
|
|
|
|
my $app_language = delete $args{app_language} |
23
|
|
|
|
|
|
|
|| $ENV{NEWRELIC_APP_LANGUAGE} |
24
|
4
|
|
50
|
|
|
26
|
|| 'perl'; |
25
|
|
|
|
|
|
|
my $app_language_version = delete $args{app_language_version} |
26
|
|
|
|
|
|
|
|| $ENV{NEWRELIC_APP_LANGUAGE_VERSION} |
27
|
4
|
|
33
|
|
|
28
|
|| $]; |
28
|
|
|
|
|
|
|
|
29
|
4
|
50
|
|
|
|
15
|
if (%args) { |
30
|
0
|
|
|
|
|
0
|
require Carp; |
31
|
0
|
|
|
|
|
0
|
Carp::croak("Invalid arguments: @{[ keys %args ]}"); |
|
0
|
|
|
|
|
0
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
bless { |
35
|
4
|
|
|
|
|
34
|
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
|
|
|
|
|
|
|
{ |
45
|
1
|
|
|
1
|
1
|
561
|
NewRelic::Agent::FFI::Procedural::newrelic_register_message_handler( |
46
|
|
|
|
|
|
|
NewRelic::Agent::FFI::Procedural::newrelic_message_handler |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub init |
52
|
|
|
|
|
|
|
{ |
53
|
2
|
|
|
2
|
1
|
260
|
my($self) = @_; |
54
|
2
|
|
|
|
|
8
|
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
|
|
|
|
|
|
|
{ |
65
|
3
|
|
|
3
|
1
|
9098
|
NewRelic::Agent::FFI::Procedural::newrelic_transaction_begin(); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub set_transaction_name |
70
|
|
|
|
|
|
|
{ |
71
|
3
|
|
|
3
|
1
|
8
|
shift @_; |
72
|
3
|
|
|
|
|
11
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_name; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub set_transaction_request_url |
76
|
|
|
|
|
|
|
{ |
77
|
2
|
|
|
2
|
1
|
1302
|
shift @_; |
78
|
2
|
|
|
|
|
9
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_request_url; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub set_transaction_max_trace_segments |
82
|
|
|
|
|
|
|
{ |
83
|
1
|
|
|
1
|
1
|
13
|
shift @_; |
84
|
1
|
|
|
|
|
6
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_max_trace_segments; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub set_transaction_category |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
1
|
0
|
shift @_; |
90
|
0
|
|
|
|
|
0
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_category; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub set_transaction_type_web |
94
|
|
|
|
|
|
|
{ |
95
|
2
|
|
|
2
|
1
|
6
|
shift @_; |
96
|
2
|
|
|
|
|
8
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_type_web; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub set_transaction_type_other |
100
|
|
|
|
|
|
|
{ |
101
|
1
|
|
|
1
|
1
|
594
|
shift @_; |
102
|
1
|
|
|
|
|
5
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_set_type_other; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub add_transaction_attribute |
106
|
|
|
|
|
|
|
{ |
107
|
3
|
|
|
3
|
1
|
8
|
shift @_; |
108
|
3
|
|
|
|
|
11
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_add_attribute; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub notice_transaction_error |
112
|
|
|
|
|
|
|
{ |
113
|
1
|
|
|
1
|
1
|
4
|
shift @_; |
114
|
1
|
|
|
|
|
5
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_notice_error; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub end_transaction |
119
|
|
|
|
|
|
|
{ |
120
|
3
|
|
|
3
|
1
|
11
|
shift @_; |
121
|
3
|
|
|
|
|
25
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_transaction_end; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub record_metric |
125
|
|
|
|
|
|
|
{ |
126
|
1
|
|
|
1
|
1
|
2410
|
shift @_; |
127
|
1
|
|
|
|
|
6
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_record_metric; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub record_cpu_usage |
131
|
|
|
|
|
|
|
{ |
132
|
1
|
|
|
1
|
1
|
3
|
shift @_; |
133
|
1
|
|
|
|
|
5
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_record_cpu_usage; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub record_memory_usage |
137
|
|
|
|
|
|
|
{ |
138
|
1
|
|
|
1
|
1
|
3
|
shift @_; |
139
|
1
|
|
|
|
|
4
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_record_memory_usage; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub begin_generic_segment |
144
|
|
|
|
|
|
|
{ |
145
|
1
|
|
|
1
|
1
|
312
|
shift @_; |
146
|
1
|
|
|
|
|
5
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_segment_generic_begin; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub begin_datastore_segment |
151
|
|
|
|
|
|
|
{ |
152
|
1
|
|
|
1
|
1
|
345
|
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
|
|
|
|
|
|
|
{ |
160
|
1
|
|
|
1
|
1
|
370
|
shift @_; |
161
|
1
|
|
|
|
|
7
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_segment_external_begin; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub end_segment |
166
|
|
|
|
|
|
|
{ |
167
|
3
|
|
|
3
|
1
|
1166016
|
shift @_; |
168
|
3
|
|
|
|
|
53
|
goto &NewRelic::Agent::FFI::Procedural::newrelic_segment_end; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
4
|
|
|
4
|
1
|
30
|
sub get_license_key { shift->{license_key} } |
173
|
4
|
|
|
4
|
1
|
26
|
sub get_app_name { shift->{app_name} } |
174
|
4
|
|
|
4
|
1
|
19
|
sub get_app_language { shift->{app_language} } |
175
|
4
|
|
|
4
|
1
|
20
|
sub get_app_language_version { shift->{app_language_version} } |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
__END__ |