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 count toward GB Ingested and are billable data.
Custom attributes are available for these New Relic solutions:
We'll go into more detail on these options below.
Recommendations for creating and using custom attributes
At New Relic, attributes are key-value pairs that provide metadata about the events they're attached to.
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 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 Transaction and TransactionError events, you could then create a NRQL query using that attribute, like:
WHERE userId ='1401961100' FACET dateOf(timestamp),`error.message`
Define an XML instrumentation file using the New Relic UI. This may require additional config in the common: block of your newrelic.yml. See Report custom attributes under Instrumentation options for more detail.
Call the agent's API
Example 1: Adding custom attributes to transactions
To collect custom attributes using the agent's API, call the relevant methods:
For each method you want to record an attribute for, call NewRelic.addCustomParameter(...).
Infrastructure monitoring: Record custom attributes
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 monitoring: Record custom attributes
Mobile agents include API calls to record custom attributes: