List application ID, host ID, instance ID

New Relic APM assigns IDs to entities related to an application. These are used to collect information about the operation and performance from different view points. These IDs can be returned via New Relic's REST API.

The IDs may include:

  • Application ID {APP_ID} for each instrumented app
  • Host ID {HOST_ID} for each host
  • Instance ID {INSTANCE_ID} if there are multiple instances of the app

To list any of these IDs in the New Relic API Explorer, you need your REST API key.

List application IDs

Each app monitored by a New Relic APM agent is assigned a name. A unique {APP_ID} is also associated with that name. The {APP_ID} is fundamental for retrieving APM information about your apps. For more information about listing and using the {APP_ID}, and obtaining the summary data, see Listing your app ID.

List host IDs

The {HOST_ID} is used to get APM data for a specific host running an app. A physical server may have more than one host. For example, a web server program running on a physical server may be configured to have more than one virtual host.

IDs for the host and physical server are not the same. Each host ID is unique and represents different items.

Use the {HOST_ID} to retrieve summary metrics for the host as well as specific metric timeslice values. For more information about available metrics:

  1. Make sure you are logged in to New Relic: Go to rpm.newrelic.com.
  2. Go to the API Explorer, then select your account name from the Select an account dropdown.
  3. Go to the API Explorer's Application Host page at rpm.newrelic.com/api/explore/application_hosts/names.
Host ID and summary data using the REST API Explorer

To use the API Explorer to return a list of every HOST_ID for a particular application, you will need the APP_ID.

  1. Go to the API Explorer, then select your account name from the Select an account dropdown.
  2. Enter the specific {APP_ID} in the following command:

    curl -X GET 'https://api.newrelic.com/v2/applications/${APP_ID}/hosts.json' \
         -H 'X-Api-Key:${API_KEY}' -i 

    If you have an EU region account, the endpoint begins with https://api.eu.newrelic.com.

  3. Select Send Request.
  4. Browse the Response to locate the {HOST_ID} for each host.
{HOST_ID} output

The output will appear similar to this:

{
  "application_hosts": [
    {
      "id": 34966,      <---<<< {HOST_ID}
      "application_name": "Combined Production",
      "host": "prod-app-10.com",
      "language": "ruby",
      "health_status": "green",
      "application_summary": {
        . . .
      },
      "links": {
        "application": 1234,   <---<<< {APP_ID}
        "application_instances": [
          13512     <---<<< {INSTANCE_ID}
        ],
      }
    },
    {
      "id": 9999999,      <---<<< {HOST_ID}
      "application_name": "Combined Production",
      "host": "prod-app-11.com",
      "language": "ruby",
      "health_status": "green",
      "application_summary": {
        ". . .
      },
      "links": {
        "application": 1234,   <---<<< {APP_ID}
        "application_instances": [
          186288     <---<<< {INSTANCE_ID}
        ],
      }
    },
. . . 

List instance IDs

The instance ID meaning depends on the New Relic language agent being used. You can list this ID from the REST API. For Java, you can also view the instance ID (JVM) from New Relic APM's Overview page.

Agent Instance ID represents
Go The Go program on the host reporting to the app name
Java A Java Virtual Machine (JVM)
.NET For New Relic's .NET Framework agent, this is the AppDomain
Node.js A worker process
PHP The daemon agent
Ruby An individual Ruby worker process
Python The master and worker processes

You can retrieve summary metrics for the instance as well as specific metric timeslice values using the {INSTANCE_ID}. For details about available metrics, use the REST API Explorer Application Instance page.

Instance ID and summary data using the REST API Explorer

To use the API Explorer to return a list of every {INSTANCE_ID} for a particular application, you will need the APP_ID.

  1. Go to the API Explorer, then select your account name from the Select an account dropdown.
  2. Enter the specific {APP_ID} in the following command:

    curl -X GET 'https://api.newrelic.com/v2/applications/${APP_ID}/hosts.json' \
         -H 'X-Api-Key:${API_KEY}' -i 

    If you have an EU region account, the endpoint begins with ​https://api.eu.newrelic.com.

  3. Select Send Request.
  4. Browse the Response to locate the {INSTANCE_ID} for each instance.
{INSTANCE_ID} output

The {INSTANCE_ID} output will appear similar to this:

{
  "application_instances": [
    {
      "id": 35120,     <---<<< {INSTANCE_ID}
      "application_name": "Combined Production",
      "host": "prod-app-10.com",
      "language": "ruby",
      "health_status": "green",
      "application_summary": {
        . . .
      },
      "links": {
        "application": 1441,   <---<<< {APP_ID}
        "application_host": 34966,    <---<<< {HOST_ID}
      }
    },
    {
      "id": 186288,     <---<<< {INSTANCE_ID}
      "application_name": "Combined Production",
      "host": "prod-app-11.com",
      "language": "ruby",
      "health_status": "green",
      "application_summary": {
        . . .
      },
      "links": {
        "application": 1441,   <---<<< {APP_ID}
        "application_host": 186283,    <---<<< {HOST_ID}
      }
    },
. . .
Java instance ID (JVM) using the UI

Java apps: To locate a specific JVM {INSTANCE_ID} in New Relic APM:

  1. Go to rpm.newrelic.com > APM > Applications > (select an app) > Monitoring > Overview.
  2. From the JVMs dropdown on the APM Overview page, select the instance name.

In the URL, the number after the _i designator represents the Java JVM instance:

https://rpm.newrelic.com/accounts/ACCOUNT_ID/applications/APP_ID_iINSTANCE_ID

REST API application list example

The following REST API example command shows how to locate all the ID information for an application by using the APP_ID. If you have an EU region account, the endpoint begins with https://api.eu.newrelic.com.

curl -X GET 'https://api.newrelic.com/v2/applications.json' \
     -H 'X-Api-Key:${API_KEY}' -i \
     -d 'filter[ids]=1441'    <----<<<< {APP_ID} 

The resulting example output is running on five servers. One server is hosting two virtual hosts for a total of six hosts. The output includes a links section listing the application_instances and application_hosts for the application.

{
  "applications": [
    {
      "id": 1441,      <----<<<< {APP_ID}
      "name": "RPM Combined Production",
      "language": "ruby",
      "health_status": "green",
      "reporting": true,
      "last_reported_at": "2015-11-10T23:19:47+00:00",
      "application_summary": {
        . . .
      },
      "end_user_summary": {
        . . .
      },
      "settings": {
        . . .
      },
      "links": {
        "application_instances": [    <---<<<< {INSTANCE_ID} list
          21790,
          24810,
          27948,
          35120,
          35121,
          35122,
          186288,
          247253,
          247254,
          247255,
          247256
        ],
        "application_hosts": [    <---<<<< {HOST_ID} list
          21788,
          24808,
          34966,
          186283,
          247245,
          286551
        ]
      }
    }
  ],
. . . 

For more help

Recommendations for learning more: