Rack and Metal support

With the inclusion of a special instrumentation module, you can capture Rack apps and Metals as controller actions.

require 'new_relic/agent/instrumentation/rack'
class Middleware
  def call(env)
    ...
  end
  # Do the include after the call method is defined:
  include ::NewRelic::Agent::Instrumentation::Rack
end

For Metal, you need to extend the Metal class:

require 'new_relic/agent/instrumentation/rack'
class MetalApp
  def self.call(env)
    ...
  end
  # Do the include after the call method is defined:
  extend ::NewRelic::Agent::Instrumentation::Rack
end

The middleware will appear in New Relic as if it is a controller action, named by the class where it is defined.

For more help

Additional documenation resources include Rack (how the Ruby agent uses Rack for some functions for cross application tracing, page load timing auto-instrumentation, and error collection).

If you need additional help, get support at support.newrelic.com.