Skip to content

Commit

Permalink
Merge pull request newrelic#18825 from jeffchiudev/patch-7
Browse files Browse the repository at this point in the history
Add missing set user id API call for PHP
  • Loading branch information
rhetoric101 authored Oct 2, 2024
2 parents 840f304 + 8a92778 commit 2fc5eb8
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/content/docs/errors-inbox/error-users-impacted.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ You can review how New Relic processes custom attributes by reading our doc abou

The number of users impacted on an error group is recorded as a [Metric data type](/docs/data-apis/understand-data/metric-data/metric-data-type/) with the name `newrelic.error.group.userImpact`. You can use this metric with the following NRQL string:

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

The 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`.

Expand All @@ -48,17 +50,21 @@ Creating this alert requires determining the [NRQL query](/docs/query-your-data/

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

```sql
SELECT uniqueCount(newrelic.error.group.userImpact) FROM Metric WHERE metricName='newrelic.error.group.userImpact'
AND entity.guid='RXxCUk9XU9182nNEFQUExJQ0FLsU9OfDgzNzgwNw' FACET error.group.guid TIMESERIES
```
```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()`](/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/) function, [how to find the entity GUID](/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
```sql
SELECT count(newrelic.error.group.userImpact)
FROM Metric
WHERE metricName='newrelic.error.group.userImpact' SINCE 1 hour ago TIMESERIES
```

Once you have decided on a NRQL query, it can be used to create a [NRQL alert condition](/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions/#create).
Expand Down Expand Up @@ -129,6 +135,14 @@ You can use an agent method to identify an end user. See implementation details
[`setUserID(id)`](https://newrelic.github.io/node-newrelic/API.html#setUserID)
</td>
</tr>
<tr>
<td>
PHP
</td>
<td>
[`newrelic_set_user_id(string $user_id)`](https://docs.newrelic.com/docs/apm/agents/php-agent/php-agent-api/newrelic_set_user_id/)
</td>
</tr>
<tr>
<td>
Python
Expand Down

0 comments on commit 2fc5eb8

Please sign in to comment.