npm.io
1.2.9 • Published 3 years ago

newrelic-decorators

Licence
ISC
Version
1.2.9
Deps
2
Size
23 kB
Vulns
0
Weekly
0
Stars
2

NewRelic Decorators

Installation:

  1. install New Relic Agent:

    https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/install-nodejs-agent/

  2. npm i newrelic-decorators

Usage:

NewRelicTransaction

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...");
}
NewRelicRecordMetric

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...");
}
NewRelicIncrementMetric

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...");
}
NewRelicEvent

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...");
}

Keywords