Blocking controller instrumentation

This describes how you can selectively disable instrumentation for particular controllers or actions within your application.

Blocking all instrumentation with newrelic_ignore

Use newrelic_ignore to prevent a controller from being instrumented:

In the controller class, add the following line to ignore all actions in that controller:

newrelic_ignore

Add the following to ignore only the index action:

newrelic_ignore :only => [:index]

Add the following to ignore all actions on the controller except index:

newrelic_ignore :except => [:index]

Using newrelic_ignore prevents the agent from recording any performance data for that controller action, and will also prevent the action from contributing to the overall Apdex score measurement.

Avoiding Apdex contributions with newrelic_ignore_apdex

Use newrelic_ignore_apdex to prevent a controller from factoring into your Apdex score.

If you want to prevent all actions in a controller from contributing to the Apdex score but would still like to see performance data, use:

newrelic_ignore_apdex

Add the following to only exclude the index action from Apdex:

newrelic_ignore_apdex :only => [:index]

Add the following to exclude all actions except index from Apdex:

newrelic_ignore_apdex :except => [:index]

Blocking page load timing with newrelic_ignore_enduser

Using newrelic_ignore_enduser prevents the agent from automatically inserting the JavaScript used to capture page load timing data. Server-side instrumentation will be unaffected.

To prevent page load timing (sometimes referred to as real user monitoring or RUM) for all actions in a controller, add a call like this to the controller class:

newrelic_ignore_enduser

Add the following to only exclude page load timing on the index action:

newrelic_ignore_enduser :only => [:index]

Add the following to exclude page load timing on all actions except index:

newrelic_ignore_enduser :except => [:index]

For Sinatra users

The various newrelic_ignore* methods can be used in Sinatra applications as well, though the usage is slightly different. See our Sinatra documentation for details.

Troubleshooting

If you get a NoMethodError when trying to use newrelic_ignore, try including the controller instrumentation to fix this error. In your controller:

require 'new_relic/agent/instrumentation/controller_instrumentation'

For more help

Additional documentation resources include Apdex: measuring user satisfaction (how Apdex is calculated).

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