• Log in
  • Sign up

Add custom attributes to your New Relic data

There are countless filters and pivots you might want to apply to your data. By adding custom attributes to your data, you can see beyond your code and analyze your business in-depth.

A common pattern when using custom attributes is to capture user information, such as name, ID, email, and more. This allows you to 'link' your operational data with 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.

Create a custom attribute

Step 1 of 2

Use the open source Java APM agent's API to add a userid custom attribute to your APM-reported data, Transaction and TransactionError events.

NewRelic.addCustomParameter('userid', userId);
Step 2 of 2

After you add the userid custom attribute, run a NRQL query that uses it.

As the query shows, the userid attribute enables you to filter and facet your NRQL queries.

custom-attribute-query.png

-- Get a count of errors experienced by a single filtered userid faceted by date and error message
SELECT count(*) FROM TransactionError WHERE userid = '1401961100' FACET dateOf(timestamp), `error.message` SINCE 1 week ago
Edit this pageCreate an issue
Copyright © 2020 New Relic Inc.

This site uses cookies 🍪

We use cookies and other similar technologies ("Cookies") on our websites and services to enhance your experience and to provide you with relevant content. By using our websites and services you are agreeing to the use of cookies. You can read more here. If you consent to our cookies, please click Yes.