Alt-NewRelic-Agent-FFI-Empty

 view release on metacpan or  search on metacpan

lib/NewRelic/Agent/FFI.pm  view on Meta::CPAN

Embeds the collector agent for harvesting NewRelic data. This should be called before C<init>, if the agent is being used in Embedded mode and not Daemon mode.

=head2 init

 my $rc = $agent->init;

Initialize the connection to NewRelic.

=head2 begin_transaction

 my $tx = $agent->begin_transaction;

Identifies the beginning of a transaction, which is a timed operation consisting of multiple segments. By default, transaction type is set to C<WebTransaction> and transaction category is set to C<Uri>.

Returns the transaction's ID on success, else negative warning code or error code.

=head2 set_transaction_name

 my $rc = $agent->set_transaction_name($tx, $name);

Sets the transaction name.

=head2 set_transaction_request_url

 my $rc = $agent->set_transaction_request_url($tx, $url);

Sets the transaction URL.

=head2 set_transaction_max_trace_segments

 my $rc = $agent->set_transaction_max_trace_segments($tx, $max);

Sets the maximum trace section for the transaction.

=head2 set_transaction_category

 my $rc = $agent->set_transaction_category($tx, $category);

Sets the transaction category.

=head2 set_transaction_type_web

 my $rc = $agent->set_transaction_type_web($tx);

Sets the transaction type to 'web'

=head2 set_transaction_type_other

 my $rc = $agent->set_transaction_type_other($tx);

Sets the transaction type to 'other'

=head2 add_transaction_attribute

 my $rc = $agent->add_transaction_attribute($tx, $key => $value);

Adds the given attribute (key/value pair) for the transaction.

=head2 notice_transaction_error

 my $rc = $agent->notice_transaction_error($tx, $exception_type, $error_message, $stack_trace, $stack_frame_delimiter);

Identify an error that occurred during the transaction. The first identified
error is sent with each transaction.

=head2 end_transaction

 my $rc = $agent->end_transaction($tx);

=head2 record_metric

 my $rc = $agent->record_metric($key => $value);

Records the given metric (key/value pair).  The C<$value> should be a floating point.

=head2 record_cpu_usage

 my $rc = $agent->record_cpu_usage($cpu_user_time_seconds, $cpu_usage_percent);

Records the CPU usage. C<$cpu_user_time_seconds> and C<$cpu_usage_percent> are floating point values.

=head2 record_memory_usage

 my $rc = $agent->record_memory_usage($memory_megabytes);

Records the memory usage. C<$memory_megabytes> is a floating point value.

=head2 begin_generic_segment

 my $seg = $agent->begin_generic_segment($tx, $parent_seg, $name);

Begins a new generic segment.  C<$parent_seg> is a parent segment id (C<undef> no parent).  C<$name> is a string.

=head2 begin_datastore_segment

 my $seg = $agent->begin_datastore_segment($tx, $parent_seg, $table, $operation, $sql, $sql_trace_rollup_name);

Begins a new datastore segment.  C<$parent_seg> is a parent segment id (C<undef> no parent).

=head2 begin_external_segment

 my $seg = $agent->begin_external_segment($tx, $parent_seg, $host, $name);

Begins a new external segment.  C<$parent_seg> is a parent segment id (C<undef> no parent).

=head2 end_segment

 my $rc = $agent->end_segment($tx, $seg);

End the given segment.

=head2 get_license_key

 my $key = $agent->get_license_key;

Get the license key.

=head2 get_app_name

 my $name = $agent->get_app_name;



( run in 1.904 second using v1.01-cache-2.11-cpan-e1769b4cff6 )