New Relic's Java agent gives you several ways to change the application name that is reported and displayed in APM. This document gives you an overview of those naming options.
For a general overview of APM app naming (not Java-specific), see Name your application.
Set or change app name
APM differentiates applications by the name they report as. Data continuity breaks when you change the application name. To change an application's name without breaking data continuity, use the UI alias-change option.
Here are the ways to change your Java application's name:
app_name: My Application
||Set a system property with JVM arguments to set unique app names for multiple applications that report to the same Java agent:
|Set app name using environment variables||Set an environment variable to easily set app names during the deployment of containers, or to ensure an app name stays the same through multiple iterations of a
export NEW_RELIC_APP_NAME="My App"
|Automatic application naming||Enable automatic application naming in your
|Change alias via UI||Change an application's alias to change only the displayed name in the UI. This does not change the name the application reports as.
This does not break data continuity, unlike all other options.
Note that some methods take precedence over others.
Use multiple app names
You can use multiple app names to aggregate data from several applications under the same name in APM (sometimes referred to as "rolling up" your data). For more about how multiple app names work, see Use multiple app names.
In Java, you can set up to three app names. The primary app name is first, while the second and third names are used for the more general data aggregation categories.
- Java config file
Here is an example of setting multiple names in the
app_name: My Application;My Application 2;My application 3
- Java environment variable
Here is an example of setting multiple names as environment variable:
export NEW_RELIC_APP_NAME="My Application;My Application 2;My application 3"
- System properties
If you set multiple application names using system properties on the Java command line, remember to quote the command-line parameter because of the ; character.
Here is an example of setting multiple names as a system property:
-Dnewrelic.config.app_name="My Application;My Application 2;My application 3"