Schedule demo

Custom Instrumentation and exception tracking


APM Insight Ruby Agent is capable of identifying default methods and classes from multiple application frameworks. The agent automatically tracks identified methods and additional metrics, but, in some cases, performance data on these methods may not be enough to debug issues. When you need additional application-specific information to resolve an issue, you can use our API to collect application-specific metrics.

Track additional methods

By default, the Ruby Agent only captures framework classes like Controllers, DB queries, and Views. You can use custom instrumentation to monitor other application-specific methods.

To get started, specify the methods to be instrumented in the application initializer, as shown below. Then create a new file named instrumentation.rb under config/initializers/.

This gives you in-depth details to troubleshoot and debug issues with your applications.

Syntax:

require 'agent/api/custom_tracker'
MyClass.class_eval do
include ::APMInsight::API::CustomTracker
    track_method :my_method1
    track_method :my_method2
end

Example:

require 'agent/api/custom_tracker'
ProjectsController.class_eval do
include ::APMInsight::API::CustomTracker
    track_method :get_internal
end

Tracking exceptions via the API

The APM Insight Ruby Agent is capable of capturing exceptions occurring in known framework methods. However, the agent can't track user-defined exceptions occurring in your application. In such cases, you can use the agent API to push exception data to Applications Manager server via the agent. 

First, add the API in the application wherever necessary. Once the app server is started, the agent will capture the exceptions when they occur, automatically associate them with the current transaction, and push those exceptions to Applications Manager servers. This helps you track all exceptions from one place.

Syntax:

require 'agent/api/custom_tracker'

Example:

require 'agent/api/custom_tracker'
... # Other declarations and definitions
def find_value
begin
.... # some instructions
rescue => ex
APMInsight::API::CustomTracker.trackException(ex)
.... # rescue operations
end
end

Loved by customers all over the world

"Standout Tool With Extensive Monitoring Capabilities"

It allows us to track crucial metrics such as response times, resource utilization, error rates, and transaction performance. The real-time monitoring alerts promptly notify us of any issues or anomalies, enabling us to take immediate action.

Reviewer Role: Research and Development

carlos-rivero
"I like Applications Manager because it helps us to detect issues present in our servers and SQL databases."
Carlos Rivero

Tech Support Manager, Lexmark

Trusted by over 6000+ businesses globally