Relic Solution: How to disable any or all instrumentation or services in the Java agent

The New Relic Support team often receives requests from users who would like assistance with troubleshooting unexpected resource utilization in their applications. One of the easiest steps to take to check the impact instrumentation is having on an application is to disable specific (or all) instrumentation modules to see if and when performance improves.

In order to view instrumentation modules that the agent has applied out-of-the-box, use the Metrics Explorer to view the application’s Supportability Metrics:

From APM: More Views -> Metrics Explorer -> Search -> type in Supportability/WeaveInstrumentation/Loaded. This should return a list of currently applied instrumentation modules similar to the following:


The fully qualified name of these instrumentation module are defined as the Implementation-Title within the manifest section of the build.gradle for each module - for example, akka-http-core-10.0:

    manifest { attributes 'Implementation-Title': 
'com.newrelic.instrumentation.akka-http-core-10.0' }

How to turn off instrumentation for a specific framework

Add the following to the newrelic.yml file, replacing the [framework_name] line with the relevant entries from the list above:

common: &default_settings
      enabled: false

Note that common: &default_settings should already be present near the top of all newrelic.yml files, and that class_transformer: may be present as well depending on their configuration and agent version. These lines must appear in order (although not necessarily right next to each other), and should not appear twice. YAML syntax is space sensitive, there should be exactly two spaces in front of the first line, four in front of the second line, and six in front of the third line.

Alternatively, you can pass in the following system property to achieve the same result:[framework_name].enabled=false

To confirm that the desired instrumentation module is disabled, entries similar to the following can be found in the New Relic Agent log:

Dec 1, 2050 11:22:49 -0700 [81094 16] com.newrelic INFO: Instrumentation com.newrelic.[framework_name] is disabled. Skipping.

How to turn off weave instrumentation for a specific class

The excludes functionality works for inner classes as well as their outer classes. As an example, if you wanted to exclude the following inner class AsyncResponder within the outer class ServerRuntime, you would specify it within the excludes stanza like so:

common: &default_settings 

There is an escape character preceding $AsyncResponder. The reason for this is because the $ is treated as a special character by regex, and our Agent uses regex to match which classes it should exclude.

In some cases, there may not be a clear instrumentation module to disable, or perhaps there’s only a single class that you might not want to instrument but disabling the module obfuscates too much data. It is possible to specify certain classes by name which should be ignored by the class transformer:

common: &default_settings 

How to turn off instrumentation completely:

When turning off instrumentation completely, you have two options: Disabling the Class Transformer or enabling Lite Mode. To disable the class transformer:

common: &default_settings
    enabled: false

Or you can also pass in the following:


Using the above disables transformation of all classes and classloaders in the application. (sans custom instrumentation / FIT extensions). You can confirm that class transformation is disabled by looking for entries similar to the following in the New Relic Agent log:

Jan 1, 2050 14:38:31 -0700 [83969 1] com.newrelic.agent.instrumentation.ClassTransformerServiceImpl INFO: The class transformer is disabled. No classes will be instrumented.

If you choose to use lite_mode:

common: &default_settings
  lite_mode: true

Or you can also pass in the following:


Lite Mode is a way of running the Java Agent with a Java application that has basic reporting requirements and only needs simple monitoring such as: JMX Metrics, JVM and GC statistics, thread metrics, custom insights events, etc.

In Lite Mode, all of the built in instrumentation is disabled, which means you won’t see Transactions unless you specifically use custom instrumentation to create them. Running the agent in this mode implies an understanding of the trade-off between reporting detail and performance overhead.

To confirm that lite_mode is enabled, entries similar to the following can be found in the New Relic Agent log:

Jan 1, 2050 11:00:44 -0700 [80577 1] com.newrelic INFO: New Relic agent is running in lite mode. All instrumentation modules are disabled

Additional services that can be disabled for troubleshooting:

Disable Transaction Tracing:

    enabled: false

Disable JMX Metric collection:

    enabled: false

Disable the Circuit Breaker:

    enabled: false

Disable the Remote Instrumentation Service which provides the ability to add instrumentation via XML (Custom Instrumentation Editor or Extensions):

    enabled: false

Disable the collection of Attributes:

    enabled: false

Disable Class Transformation (the basis of all New Relic instrumentation by bytecode manipulation):

    enabled: false

Disable the gathering and sending of jars with their version information to the collector:

    enabled: false

Disable the Error Collector:

    enabled: false

Disable the Thread Profiler:

    enabled: false

Disable Distributed Tracing:

    enabled: false

Disable the collection of Transaction Events:

    enabled: false

Disable the Deadlock Detector service:

    enabled: false

I was trying to do above for one of my application, but unable to find Supportability/WeaveInstrumentation/Loaded
Does this feature still exists?

Maybe increase your time window. Those metrics are not sent frequently.

What do you mean by increasing the time window?

When using the Metrics Explorer, you are querying a time window, that can be selected on the top right corner. It is possible that those metrics were sent outside the time window that you are querying for.

1 Like