---
title: Error scope: Users, sessions, and devices impacted
source: https://docs.newrelic.com/docs/errors-inbox/error-impacted
---

New Relic agents automatically capture data about the scope of errors affecting your applications. When you organize by error group, you can see the impact through three key metrics:

-   **Users impacted**: The number of unique users affected by errors
-   **Sessions impacted**: The number of unique browser sessions affected (fallback for browser entities)
-   **Devices impacted**: The number of unique mobile devices affected (fallback for mobile entities)

When users impacted data isn't available, New Relic automatically displays the appropriate fallback metric based on your entity type. This helps you prioritize where to focus your debugging efforts by showing you the errors with the highest scope of impact.

![This is an image of the main errors inbox showing users, sessions, and devices impacted](https://docs.newrelic.com/images/errors-inbox_screenshot-full_users-impacted.webp "An image showing how to navigate impact metrics in errors inbox")

Go to **[one.newrelic.com](https://one.newrelic.com) > APM & Services > Errors (errors inbox) > Triage**: You can find impact metrics in the second column of the **Error groups** table, located beneath the **Error count** and **Error rate** time series.

## Fallback impact metrics [#fallback-metrics]

New Relic prioritizes showing the most relevant impact data for your specific application type. When **Users impacted** data isn't available, the system automatically falls back to entity-specific metrics:

-   **Browser entities**: Displays **Sessions impacted** - the number of unique browser sessions affected by errors
-   **Mobile entities**: Displays **Devices impacted** - the number of unique mobile devices affected by errors

These fallback metrics are automatically collected without requiring additional configuration, unlike Users impacted which may need custom attributes. This ensures you always have visibility into the scope of errors affecting your applications, regardless of your setup.

## Custom attributes to track users impacted  [#custom-attributes]

In some cases, an error event may not have attributes that identify the end user affected by that error event. You can manually add custom attributes so our agents capture user-identifying metadata at the time of ingest.

For cases where you need to add a custom attribute, we recommend reviewing [OpenTelemetry's attribute conventions](https://docs.newrelic.com/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/opentelemetry-introduction) because there are multiple common conventions for naming end user attributes.

For example, [OpenTelemetry standards](https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/span-general/#general-identity-attributes) uses the following attributes in order of priority:

-   `userId`
-   `user`

You can review how New Relic processes custom attributes by reading our doc about [collecting custom events](https://docs.newrelic.com/docs/data-apis/custom-data/custom-events/collect-custom-attributes/#enabling-custom).

## Query for impact metrics [#query]

Impact metrics for error groups are recorded as [Metric data types](https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/) with specific metric names:

**Users impacted**

You can query the number of users impacted using `newrelic.error.group.userImpact` as metric name in NRQL queries:

```sql
SELECT uniqueCount(newrelic.error.group.userImpact) 
FROM Metric 
WHERE metricName='newrelic.error.group.userImpact'
```

This NRQL query metric captures the approximate number of unique users in the time period selected. Additional attributes provided by the `userImpact` metric which can be used in a `FACET` clause are `error.group.guid`, `entity.guid`.

**Sessions impacted**

You can query the number of sessions impacted using `newrelic.error.group.sessionImpact` as metric name in NRQL queries:

```sql
SELECT uniqueCount(newrelic.error.group.sessionImpact) 
FROM Metric 
WHERE metricName='newrelic.error.group.sessionImpact'
```

**Devices impacted**

You can query the number of devices impacted using `newrelic.error.group.deviceUuidImpact` as metric name in NRQL queries:

```sql
SELECT uniqueCount(newrelic.error.group.deviceUuidImpact) 
FROM Metric 
WHERE metricName='newrelic.error.group.deviceUuidImpact'
```

## Alert on impact metrics [#alert]

By creating an [NRQL alert condition](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-alert-conditions/), developers can trigger alerts when the scope of errors exceeds a threshold. You can create alerts for any of the impact metrics:

-   **Users impacted**: Alert when user impact exceeds your threshold
-   **Sessions impacted**: Alert when browser session impact exceeds your threshold
-   **Devices impacted**: Alert when mobile device impact exceeds your threshold

Creating this alert requires determining the [NRQL query](https://docs.newrelic.com/docs/query-your-data/nrql-new-relic-query-language/get-started/introduction-nrql-new-relics-query-language/) which measures the amount of users impacted in a way which best captures your use case.

As an example, the following NRQL query measures the amount of unique users which have been impacted by an [error group](https://docs.newrelic.com/docs/errors-inbox/errors-inbox/#groups) coming from a specific entity:

**Alerts on users impacted**

```sql
SELECT uniqueCount(newrelic.error.group.userImpact) 
FROM Metric 
WHERE metricName='newrelic.error.group.userImpact' 
AND entity.guid='RXxCUk9XU9182nNEFQUExJQ0FLsU9OfDgzNzgwNw' FACET error.group.guid TIMESERIES
```

Read more about using the [`uniqueCount()`](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/) function, [how to find the entity GUID](https://docs.newrelic.com/docs/new-relic-solutions/new-relic-one/core-concepts/what-entity-new-relic/#find) for your entities.

Similarly, the following NRQL query measures the total number of users impacted by errors from all entities under the account in the last hour:

```sql
SELECT count(newrelic.error.group.userImpact) 
FROM Metric 
WHERE metricName='newrelic.error.group.userImpact' SINCE 1 hour ago TIMESERIES
```

**Alerts on sessions impacted**

For browser applications, you can create alerts based on sessions impacted:

```sql
SELECT uniqueCount(newrelic.error.group.sessionImpact) 
FROM Metric 
WHERE metricName='newrelic.error.group.sessionImpact' 
AND entity.guid='YOUR_BROWSER_ENTITY_GUID' FACET error.group.guid TIMESERIES
```

**Alerts on devices impacted**

For mobile applications, you can create alerts based on devices impacted:

```sql
SELECT uniqueCount(newrelic.error.group.deviceUuidImpact) 
FROM Metric 
WHERE metricName='newrelic.error.group.deviceUuidImpact' 
AND entity.guid='YOUR_MOBILE_ENTITY_GUID' FACET error.group.guid TIMESERIES
```

Once you have decided on a NRQL query, it can be used to create a [NRQL alert condition](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/#create).

To improve the signal to noise ratio of your triggered alerts see [alert creation tips](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/#condition-tips), [how alert thresholds are evaluated](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/#advanced-signal), and [alert condition examples](https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/#examples).

## Set users impacted with setUser method [#set-users]

You can use an agent method to identify an end user for the **Users impacted** metric. Sessions and devices impacted are automatically collected without additional configuration. See implementation details for each agent below:

| Agent   | Method to identify an end user                                                                                                                   |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Browser | [`newrelic.setUserId(value: string|null)`](https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setuserid/)                     |
| Go      | [`txn.SetUserID("example user ID")`](https://docs.newrelic.com/docs/apm/agents/go-agent/api-guides/guide-using-go-agent-api/#user-tracking)      |
| Java    | [`NewRelic.setUserId(String userId);`](https://docs.newrelic.com/docs/apm/agents/java-agent/attributes/java-agent-attributes/#user-attributes)   |
| Mobile  | [`setUserId`](https://docs.newrelic.com/docs/data-apis/custom-data/custom-events/report-mobile-monitoring-custom-events-attributes/#track-user)  |
| .NET    | [`SetUserId`](https://docs.newrelic.com/docs/apm/agents/net-agent/net-agent-api/itransaction/#setuserid)                                         |
| Node.js | [`setUserID(id)`](https://newrelic.github.io/node-newrelic/API.html#setUserID)                                                                   |
| PHP     | [`newrelic_set_user_id(string $user_id)`](https://docs.newrelic.com/docs/apm/agents/php-agent/php-agent-api/newrelic_set_user_id/)               |
| Python  | [`newrelic.agent.set_user_id(user_id)`](https://docs.newrelic.com/docs/apm/agents/python-agent/python-agent-api/setuserid-python-agent-api)      |
| Ruby    | [`NewRelic::Agent.set_user_id`](https://docs.newrelic.com/docs/apm/agents/ruby-agent/api-guides/sending-handled-errors-new-relic/#user-tracking) |
