Skip to content
This repository has been archived by the owner on Nov 4, 2019. It is now read-only.
/ lisk-newrelic Public archive

📟 NewRelic instrumentation for Lisk Core

License

Notifications You must be signed in to change notification settings

LiskArchive/lisk-newrelic

Repository files navigation

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

About

📟 NewRelic instrumentation for Lisk Core

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published