Query and alert on usage data

For accounts on our New Relic One pricing plan, we provide a UI for understanding your New Relic usage and managing your data. Additionally, you can:

Note that account hierarchy may affect queried data. See Account structure.

Data types

Usage data is attached to two events:

  • NrConsumption records usage every hour, and is the equivalent of "real-time" usage. Use this event to observe usage trends over time.
  • NrMTDConsumption generates aggregate values from the NrConsumption event. Use this event to see usage or estimated cost for a billing period.

Query examples

The usage UI displays your data usage and billable user count. But to get more detail, you can use these NRQL queries. For definitions of some of the attributes used in these queries, see Attributes.

Data usage queries

Here are some data usage query examples:

Daily data usage

This query totals your billable ingested data, and displays a daily value for the past three months:

FROM NrConsumption SELECT sum(GigabytesIngested) 
   WHERE productLine = 'DataPlatform' 
   SINCE 3 months ago TIMESERIES 1 day
Daily usage by source

This query totals your billable ingested data, and displays a daily value for the past three months faceted by the source:

FROM NrConsumption SELECT sum(GigabytesIngested) 
   WHERE productLine = 'DataPlatform' SINCE 3 months ago 
   FACET usageMetric TIMESERIES 1 day
Month-to-date data usage

This query shows the current full user count. In other words, it shows how much you'd be billed for your data for that month if you were billed right now.

FROM NrMTDConsumption SELECT latest(GigabytesIngested) 
   WHERE productLine = 'DataPlatform' SINCE this month
Month-to-date estimated data cost

This query shows the estimated cost of your ingested data:

FROM NrMTDConsumption SELECT latest(estimatedCost) 
   WHERE productLine = 'DataPlatform' SINCE this month

User count queries

Here are some user-related query examples. For details on how users are counted, see User count calculations.

Month-to-date full users

This query shows the billable full users for the month. In other words, it shows how much you'd be billed for your users for that month if you were billed right now.

FROM NrMTDConsumption SELECT latest(usersBillable) 
  SINCE this month

This query shows how many full users were counted by hour. This is useful for seeing how the full user count changed over time.

from NrConsumption SELECT max(FullUsers) 
  SINCE 10 days ago TIMESERIES 1 hour
Projected monthly full user count

This query shows a projected count of monthly users. This query would not be good for using in a dashboard; it requires values based on a) the days remaining in the month, b) the start of the month. Here's an example querying the projected end-of-month count with 10 days left in that month:

FROM NrMTDConsumption SELECT predictLinear(FullUsers, 10 days) 
SINCE '2020-09-01'
Count full users and basic users

The usage UI shows the count of full users and basic users. The query used is:

FROM NrUsage SELECT max(usage) SINCE 10 days ago
WHERE productLine='FullStackObservability' 
WHERE metric in ('FullUsers', 'BasicUsers') 
FACET metric

To see the count of full and basic users over time:

FROM NrUsage SELECT max(usage) SINCE 10 days ago
WHERE productLine='FullStackObservability' 
WHERE metric in ('FullUsers', 'BasicUsers') FACET metric TIMESERIES 1 hour

Set usage alerts

To help manage your billable data, you can set alerts to notify you of unexpected increases in usage. To learn about how to create alerts, see Alert workflow.

When creating alert conditions, we recommend 20 minutes for the alert window value and the evaluation offset value. This will ensure it won't alert on normal gaps between usage event generation.

Here are some NRQL alert condition examples. For attribute definitions, see Attributes.

Ingested gigabytes exceed a fixed value

This query will create an alert when your hourly usage exceeds a fixed value:

FROM NrConsumption SELECT sum(GigabytesIngested) 
   WHERE productLine = 'DataPlatform'       

If you have multiple sub-accounts, you may want to set threshold alerts for a specific subaccount:

FROM NrConsumption SELECT sum(GigabytesIngested) 
   WHERE productLine = 'DataPlatform' AND consumingAccountId = YOUR_SUB-ACCOUNT_ID
Usage exceeds fixed threshold for GBs

This query will create an alert when your usage exceeds fixed monthly threshold for GBs:

FROM NrMTDConsumption SELECT latest(GigabytesIngested) 
   WHERE productLine = 'DataPlatform'
Usage exceeds fixed threshold for users

This query will create an alert when your usage exceeds fixed monthly threshold for billable users:

FROM NrMTDConsumption SELECT latest(usersBillable)
Usage exceeds fixed threshold for estimated cost

This query will create an alert when your usage exceeds fixed threshold for estimated cost:

FROM NrMTDConsumption SELECT latest(estimatedCost) 
   WHERE productLine = 'DataPlatform' SINCE this month

General attributes

These attributes are attached to the NrMTDConsumption and NrConsumption events.

Attribute Description
productLine The category of usage. There are four options: DataPlatform, FullStackObservability, IncidentIntelligence, or ProactiveDetection. For more details about these categories, see New Relic platform.
metric Consolidates multiple categories of usage into a single metric. Helpful when faceting by productLine.
consumingAccountId ID of the New Relic account that is directly responsible for the stored events, as determined from the license key used.
estimatedCost Calculates a cost estimate based on usage and metric cost. This is an estimate of costs to date, not your monthly invoice.

For more help

If you need more help, check out these support and learning resources: