A newrelic custom instrumentation for Lisk Core
$ npm install --save newrelic
$ npm install --save https://github.com/LiskHQ/lisk-newrelic.git
You have to create your own copy of newrelic configuration. NewRelicLisk just instrument using available newrelic object.
const newrelic = require('newrelic');
const newrelicLisk = require('lisk-newrelic')(newrelic, {
exitOnFailure: true,
rootPath: process.cwd(),
});
newrelicLisk.instrumentWeb();
newrelicLisk.instrumentDatabase();
newrelicLisk.instrumentBackgroundJobs();
Following options can be passed to create the lisk instrumentation object.
Option | Type | Required | Description |
---|---|---|---|
exitOnFailure | Boolean | Yes | Exit the main process if any error occurred during instrument initialization. |
rootPath | String | Yes | Absolute path of the lisk core directory |
Method | Description |
---|---|
instrumentWeb | Instrument web requests to show the request path exactly defined in swagger by Lisk Core. |
instrumentDatabase | Instrument some functions of pg-promise to get good insight of database transactions. |
instrumentBackgroundJobs | Instrument every job in the jobQueue in Lisk Core |
instrumentCallbackMethods | Instrument methods of modules which have defined callback. |
If you have a module to instrument, with following details:
- A module named
node
- It is
require
in the app with exactly the path./modules/node.js
- And you want to instrument two methods
internal.getForgingStatus
andshared.getConstants
You can instrument this:
newrelicLisk.instrumentCallbackMethods(
'./modules/node.js',
'modules.node',
['internal.getForgingStatus', 'shared.getConstants']
)
https://github.com/LiskHQ/lisk-newrelic/graphs/contributors
Copyright © 2017 Lisk Foundation
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the [GNU General Public License][license] along with this program. If not, see http://www.gnu.org/licenses/.