-
install New Relic Agent:
-
npm i newrelic-decorators
Add decorator NewRelicTransaction for trigger transaction into New Relic dashboard. If transaction as param is not provided, the name of method will be used.
@NewRelicTransaction("/notification/test")
async someMethod(){
console.log("something...");
}
Add decorator NewRelicRecordMetric for trigger new record metric. Record metric is used to create a new custom metric.
@NewRelicRecordMetric("cart", "chargeAmount", 100)
async someMethod(){
console.log("something...");
}
Add decorator NewRelicIncrementMetric for trigger new increment metric. Increment metric is used to update the value of a custom metric.
@NewRelicIncrementMetric("page", "pageViews", 1)
async someMethod(){
console.log("something...");
}
Add decorator NewRelicEvent for trigger new event. The attributes must be an object of key and value pairs. The keys must be string, and the values must be string, number, or boolean.
@NewRelicEvent("customEvent", {"event": 1})
async someMethod(){
console.log("something...");
}