NewRelic instrumentation of Lisk Core
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
docs Initial commit for repo bootstrapping Sep 14, 2018
src Update the job queue to fix the category and name Sep 21, 2018
test Initial commit for repo bootstrapping Sep 14, 2018
.babelrc Initial commit for repo bootstrapping Sep 14, 2018
.editorconfig Initial commit for repo bootstrapping Sep 14, 2018
.eslintignore Initial commit for repo bootstrapping Sep 14, 2018
.eslintrc.json Initial commit for repo bootstrapping Sep 14, 2018
.gitignore Initial commit for repo bootstrapping Sep 14, 2018
.lintstagedrc.json Initial commit for repo bootstrapping Sep 14, 2018
.npmignore Initial commit for repo bootstrapping Sep 14, 2018
.npmrc Initial commit for repo bootstrapping Sep 14, 2018
.nvmrc Initial commit for repo bootstrapping Sep 14, 2018
.nycrc Initial commit for repo bootstrapping Sep 14, 2018
.prettierignore Initial commit for repo bootstrapping Sep 14, 2018
.prettierrc.json Initial commit for repo bootstrapping Sep 14, 2018
.snyk Add snyk configuration to test package in post installation Sep 17, 2018
Jenkinsfile Initial commit for repo bootstrapping Sep 14, 2018
Jenkinsfile.nightly Initial commit for repo bootstrapping Sep 14, 2018
Jenkinsfile.private Initial commit for repo bootstrapping Sep 14, 2018
LICENSE Initial commit for repo bootstrapping Sep 14, 2018
README.md Update readme with more details and api Sep 19, 2018
package-lock.json Expose interface of all instrumentation Sep 17, 2018
package.json Remove snyk test from postintall Sep 17, 2018

README.md

lisk-newrelic

License: GPL v3 Dependency Status devDependency Status

A newrelic custom instrumentation for Lisk Core

Installation

$ npm install --save newrelic
$ npm install --save https://github.com/LiskHQ/lisk-newrelic.git

Usage

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();

Options

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

API

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.

Instrumenting a module

If you have a module to instrument, with following details:

  1. A module named node
  2. It is require in the app with exactly the path ./modules/node.js
  3. And you want to instrument two methods internal.getForgingStatus and shared.getConstants You can instrument this:
newrelicLisk.instrumentCallbackMethods(
	'./modules/node.js',
	'modules.node',
	['internal.getForgingStatus', 'shared.getConstants']
)

Contributors

https://github.com/LiskHQ/lisk-newrelic/graphs/contributors

License

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/.