• English日本語한국어
  • Log inStart now

Collect custom attributes

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.

Important

Custom attributes count toward GB Ingested and are billable data.

Requirements

Custom attributes are available for these New Relic solutions:

  • APM
  • Browser monitoring
  • Mobile monitoring
  • Infrastructure monitoring
  • Synthetic monitors

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 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 Transaction and TransactionError events, you could then create a NRQL query using that attribute, like:

SELECT count(*) FROM TransactionError
WHERE userId = '1401961100' FACET dateOf(timestamp), `error.message`
SINCE 1 week ago

APM: Record custom attributes

Important

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 agent:

Browser monitoring: Record custom attributes

The browser agent provides an API to specify extra details associated with a page view or browser interaction, either by forwarding attributes from APM to browser monitoring or by specifying custom attributes through JavaScript. Values forwarded from the APM agent are encoded and injected into browser attributes by our browser agent.

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 filter your entities, group your results, and annotate your data.

Mobile monitoring: Record custom attributes

Mobile agents include API calls to record custom attributes:

Synthetic monitors: Record custom attributes

See Synthetic monitor custom attributes.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.