With custom metrics, you can report metric timeslice data from your application code and see it alongside default metrics and data in New Relic. Create custom metrics to record arbitrary performance data via an API call, such as:
- Timing data
- Computer resource data
- Subscription or purchasing data
Then, use the New Relic Insights metric explorer to search your custom metrics and create customized dashboards for them.
Name custom metrics
Start all custom metric names with
Custom/; for example,
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 in Insights, or they may not appear as expected in the New Relic UI.
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.
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|
|New Relic Mobile SDKs|
|New Relic Browser||
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.
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.