Infrastructure subscription usage attributes and queries

This document contains the attributes available for New Relic Infrastructure subscription usage, and provides example NRQL queries for use in Insights or API calls.

For an introductory explanation subscription usage data, see Introduction to usage data.

Data generation

Once per day, a New Relic Infrastructure account will generate a NrDailyUsage Insights event for every unique host on which an application instance existed over the last 24 hours.

All Infrastructure events have a productLine attribute value of Infrastructure.

For examples of NRQL queries, see query examples.

General attributes

The following are general (not Infrastructure-specific) account-related attributes. These attributes can help you understand how your accounts and sub-accounts are using New Relic products.

Attribute Description
consumingAccountId

ID of the New Relic account that is directly responsible for the stored events, as determined from the license key used.

consumingAccountName Name of the New Relic account that is directly responsible for the stored events, as determined from the license key used.
masterAccountId

The ID of the master account that is either responsible for stored events or that is the parent of the consuming account. When a master account is the consuming account, masterAccountId is the consumingAccountId.

This attribute is present even for accounts that do not have a master account. This is to ensure continued reporting if the account is later made a master account.

masterAccountName

Name of the master account that is either responsible for stored events, or that is the parent of the consuming account. When a master account is the consuming account, masterAccountName is the consumingAccountName.

This attribute is present even for accounts that do not have a master account. This is to ensure continued reporting if the account is later made a master account.

partnershipId

Partner ID of the New Relic customer partnership associated with the account responsible for the stored events.

This attribute is only present if the consuming account is associated with a New Relic customer partnership.

partnershipName

Name of the New Relic customer partnership associated with the account responsible for the stored events.

This attribute is only present if the consuming account is associated with a customer partnership.

subAccountId

ID of the sub-account that is responsible for the stored event. When this attribute is present, subAccountId is the consumingAccountId.

This attribute is only present if the consuming account is a sub-account (not a master account).

subAccountName

Name of the sub-account responsible for stored events. When present, this attribute is the same as the consumingAccountName.

This attribute is only present if the consuming account is a sub-account (not a master account).

timestamp UNIX timestamp (seconds since epoch) of the day and time when event generation was initiated.

Infrastructure attributes

The following are usage-related attributes generated by Infrastructure. To query this data, use a productLine attribute value of Infrastructure.

Attribute Description
agentHostname ID used to uniquely identify the host for which this usage is reported. Any given hour of usage for this host will be counted only once when calculating infrastructureHoursUsed. There are several possible host identifiers reported by the New Relic agent. The usage reporting system will always use the agent-reported hostname to uniquely identify the host for the Infrastructure product, but will also record the cloudInstanceId, if present, for informational purposes.
cloudInstanceId

ID uniquely identifying the cloud host instance (example: an AWS EC2 instance) for which this usage is reported. (For example, for an AWS EC2 instance, the value would look like i-1234abcd5678ef900.) This will not be present if no cloud provider was detected by the agent.

cloudInstanceSize Size of the cloud instance for this host for CU billing purposes, as calculated according to the formula for infrastructureBillingInstanceSize, using the CPU and memory sizes associated with the instance type defined by the cloud provider. Will not be present if no cloud provider was detected by the agent.
cloudInstanceType Instance type of the host as defined by the cloud provider and detected by the agent. For example: c4.2xlarge. This will not be present if no cloud provider was detected by the agent.
cloudProvider Name of the cloud provider for this host. Example values: aws, azure. This will not be present if no cloud provider was detected by the agent.
cloudZone Name of the zone that a cloud provider host is located in. For example: eu-central-1b. This will not be present if no cloud provider was detected by the agent.
infrastructureAgentVersion Version of the Infrastructure agent running on the host reporting this usage. If multiple agents are reporting from the same host, the version from the first agent seen in a given hour will be used.
infrastructureAgentMemoryBytes Bytes of RAM available to the host, used to calculate infrastructureBillingInstanceSize.
infrastructureAgentProcessorCount Number of logical CPU cores available to the host, used to calculate infrastructureBillingInstanceSize.
infrastructureCloudDerivedMemoryBytes Bytes of RAM available to the host, as reported by the cloud provider, used to calculate infrastructureBillingInstanceSize.
infrastructureCloudDerivedProcessorCount Number of logical CPU cores available to the host, as reported by the cloud provider, used to calculate infrastructureBillingInstanceSize.
infrastructureBillingInstanceSize Size of the host, for CU billing purposes. Calculated as: number of processors multiplied by memory in GiB.
infrastructureHoursUsed Number of hours for which usage was recorded for the given host. When a host is connected to New Relic for any amount of time within a given hour, that hour is counted toward usage.
infrastructureComputeUnits Number of compute units (CUs) recorded for the given host. CUs are calculated as: infrastructureHoursUsed multiplied by infrastructureBillingInstanceSize. For more about compute unit calculation, see CU pricing.
infrastructureComputeUnitRule

Describes the algorithm used to calculate the host size for CU usage. Values include:

  • agent_collected_calculated_data: Use the host size data collected by the agent from the OS environment.
  • cloud_provider_data: Use the host size data from the cloud provider.
  • missing_data: Some host size data was missing. This could be due to an agent and operating system combination for which CPU and memory sizes are not supported. This will result in the default host size (16) being applied.
instanceSizeCapped This is True if the calculated host size was greater than 16 and therefore capped.
missingCpuData True if the Infrastructure agent reports no CPU count.
missingRamData True if the Infrastructure agent reports no memory count.
productLine The New Relic product the usage data is from. Always use the value Infrastructure when querying for Infrastructure usage data.
usageType

The type of entity this event records values for. This value is Host for Infrastructure.

Query examples

Here are some examples of NRQL queries you can use with your Infrastructure subscription usage data. You can run NRQL queries with the Insights query tool, use the resulting charts in Insights dashboards, and use the NRQL with the Insights query API.

For general information about how to use NRQL queries to get focused usage data, see Intro to usage data.

Compute units for last month

This query produces a count of the CUs used over the last month:

SELECT sum(infrastructureComputeUnits) 
FROM NrDailyUsage 
WHERE productLine='Infrastructure' 
AND usageType='Host' 
SINCE last month 
UNTIL this month
Detailed host report (reproducing old usage report)

This query reproduces as closely as possible the report you would have gotten by downloading the CSV from the previously available Infrastructure subscription usage UI:

FROM NrDailyUsage 
SELECT consumingAccountId 
AS 'Account ID',agentHostname,cloudProvider 
AS 'Host provider', cloudInstanceType 
AS 'Instance type',infrastructureBillingInstanceSize 
AS 'Instance size',infrastructureHoursUsed 
AS 'Hours used',infrastructureComputeUnits 
AS 'Usage (CU)', infrastructureCloudDerivedMemoryBytes/(1024*1024*1024) 
AS 'Total RAM',infrastructureCloudDerivedProcessorCount 
AS 'Logical processors',infrastructureAgentMemoryBytes/(1024*1024*1024) 
AS 'Total RAM',infrastructureAgentProcessorCount 
AS 'Logical processors',infrastructureComputeUnitRule 
AS 'Business rule',missingCpuData, missingRamData, instanceSizeCapped,cloudZone,cloudInstanceId 
WHERE productLine='Infrastructure' 
AND usageType='Host' 
SINCE 1 day ago 
LIMIT 1000

This NRQL query is different than the legacy usage report:

Detailed host query Comments
Time period

This query includes only the last day of usage. To see the usage aggregated over a longer time period, change the SINCE clause.

Results limited to 1000

NRQL limits the results to 1000. If you have more than 1000 hosts and want to get the complete set of hosts, you can narrow your query with more WHERE clauses to return subsets of the data (for example, WHERE agentHostname LIKE ... to divide the data into groups).

Business rule

Business rule has been replaced with two attributes:

  • infrastructureComputeUnitRule defines how the size of the host was calculated, depending on what data was available from the agent. It no longer describes whether the agent needs to be updated to provide more accurate host naming in a container environment (update_agent_for_container_environment).
  • missingCpuData, missingRamData, and instanceSizeCapped are now boolean flags describing what the value missing_data means when it is present in the infrastructureComputeUnitRule attribute.
Account hierarchy

This query is useful for seeing the account hierarchy (partnership, master, sub-accounts).

SELECT count(*) 
FROM NrDailyUsage 
FACET partnershipName,masterAccountName,masterAccountId,consumingAccountName,consumingAccountId 
LIMIT 1000 
SINCE 1 day ago

For more help

Recommendations for learning more: