| 1 | package NewRelic::Agent::FFI::Procedural; | ||
| 2 | |||
| 3 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 4 | ▶ | use 5.010; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 4 | ▶ | use base qw( Exporter ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_OK => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_OTHER => -0x10001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_DISABLED => -0x20001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_INVALID_PARAM => -0x30001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_INVALID_ID => -0x30002; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_TRANSACTION_NOT_STARTED => -0x40001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_TRANSACTION_IN_PROGRESS => -0x40002; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 4 | ▶ | use constant NEWRELIC_RETURN_CODE_TRANSACTION_NOT_NAMED => -0x40003; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 4 | ▶ | use constant NEWRELIC_ROOT_SEGMENT => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 4 | ▶ | use constant NEWRELIC_AUTOSCOPE => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 4 | ▶ | use constant NEWRELIC_STATUS_CODE_SHUTDOWN => 0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | 4 | ▶ | use constant NEWRELIC_STATUS_CODE_STARTING => 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | 4 | ▶ | use constant NEWRELIC_STATUS_CODE_STOPPING => 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 4 | ▶ | use constant NEWRELIC_STATUS_CODE_STARTED => 3; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | # ABSTRACT: Procedural interface for NewRelic APM | ||
| 23 | 4 | our $VERSION = '0.08'; | |
| 24 | |||
| 25 | |||
| 26 | sub newrelic_init | ||
| 27 | 3 | ▶ | { |
|
Subroutine
newrelic_init: called CC=1 SCAR=0.0
Pod
documented
| |||
| 28 | 3 | return NEWRELIC_RETURN_CODE_OK; | |
| 29 | } | ||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | 4 | my $id = 1; | |
| 34 | |||
| 35 | sub newrelic_transaction_begin | ||
| 36 | 4 | ▶ | { |
|
Subroutine
newrelic_transaction_begin: called CC=1 SCAR=0.0
Pod
documented
| |||
| 37 | 4 | return $id++; | |
| 38 | } | ||
| 39 | |||
| 40 | 4 | foreach my $func (qw( newrelic_transaction_set_name newrelic_transaction_set_request_url | |
| 41 | newrelic_transaction_set_max_trace_segments newrelic_transaction_set_category | ||
| 42 | newrelic_transaction_set_type_web newrelic_transaction_set_type_other | ||
| 43 | newrelic_transaction_add_attribute newrelic_transaction_notice_error | ||
| 44 | newrelic_transaction_end newrelic_record_metric newrelic_record_cpu_usage | ||
| 45 | newrelic_record_memory_usage )) | ||
| 46 | { | ||
| 47 | 20 | ▶ | state $sub = sub { return NEWRELIC_RETURN_CODE_OK }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 48 | 4 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 49 | 48 | *$func = $sub; | |
| 50 | } | ||
| 51 | |||
| 52 | sub newrelic_segment_generic_begin | ||
| 53 | 1 | ▶ | { |
|
Subroutine
newrelic_segment_generic_begin: called CC=1 SCAR=0.0
Pod
documented
| |||
| 54 | 1 | return $id++; | |
| 55 | } | ||
| 56 | |||
| 57 | |||
| 58 | sub newrelic_segment_datastore_begin | ||
| 59 | 2 | ▶ | { |
|
Subroutine
newrelic_segment_datastore_begin: called CC=1 SCAR=0.0
Pod
documented
| |||
| 60 | 2 | $id++; | |
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | sub newrelic_segment_external_begin | ||
| 65 | 1 | ▶ | { |
|
Subroutine
newrelic_segment_external_begin: called CC=1 SCAR=0.0
Pod
documented
| |||
| 66 | 1 | $id++; | |
| 67 | } | ||
| 68 | |||
| 69 | sub newrelic_segment_end | ||
| 70 | 4 | ▶ | { |
|
Subroutine
newrelic_segment_end: called CC=1 SCAR=0.0
Pod
documented
| |||
| 71 | 4 | return NEWRELIC_RETURN_CODE_OK; | |
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | sub newrelic_register_message_handler | ||
| 76 | 1 | ▶ | { |
|
Subroutine
newrelic_register_message_handler: called CC=1 SCAR=0.0
Pod
documented
| |||
| 77 | 1 | return; | |
| 78 | } | ||
| 79 | |||
| 80 | 4 | ▶ | use constant newrelic_message_handler => 0xdeadbeaf; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 81 | |||
| 82 | |||
| 83 | 4 | ▶ | use constant newrelic_basic_literal_replacement_obfuscator => 0xbeafdead; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 84 | |||
| 85 | |||
| 86 | sub newrelic_request_shutdown | ||
| 87 | 1 | ▶ | { |
|
Subroutine
newrelic_request_shutdown: called CC=1 SCAR=0.0
Pod
documented
| |||
| 88 | 1 | return NEWRELIC_RETURN_CODE_OK; | |
| 89 | } | ||
| 90 | |||
| 91 | |||
| 92 | sub newrelic_enable_instrumentation | ||
| 93 | 0 | ▶ | { |
|
Subroutine
newrelic_enable_instrumentation: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 94 | 0 | return; | |
| 95 | } | ||
| 96 | |||
| 97 | 4 | our @EXPORT = sort grep /^newrelic_/i, keys %NewRelic::Agent::FFI::Procedural::; | |
| 98 | |||
| 99 | 4 | 1; | |
| 100 | |||
| 101 | __END__ | ||