• /
  • Log in

Collect custom metrics (APM, browser, mobile)

APM agents, browser agents, and mobile agents report a type of metric data called metric timeslice data. These agents allow you to report custom metric timeslice data from your application and see it alongside default New Relic data. Create custom metrics to record arbitrary performance data via an API call, such as:

  • Timing data
  • Computer resource data
  • Subscription or purchasing data

After reporting this data, you can explore and query it.

Name custom metrics

Start all custom metric names with Custom/; for example, Custom/MyMetric/My_label. The Custom/ prefix is required for all custom metrics.

Any custom metric names that do not start with Custom/ are subject to all other grouping rules. They may not be visible when querying, or they may not appear as expected in the UI.

custom-metric-syntax.png

A custom metric name consists of the prefix Custom/, the category or class name, and a method or label, each separated with a slash.

Implement custom metrics

Implementing custom metrics requires API calls. The exact details of the API call vary by agent.

Tip

If you are testing your custom metric implementation, run the agent for at least 10 minutes to ensure that the API call is reported to New Relic.

New Relic agent

Implementation

APM agents

New Relic mobile agents

New Relic browser agent

Browser does not support custom metrics. For options on adding custom data to browser, see browser instrumentation.

Avoid grouping issues

Collecting too many metric timeslices can impact the performance of both your application and New Relic. For example, if you have thousands of individual users, avoid creating metrics to track the performance of their unique user IDs. This could result in such a large number of metrics that it becomes nearly impossible to navigate or make sense of the data. Instead, use a placeholder, such as an asterisk (*), instead of individual user IDs.

Important

To avoid potential data problems, try to keep the total number of unique metric timeslices introduced by custom metrics under 2000.

When the total number of unique metric names exceeds 2000, limits begin to apply automatically that affect how data appears in the user interface, such as in charts and tables. For more information, see Metric grouping issues.

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.