Last active
November 16, 2021 06:11
-
-
Save rajeshkrishnakumar/732017a7b63139240dc0302c3ffc6aae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import newrelic from "newrelic"; // import the new relic package | |
/** | |
instead of | |
import newrelic from 'newrelic'; | |
use this if you get error newrelic.setTransactionName is not a function or _newrelic.default.setTransactionName is not a function | |
import newrelic from 'newrelic/index'; | |
**/ | |
const helloWorld = async (parent, args, context, info) => { | |
newrelic.setTransactionName(info.fieldName); | |
//Calling Nodejs agent api to set the transaction name | |
const helloWorldResponse = {}; | |
try { | |
const { name } = args.input; | |
helloWorldResponse = { | |
status: false, | |
message: `Hello World! ${name}`, | |
return helloWorldResponse; | |
} catch (error) { | |
console.log(error); | |
return handleError(error); | |
} | |
}; | |
export default helloWorld; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment