Record arbitrary performance data via an API call (for example, timing or computer resource data). Use the 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.
注意
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 <class>/<method>
or <category>/<name>
. For example, use MyCategory/My_method
).
重要
For versions prior to Node 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
The public API for recording metric data consists of two methods on newrelic
:
recordMetric
: Use to create a new custom metric.incrementMetric
: Use to update the value of a custom metric.
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('Cart/ChargeAmount', total); ...});
View custom metrics
To view custom metrics, use the data explorer to search metrics, create customizable charts, and add those charts to New Relic dashboards.
その他のヘルプ
さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:
- Explorers Hubでは、コミュニティからのサポートを受けたり、ディスカッションに参加したりすることができます。
- 当社サイトで答えを見つけて、サポートポータルの使用方法を確認してください。
- Linux、Windows、およびmacOS向けトラブルシューティングツールであるNew Relic Diagnosticsを実行してください。
- New Relicの とandドキュメント をご確認ください。