When it comes to reporting custom data not reported by default by New Relic solutions, two of the most popular solutions are custom attributes and custom events. This doc will go into more detail about why you'd use custom attributes.
For some New Relic solutions, one way to report custom data to New Relic is to use custom attributes. By adding custom attributes to your data, you can do more in-depth and customized analysis of your business. For example, for New Relic browser monitoring, you might create a custom attribute to track the user name associated with a slow or failing request.
Custom attributes are available for these New Relic solutions:
- Browser monitoring
- Mobile monitoring
- Infrastructure monitoring
- Synthetic monitors
We'll go into more detail on these options below.
A common pattern when creating custom attributes is to capture user information, such as name, ID, email, and more. This allows you to create an association between your operational data and your business data. For example, if you have the user information, you tie together your service desk and CRM data with the operational data in New Relic.
Other types of business context might include:
- Customer token
- Customer market segment
- Customer value classification
- Workflow control values not obvious in the URIStem
- User/product/account privilege context
Operational context might include:
- Which feature flags were used
- What datastore was accessed
- What cache was accessed
- What errors were detected and ignored (fault partitioning)
Once you add a custom attribute, you can query it in New Relic and create custom charts from that data. For example, if you used the Java agent API to add a
userId attribute to your
TransactionError events, you could then create a NRQL query using that attribute, like:
SELECT count(*) FROM TransactionErrorWHERE userId = '1401961100' FACET dateOf(timestamp), `error.message`SINCE 1 week ago
Review the list of reserved terms used by NRQL. Using reserved terms can cause issues.
To enable and use custom attributes for APM, follow the procedure for your APM agent:
Our Infrastructure monitoring lets you create custom attributes that are used to annotate the data from the infrastructure agent. You can use this metadata to build filter sets, group your results, and annotate your data.
Mobile agents include API calls to record custom attributes:
- For an overview of mobile monitoring custom data, see Insert custom events and attributes
- Android method:
- iOS method: