Disable the APM agent

You may want to temporarily disable a New Relic APM agent for the purposes of testing or troubleshooting. This document explains procedures for temporarily turning off the APM agent.

Related procedures:

Disable the APM agent

Select your agent type for instructions:

Go

There are two main ways to disable the Go agent:

  • Remove the import of the github.com/newrelic/go-agent package from your application, and remove or comment out any calls to the newrelic namespace. Then, recompile and restart your app.
  • Use the enabled configuration setting. Then, recompile and restart your app. (This will not reduce overhead because the instrumentation is still running; it will only prevent the sending of data to the New Relic collector.)

After you disable the agent, it may take several minutes for data to stop showing up.

Java

There are three main ways to disable the Java agent:

  • Set agent_enabled to false, then restart the JVM.
  • Use the JVM command line flag:

    -Dnewrelic.config.agent_enabled=false
    

    Then restart the JVM.

  • Remove the newrelic.jar or newrelic.yml file, then restart the JVM.

After you disable the agent, it may take several minutes for data to stop showing up.

.NET

The method to disable the agent depends on if you are using Framework or Core:

  • .NET Framework: Set agentEnabled to false in the global newrelic.config file, found in C:\ProgramData\New Relic\.NET Agent\. If the application is IIS-hosted, restart IIS. If it's self-hosted (non-IIS), restart the application.
  • .NET Core: Set agentEnabled to false in the newrelic.config file found in the Core agent’s installation directory (for Windows alongside NewRelic.Profiler.dll and for Linux alongside NewRelic.Profiler.so). If you use the ASP.NET Core Module, reset IIS. Otherwise, restart your Core application.

After you disable the agent, it may take several minutes for data to stop showing up.

Node.js

There are two main ways to disable the Node.js agent:

After you disable the agent, it may take several minutes for data to stop showing up.

PHP

To disable the PHP agent, set the enabled config setting to false, then restart the web server or PHP.

After you disable the agent, it may take several minutes for data to stop showing up.

Python

There are three main ways to disable the Python agent, depending on your preference and setup:

After you disable the agent, it may take several minutes for data to stop showing up.

Ruby

There are several ways to disable the Ruby agent, depending on your preference and setup.

These methods will remove most instrumentation but there will still be a small amount of activity and overhead:

  • Use the agent_enabled configuration setting. This can be done in the configuration file or in the per-environment stanzas. Restart your app server afterward.
  • Do the same via an environment variable, then restart the app server.

The following methods will remove all instrumentation and overhead:

  • Remove newrelic_rpm from the Gemfile and bundle install.
  • Set the following in the Gemfile and bundle install:

    gem 'newrelic_rpm', :require => false
    

    This option ensures the gem is installed if it's required somewhere in the app, but doesn't install it when bundling.

After you disable the agent, it may take several minutes for data to stop showing up.

For more help

Recommendations for learning more: