Knowledge Base: How do I prevent a controller from being instrumented?

In the controller class, add the following line:

newrelic_ignore

to ignore all actions in that controller, or

newrelic_ignore :only => [... actions ...] | :except => [... actions ...]

to ignore specific actions.

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. If you want to prevent a controller action from contributing to the Apdex score but would still like to see performance data, use:

newrelic_ignore_apdex

instead. The same :only and :except options can be used to ignore specific actions.

Keep in mind this will introduce a dependency on the New Relic Agent which might not otherwise be there. To avoid the hard link to the agent you can use this notation to block all actions of a controller:

write_inheritable_attribute('do_not_trace', true)