Alt-NewRelic-Agent-FFI-Empty
view release on metacpan or search on metacpan
lib/NewRelic/Agent/FFI/Procedural.pm view on Meta::CPAN
# that return a string, you need to create a C pointer to a copy of
# the return value. On the next call we will free the previous copy.
state $ptr = 0;
free($ptr) if $ptr;
return $ptr = strdup($sql);
}
$ffi->type('(string)->opaque' => 'obfuscator_t');
my $myobfuscator_closure = $ffi->closure(\&myobfuscator);
my $myobfuscator_ptr = $ffi->cast('obfuscator_t' => 'opaque', $myobfuscator_closure);
newrelic_segment_datastore_begin $tx, $seg, $table, $sql, $rollup, $myobfuscator_ptr;
...
=head2 newrelic_segment_external_begin
my $seg = newrelic_segment_external_begin $tx, $parent_seg, $host, $name;
Begins a new external segment. C<$parent_seg> is a parent segment id (C<undef> no parent).
=head2 newrelic_segment_end
my $rc = newrelic_segment_end $tx, $seg;
End the given segment.
=head2 newrelic_register_message_handler
newrelic_register_message_handler $handler;
Register the message handler used to send messages to NewRelic. The only useful way at the moment to use
this function is by giving it C<newrelic_message_handler>, which sends messages directly to NewRelic,
rather than through a separate daemon process:
newrelic_register_message_handler newrelic_message_handler;
This needs to be called BEFORE you call C<newrelic_init>.
=head2 newrelic_message_handler
my $address = newrelic_message_handler;
Returns the address of the C function that handles sending messages directly to NewRelic. This cannot
be called directly from Perl, but can be passed to C<newrelic_register_message_handler> like so:
newrelic_register_message_handler newrelic_message_handler;
This needs to be called BEFORE you call C<newrelic_init>.
=head2 newrelic_basic_literal_replacement_obfuscator
my $address = newrelic_basic_literal_replacement_obfuscator;
Returns the address of the C function that does the basic/default obfuscator contained within the
NewRelic agent library. Normally you wouldn't call this from Perl, so it is the address of the
function, not the function itself. You can, however, call it via L<FFI::Platypus>:
use FFI::Platypus;
my $ffi = FFI::Platypus->new;
$new->attach( newrelic_basic_literal_replacement_obfuscator, ['string'] => 'string');
my $save = newrelic_basic_literal_replacement_obfuscator("SELECT * FROM user WHERE password = 'secret'");
=head2 newrelic_request_shutdown
my $rc = newrelic_request_shutdown $reason;
Tell the Collector Client to shutdown and stop reporting application performance data to New Relic.
=head2 newrelic_enable_instrumentation
newrelic_enable_instrumentation $set_enabled;
Disable/enable instrumentation. By default, instrumentation is enabled.
C<$set_enabled> 0 to disable, 1 to enable
=head1 CAVEATS
=head2 Platform Limitations
The SDK binaries provided by New Relic only work on Linux x86_64. The binaries are labeled
as a "beta" and were released in July 2016. It doesn't seem likely that New Relic will be
releasing new versions of the SDK. The author of this module has had good success getting
this module to work on Ubuntu Precise and Xenial, and heard from user feedback that it works
with Bionic. I have heard that it does NOT work with CentOS 7. Your mileage may vary.
=head2 Not Fork Safe!
Bad things will happen if you call newrelic_init before forking. So don't do that.
=head1 SEE ALSO
=over 4
=item L<NewRelic::Agent::FFI>
=back
=head1 AUTHOR
Graham Ollis <plicease@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2019 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 1.242 second using v1.01-cache-2.11-cpan-e1769b4cff6 )