Node.js custom metrics

Record arbitrary performance data via an API call (for example: timing or computer resource data). Use the Insights metric explorer to search your custom metrics, create customizable charts, and add those charts to Insights dashboards. Using custom metrics unifies your monitoring inside New Relic.

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 are paths delimited by the / character. For custom metrics use this pattern:

<category>/<class>/<method>

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

Record custom metrics

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

Example custom metric

Here is an example that shows how you can use metrics to track currency flowing through a site:

app.post('/cart/checkout', function(req, res) {
  var total = computeCartTotal(req.user);
  newrelic.recordMetric('Custom/Cart/ChargeAmount', total);
  ...
});

View custom metrics

To view custom metrics, use Insights Metric Explorer to search metrics, create customizable charts, and add those charts to Insights dashboards.

For more help

Additional documentation resources include:

Join the discussion about Node.js monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.