Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Relic Solution: Application Naming in the .NET Agent


#1

This post is intended to provide an overview of how the .NET agent names your applications in the APM user interface. I’ll also try to share some techniques for configuration of application names and troubleshooting of common issues.

Background

Applications in your New Relic account are differentiated by the name that they report from your servers. If any two applications report with an identical name to the same account, the data from those applications will be aggregated under a single application name in the UI. Conversely, any application reporting a different name than what currently exists in your account will be split into a new application in the UI.

Each distinct application that you want to display in the New Relic UI should be configured to report with a unique name.

How the .NET Agent Names Your Applications

There are 6 different ways to name your applications with the .NET agent. These are listed below in order of precedence.

  • With an API Call

This method is the least common way of naming applications, but it takes the highest precedence. Naming via an API call from your source code will override all other naming methods that may be configured.

This involves making a SetApplicationName() call to the .NET Agent API from within your application code.

Each call to SetApplicationName() will override the previous call.
Application names set via the .NET agent API will not be persisted between application restarts.

  • With an Environment variable (agent version 6.17+ only)

The environment variable is NEW_RELIC_APP_NAME

  • Via your application’s web.config/app.config file

Naming via your application’s web.config or app.config file will override any other naming configuration, except an API call.

To name your application in the web.config or app.config file, add the following settings (replacing "YOUR APPLICATION NAME", as needed):

<appSettings>
    <add key = "NewRelic.AppName" value="YOUR APPLICATION NAME" />
</appSettings>

Note: An IIS reset is required to pick up these configuration changes

  • Via an application-specific newrelic.config file

If no name is provided with either of the above methods, the agent will look for the existence of a file called newrelic.config in the root folder of your application. If that file exists, it will look for the presence of the <configuration>–><application>–><name> element, and name your application after its value.

The application-specific newrelic.config file does not exist by default. If you’d like to use this method for naming your application, you’ll need to make a copy of the newrelic.config file located at C:\ProgramData\New Relic\.NET Agent and place it in the root folder of your application.

Once the file exists in the right location, edit the file to make sure that the following settings are present as a child of the <configuration> element:

<application>
	<name>YOUR APPLICATION NAME</name>
</application>

Notes:
-An IIS reset is required to pick up these configuration changes
-There is no inheritance between the global newrelic.config file and the application-specific newrelic.config file. If an application-specific version exists in the root folder of your application, the agent will ignore the global file.

  • Via the global newrelic.config

If none of the above naming methods are present, the agent will name your application after the value of the <configuration>–><application>–><name> element in the global newrelic.config file located at C:\ProgramData\New Relic\.NET Agent.

The global newrelic.config file applies to all applications being monitored on your server, so if no other methods are used to name your application(s), and the <name> element exists in the global file, all monitored applications on your server will use this name.

If you only plan on monitoring a single application on your server, this naming method can be used. However, if you need to monitor multiple applications on a single server, you should select one of the other naming methods described.

To use this naming method, edit the newrelic.config file to make sure that the following settings are present as a child of the <configuration> element:

<application>
	<name>YOUR APPLICATION NAME</name>
</application>

Notes:
-An IIS reset is required to pick up these configuration changes
-Since the out-of-the-box installation of the .NET agent includes the <name> value “My Application” in the global config file, this is the default naming method of the agent after initial installation.

  • Automatic application naming

If the agent is not able to obtain a name from any of the sources above, it will attempt to name your application after the application pool the app is hosted in, or after the executable of the application itself (in the case of non-IIS hosted background/console applications).

To use this method in naming your applications, make sure that none of the other naming methods mentioned above are present.

-Make sure your application is not making a call to SetApplicationName() in the .NET Agent API.
-Remove the <add key = "NewRelic.AppName" value="YOUR APPLICATION NAME" /> setting from your web.config/app.config file (if it exists).
-Remove the <name> . . . </name> element from any application-specific newrelic.config files that may exist in the root folder of your application(s).
-Remove the <name> . . . </name> element from the global newrelic.config file at C:\ProgramData\New Relic\.NET Agent, if that element exists.

Notes:
-If you altered any of the above mentioned files in this process, an IIS reset is required to pick up these configuration changes
-The .NET agent is not able to use automatic naming on application pools which use a pre-loader module (such as Microsoft’s Application Initialization Module) or when using the “Always On” feature of Azure Instances. If your application pool or Azure instance uses a pre-loader you’ll need to use one of methods above to provide a specific application name.

Troubleshooting

I’m monitoring multiple applications on my server, but only seeing one application in my New Relic account (often named “My Application”).

The default installation of the .NET agent includes a default name of “My Application” in the global newrelic.config file. In out-of-the-box installations on servers where multiple applications need to be monitored, the data from all monitored applications will be rolled into the single default application in the New Relic UI. To resolve this issue, select one of the methods above (other than “Via the global newrelic.config”) to provide a specific name for each application.

The application name in the UI is different than the application name I configured.

In most cases, this is because the application has been given a “display alias” in the user interface. Changing the application name in the user interface is only for display purposes and has no impact on the name reported from your server to your account.

To see if your display name is different than your reporting name, navigate to the application in your New Relic account and select the “Settings” link (under “Application” in the left column). On this page you’ll see the display name in the “Name” field and the application name reported from your server in the caption under the “Name” field.

Additional Info

The official documentation on naming your .NET applications can be found here

The documentation contains some additional information not covered here, such as providing multiple application names for a single application and loading an application name via an external config file.

If you have any other questions, please reach out to the community through a forum post, or submit a ticket to support here.

Hope this helps!

Don


Application pool configuration issue in .Net Agent
How Do I Monitor Multiple Web Applications on a Single IIS Host?
Can I set EnvironmentVariables for agent by web.config?
Newrelic agent for ASP.NET Core (1.1 and 2.0)