Name your Java application

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 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:

Naming method

Description

Recommended: Configure app_name in newrelic.yml

Configure your newrelic.yml file to set your app name. This is the recommended and most commonly used option:

app_name: My Application

Configure app_name using JVM arguments

Set a system property with JVM arguments to set unique app names for multiple applications that report to the same Java agent:

-Dnewrelic.config.app_name="My App"

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 newrelic.yml file:

bash
$
export NEW_RELIC_APP_NAME="My App"

Automatic application naming

Enable automatic application naming in your newrelic.yml file if you want applications named for their context, filter, servlet, or request attribute:

enable_auto_app_naming: true

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.

Tip

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.