---
title: Query and alert on usage data
source: https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/usage-queries-alerts
---

To help you understand your [New Relic usage and billing](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/new-relic-one-pricing-billing), we provide a [usage UI](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/new-relic-one-pricing-billing#usage-ui) for understanding your billing-related usage. Also, you can run custom NRQL queries to get additional detail, and you can create alert notifications for when your usage has reached certain levels.

Keep the following in mind when using the usage UI or making consumption queries:

-   The results are approximate and don't correspond exactly to the values used to calculate your invoice amount.
-   Use these tools to find and track your areas of high usage.
-   Use queries to create alerts so you know if you're approaching a limit.

## Data ingest usage queries [#data-queries]

The [usage UI](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/new-relic-one-pricing-billing#usage-ui) displays your data ingest over time. If you need more detail than the UI provides, you can use a variety of NRQL queries. The examples below include the following data types:

-   `NrConsumption`: Use this to dive deep into the details of your usage hour-by-hour. It's less helpful as a proxy for your bill.
-   `NrMTDConsumption`: Use this to see an approximation of your monthly aggregated usage.

**Daily data usage**

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

````sql
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:

````sql
FROM NrConsumption SELECT sum(GigabytesIngested) 
WHERE productLine = 'DataPlatform' SINCE 3 months ago 
FACET usageMetric TIMESERIES 1 day
```

````

**Metrics ingest by source**

This query breaks down [Metric data](https://docs.newrelic.com/docs/telemetry-data-platform/understand-data/new-relic-data-types/#dimensional-metrics) by the top ten metric names. You could also facet by `appName` or `host` to adjust the analysis.

````sql
FROM Metric SELECT bytecountestimate()/10e8 AS 'GB Estimate' 
SINCE 24 hours ago
FACET metricName LIMIT 10 TIMESERIES 1 hour
```

For more about `bytecountestimate()`, see [Byte count estimate](#byte-count-estimate).

````

**Month-to-date data usage**

This query shows the current full platform ingested data. In other words, it shows how much you'd be billed for your data for that month if you were billed right now.
Usage fee information is calculated hourly and takes approximately 3 hours to generate.
If no values are displayed, please query data from 4 hours ago using "SINCE 4 hours ago."

````sql
FROM NrMTDConsumption SELECT latest(GigabytesIngested) 
WHERE productLine = 'DataPlatform'
```

````

**Month-to-date estimated data cost**

For how to determine an estimate of cost, see [Estimated cost queries](#estimated-cost).

## Compute usage queries [#compute-queries]

The [usage UI](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/new-relic-one-pricing-billing#usage-ui) displays your compute usage over time. If you need more detail than the UI provides, you can use a variety of NRQL queries. The examples below include the following data types:

-   `NrConsumption`: Use this to dive deep into the details of your usage hour-by-hour. It's less helpful as a proxy for your bill.
-   `NrMTDConsumption`: Use this to see an approximation of your monthly aggregated compute usage.

**Daily core compute usage**

This query totals your billable core compute usage, and displays a daily value for the past three months:

````sql
FROM NrConsumption SELECT sum(consumption) 
WHERE metric = 'CoreCCU'
SINCE 3 months ago TIMESERIES 1 day
```

````

**Daily advanced compute usage**

This query totals your billable advanced compute usage, and displays a daily value for the past three months:

````sql
FROM NrConsumption SELECT sum(consumption)
WHERE metric = 'AdvancedCCU'
SINCE 3 months ago TIMESERIES 1 day
```

````

**Daily core compute usage by capability**

This query totals your billable core compute usage, and displays a daily value for the past three months faceted by the capability:

````sql
FROM NrConsumption SELECT sum(consumption)
WHERE metric = 'CoreCCU' SINCE 3 months ago 
FACET dimension_productCapability TIMESERIES 1 day
```

````

**Daily advanced compute usage by capability**

This query totals your billable advanced compute usage, and displays a daily value for the past three months faceted by the capability:

````sql
FROM NrConsumption SELECT sum(consumption)
WHERE metric = 'AdvancedCCU' SINCE 3 months ago
FACET dimension_productCapability TIMESERIES 1 day
```

````

**Month-to-date core compute usage**

This query shows the current full platform core compute usage. In other words, it shows how much you'd be billed for your data for that month if you were billed right now.
Usage fee information is calculated hourly and takes approximately 3 hours to generate.
If no values are displayed, please query data from 4 hours ago using "SINCE 4 hours ago."

````sql
FROM NrMTDConsumption select latest(consumption) where metric = 'CoreCCU' since 1 day ago
```

````

**Month-to-date advanced compute usage**

This query shows the current full platform advanced compute usage. In other words, it shows how much you'd be billed for your data for that month if you were billed right now.
Usage fee information is calculated hourly and takes approximately 3 hours to generate.
If no values are displayed, please query data from 4 hours ago using "SINCE 4 hours ago."

````sql
FROM NrMTDConsumption select latest(consumption) where metric = 'AdvancedCCU' since 1 day ago
```

````

## Data ingest and query limits [#data-limits]

For information about data ingest limits and query limits, see [New Relic data limits](https://docs.newrelic.com/docs/data-apis/manage-data/view-system-limits).

## User count queries [#user-queries]

For a display of your user count, see the [usage UI](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/new-relic-one-pricing-billing#usage-ui). If you need more detail than that, you can use the example NRQL queries below. For details about how users are calculated, see [Billable user calculations](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/user-count-billing).

Most New Relic organizations have the ability to add core users. This section includes queries that will work for those organizations. If you're in an older organization that hasn't [opted in to unlock core users](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/new-relic-one-pricing-billing#core-acceptance), see [Queries for organizations without core users](#queries-non-core).

Here are some rules for querying your users:

-   Use only the `NrMTDConsumption` event.
-   The attributes used for querying users are `CoreUsersBillable` and `FullPlatformUsersBillable`.

Here are some example NRQL queries for determining user count:

### Month-to-date full platform users

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

```sql
FROM NrMTDConsumption 
SELECT latest(FullPlatformUsersBillable) 
SINCE 3 hours ago 
```

### Month-to-date core users

This query shows the number of core users you'd be billed for if you were billed right now:

```sql
FROM NrMTDConsumption 
SELECT latest(CoreUsersBillable)
SINCE 3 hours ago 
```

### Estimated cost

Here's a query for getting the current month's cost for your full platform users. Note that you'll have to know your organization's full platform user cost.

```sql
FROM NrMTDConsumption 
SELECT latest(FullPlatformUsersBillable) * YOUR_PER_FULL_PLATFORM_USER_COST
SINCE 3 hours ago 
```

### User queries for organizations without core users [#queries-non-core]

These queries apply for some older New Relic organizations that have only two user types available: basic users and full platform users.

**User queries for organizations without core users**

For organizations that don't have core users enabled, here are some rules for querying your users:

-   You can use the `NrMTDConsumption` or `NrConsumption` event.
-   The attributes used to query by user type are: `BasicUsersBillable`, and `FullUsersBillable`.

    ### Billable full platform users for the month

    This query shows the billable full platform users for the month. In other words, it shows how much you'd be billed for your users for the current month if you were charged at that moment.

    ```sql
    FROM NrMTDConsumption 
    SELECT latest(FullUsersBillable)
    ```

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

    ```sql
    FROM NrConsumption 
    SELECT max(FullUsers) 
    SINCE 10 days ago TIMESERIES 1 hour
    ```

    ### Projected monthly full platform user count

    Here's an example of querying the projected end-of-month count of monthly full platform users with 10 days left in that month. Note that this query would not be good for using in a dashboard because it requires values based on the days remaining in the month and the start of the month.

    ```sql
    FROM NrMTDConsumption 
    SELECT predictLinear(FullUsers, 10 days)
    SINCE '2020-09-01'
    ```

    ### Count of full platform users and basic users

    The [How New Relic pricing works](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-users/pricing-billing#billing-usage-ui) shows the count of full platform users and basic users. The query used is:

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

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

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

    ### Estimated cost

    Here's a query for getting the current month's cost for your full platform users. Note that you'll have to know your organization's full platform user cost.

    ```sql
    FROM NrMTDConsumption 
    SELECT latest(FullPlatformUsersBillable) * YOUR_PER_FULL_PLATFORM_USER_COST
    SINCE 3 hours ago 
    ```

    Here's an equivalent one for your core users:

    ```sql
    FROM NrMTDConsumption 
    SELECT latest(CoreUsersBillable) * YOUR_PER_CORE_USER_COST
    SINCE 3 hours ago 
    ```

## Synthetics usage [#synthetics-usage]

There are a certain number of synthetics checks included for free with each edition. For details on that, see [Synthetics limits](https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/using-monitors/monitor-limits).

The [NrMTDConsumption event](/attribute-dictionary/?event=NrMTDConsumption) powers the usage UI and should be used for [usage alerting](#alerts).

The [NrDailyUsage event](/attribute-dictionary/?event=NrDailyUsage) can help you further break down synthetics usage, but results may not match the usage UI and [NrMTDConsumption event](/attribute-dictionary/?event=NrMTDConsumption). It's generated once per day. Usage timestamps correspond to the time that New Relic receives and processes a synthetic check. This may introduce a slight difference in usage data compared to the time the synthetic check was executed.

By using [`FACET`](https://docs.newrelic.com/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#sel-facet) with the [NrDailyUsage event](/attribute-dictionary/?event=NrDailyUsage), you can break your consumption into multiple categories, including account, location, monitor type, and monitor name. If you have a [parent account structure](https://docs.newrelic.com/docs/accounts/original-accounts-billing/original-users-roles/parent-child-account-structure/), ensure you run queries in a parent account to see the aggregated usage for that parent and its child accounts.

Both successful and failed checks contribute to overall synthetics consumption. Below are sample queries to view and facet your synthetics consumption, using both event types as appropriate:

**Total synthetics consumption this month**

````sql
SELECT latest(freeConsumption) AS 'Included checks', latest(billableConsumption) AS 'Extra checks'
FROM NrMTDConsumption
WHERE metric='SyntheticChecks'
SINCE this month
```

````

**Synthetics consumption by month**

````sql
SELECT latest(freeConsumption) AS 'Included checks', latest(billableConsumption) AS 'Extra checks'
FROM NrMTDConsumption
WHERE metric='SyntheticChecks'
SINCE 6 months ago 
FACET monthOf(timestamp)
```

````

**Synthetics consumption by account**

````sql
SELECT (sum(syntheticsFailedCheckCount) + sum(syntheticsSuccessCheckCount)) 
AS 'Total Checks' 
FROM NrDailyUsage 
WHERE syntheticsTypeLabel != 'Ping' 
SINCE 1 month ago 
FACET consumingAccountName
```

````

**Synthetics consumption by monitor type**

````sql
SELECT (sum(syntheticsFailedCheckCount) + sum(syntheticsSuccessCheckCount)) 
AS 'Total Checks' 
FROM NrDailyUsage 
WHERE syntheticsTypeLabel != 'Ping' 
SINCE 1 month ago 
FACET syntheticsTypeLabel
```

````

**Synthetics consumption by monitor name**

````sql
SELECT (sum(syntheticsFailedCheckCount) + sum(syntheticsSuccessCheckCount)) 
AS 'Total Checks' 
FROM NrDailyUsage 
WHERE syntheticsTypeLabel != 'Ping' 
SINCE 1 month ago 
FACET syntheticsMonitorName
```

````

**Synthetics consumption by location**

````sql
SELECT (sum(syntheticsFailedCheckCount) + sum(syntheticsSuccessCheckCount)) 
AS 'Total Checks' 
FROM NrDailyUsage 
WHERE syntheticsTypeLabel != 'Ping' 
SINCE 1 month ago 
FACET syntheticsLocationLabel
```

````

## Cost-related queries [#estimated-cost]

Here are some query recommendations for helping you understand the estimated cost for the current month.

**Get estimated cost of data for the month**

Here's a query for arriving at an estimate of your data ingest cost for the current month. To run this query, you'll need to know your organization's [per-GB ingested data cost](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/data-ingest-billing#data-prices).

````sql
FROM NrMTDConsumption 
SELECT latest(GigabytesIngestedBillable) * YOUR_PER_GB_COST
```

Here's an example of this query using a [per-GB cost of $0.40](/docs/accounts/accounts-billing/new-relic-one-pricing-billing/data-ingest-billing/#data-prices):

```sql
FROM NrMTDConsumption 
SELECT latest(GigabytesIngestedBillable) * .40
```

````

**Get billable user cost for the month**

See the billable user query sections:

-   [For organizations with core users](#user-queries)
-   [For organizations without core users](#non-core-org-user-queries)

## Set usage alerts [#alerts]

To help [manage your billing](https://docs.newrelic.com/docs/telemetry-data-platform/get-data-new-relic/manage-data/manage-your-data), you can set alerts to notify you of unexpected increases in data ingest or user count.

Before building usage-related alert conditions, here are some tips:

-   For basics about how to set up alerts, see [NRQL alert conditions](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/#create).
-   The [event timer aggregation method](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/get-started/choose-your-aggregation-method/#event-timer-detail) is recommended because it works best for infrequent data.

Here are some NRQL alert condition examples.

**Ingested gigabytes exceeds threshold**

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

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

If your organization has multiple [child accounts](/docs/accounts/install-new-relic/account-setup/manage-apps-or-users-sub-accounts), you may want to set threshold alerts for a specific account:

```sql
FROM NrConsumption 
SELECT sum(GigabytesIngested) 
WHERE productLine = 'DataPlatform' 
AND consumingAccountId = YOUR_CHILD_ACCOUNT_ID
```

````

**Usage exceeds GB threshold**

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

````sql
FROM NrMTDConsumption 
SELECT latest(GigabytesIngested) 
WHERE productLine = 'DataPlatform'
```

````

**Usage exceeds user count threshold**

This is an example for an alert query that will trigger when your user count of full platform users exceeds a certain number:

````sql
FROM NrMTDConsumption 
SELECT latest(FullPlatformUsersBillable)
```

Note that this query applies for organizations with the primary version of our usage-based pricing, with core users. For more about this and about how to query user counts, see [Query users](#user-queries).

````

**Usage exceeds estimated cost threshold**

In May of 2022, the `estimatedCost` attribute was deprecated ([learn more](https://docs.newrelic.com/docs/release-notes/org-user-mgmt-release-notes/org-users-22-05-01)). If you're using that attribute, you should replace it with the query recommended here.

Note that to run this query you'll need to know your organization's per-GB ingested data cost.

````sql
FROM NrMTDConsumption 
SELECT latest(GigabytesIngestedBillable) * YOUR_PER_GB_COST
```

````

For setting up alerts related to data ingest limits and query limits, see [Set alerts for hitting data limits](https://docs.newrelic.com/docs/data-apis/manage-data/query-limits#set-alerts-on-resource-metrics).

## Query changes to your account [#account-changes]

To see changes made to your account (for example, changes related to managing users), you can query [`NrAuditEvent`](https://docs.newrelic.com/docs/insights/insights-data-sources/default-data/nrauditevent-event-data-query-examples).

## Usage-related events and attributes [#data-types]

> #### 💡 TIP
>
> For an advanced deep dive into managing data ingest in a complex organization, see [Data ingest governance](https://docs.newrelic.com/docs/new-relic-solutions/observability-maturity/operational-efficiency/dg-intro/).

These are the primary events to query for understanding your usage:

-   `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 by monthly billing period. This is the best event for querying user count.

Here are some of the most important attributes attached to usage-related events.

| Attribute            | Description                                                                                                                                                                                                                                                                                                  |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `productLine`        | The category of usage. There are three options: `DataPlatform`, `FullStackObservability`, and `ProactiveDetection`. (Starting November 1, 2021, `IncidentIntelligence` is no longer a billing factor.) For more details about these categories, see [New Relic platform](https://newrelic.com/platform).     |
| `metric`             | This consolidates multiple categories of usage into a single metric. Helpful when faceting by `productLine`. It's an enum with possible values of `BasicUsers`, `FullPlatformUsers`, and `GigabytesIngested`. Values for the [core user release](#user-queries) include `FullPlatformUsers` and `CoreUsers`. |
| `consumingAccountId` | ID of the New Relic account directly responsible for the stored events, as determined from the license key used.                                                                                                                                                                                             |

## Byte count estimate [#byte-count-estimate]

One tool you can use to learn more about your usage is the function `bytecountestimate()` (for example, see [this query that uses it](#metrics-analysis)).

Some important points to know about using `bytecountestimate()`:

-   Because it returns all data it finds, and some of that data doesn't count towards your ingest and billing, it's only an estimate of your actual usage. For that reason, it's mostly useful for researching the data reported by various sources, or for understanding the upper ceiling of data reported.
-   We recommend using it mainly for querying time ranges under 24 hours, and, if desired, using that to extrapolate. This is because it's a function that requires querying a lot of data, and because it won't find data that passes retention boundaries.

For more about estimating usage, see [our blog post about estimating usage](https://newrelic.com/blog/nerdlog/estimate-data-cost).

Here are some technical details about how `bytecountestimate()` works:

-   There are several types of data that [don't count towards ingest](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/data-ingest-billing/#usage-calculation) but that is returned by the `bytecountestimate()` function. This means that this function sometimes shows **more** data than actually is counted towards your usage. It may rarely show a lower amount but, if it does, it will be only slightly lower.
-   Some telemetry data reported from an entity shares common attributes (for example, attributes about your New Relic account). We don't count the duplicated attributes towards your ingest, but `bytecountestimate()` does count those attributes. This can sometimes result in a large discrepancy between a `bytecountestimate()` query and your actual usage.
-   Our APM, browser monitoring, and mobile monitoring report a type of data known as [metric timeslice data](https://docs.newrelic.com/docs/data-apis/understand-data/new-relic-data-types/#timeslice-data). This data isn't stored in NRDB like our other data types are, and so trying to use `bytecountestimate()` on this data can result in confusing results. When querying this data, we recommend faceting by application name, and not by the metric name.
