---
title: Node.js custom metrics
source: https://docs.newrelic.com/docs/apm/agents/nodejs-agent/extend-your-instrumentation/nodejs-custom-metrics
---

Record arbitrary performance data via an API call, for example, timing or computer resource data. Use [metrics and events](https://docs.newrelic.com/docs/query-your-data/explore-query-data/data-explorer/introduction-data-explorer) to search your custom metrics, create customizable charts, and add those charts to New Relic dashboards. Using custom metrics unifies your monitoring inside New Relic.

> #### ⚠️ CAUTION
>
> Collecting too many metrics can impact the performance of your application and your New Relic agent. To avoid data problems, keep the total number of unique custom metrics under 2000.

## Name your metrics [#metric_names]

Metric names are paths delimited by the `/` character. For custom metrics use this pattern:

```
<category>/<class>/<method>
```

For custom metric names, use `<class>/<method>` or `<category>/<name>`. For example, use `MyCategory/My_method`).

> #### ⚠️ IMPORTANT
>
> For versions prior to Node.js agent v5, you need to prepend your metrics with `Custom/`. The agent will not automatically prepend custom metrics with this to prevent collision with internal metrics.

## Record custom metrics [#recording-custom-metrics]

The public API for recording metric data consists of two methods on `newrelic`:

-   [`recordMetric`](https://newrelic.github.io/node-newrelic/API.html#recordMetric): Use to create a new custom metric.
-   [`incrementMetric`](https://newrelic.github.io/node-newrelic/API.html#incrementMetric): Use to update the value of a custom metric.

For more information, see the [example application](https://github.com/newrelic/newrelic-node-examples/tree/69d500e02077d2565c4762c21bf779e3e39845bf/custom-instrumentation/attributes-events-metrics) on GitHub.
