New Relic's 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 an API key.
Use the API Explorer
- Go to the API Explorer.
- From the Servers dropdown, choose a US or EU-based API URL.
- Click Authorize, enter your user API key, and click Authorize again.
- Expand one of the available API functions: GET, PUT, DELETE.
- (Optional) Add Parameters values for your API call to filter the response (refer to the UI for descriptions and requirements for v2.)
- From the Media type dropdown, choose a format for your request: JSON or XML.
- Click Try it out, then Execute.
List product IDs
To return a list of all product IDs for a particular product:
- Click the
GET /applications.json
dropdown. - Click Try it out, then Execute.
- Browse the response to view all product IDs.
Once you've located a specific product ID, copy it for later in your other REST API calls.
List application IDs
Each app monitored by an agent is assigned a name. A unique $APP_ID
is also associated with that name. The $APP_ID
is fundamental for retrieving 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:
- Go to rpm.newrelic.com.
- Go to the API Explorer, then select your account name from the Select an account dropdown.
- Go to the API Explorer's Application host page at rpm.newrelic.com/api/explore/application_hosts/names.
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 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 the agent for .NET Framework, this is the |
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.
REST API application list example
The following example shows how to locate all the ID information for an application by using the APP_ID
. If you have an EU account, the endpoint begins with https://api.eu.newrelic.com
.
curl -X GET 'https://api.newrelic.com/v2/applications.json' \
-H "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 ] } } ],. . .