ins

instrument

Tool to collect information about Node.js native module calls

Showing:

Popularity

Downloads/wk

280

GitHub Stars

3

Maintenance

Last Commit

7mos ago

Contributors

0

Package

Dependencies

2

Size (min+gzip)

13.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Instrument

npm node-current GitHub license PRs Welcome Language grade: JavaScript

A tool that collects information about calls made to Node.js native modules.

Installation

To add it as a development dependency run:

npm i instrument --save-dev

Usage

Loading it programatically (using default configuration):

require('instrument')()

You can also include it by using the -r or --require flag in your command:

$ node -r instrument/config my-app.js

Configuration

instrument accepts a configuration object if it's being loaded programatically or you could create a instrument.config.js file in case you're including it via the --require flag.

Example of a instrument.config.js file:

module.exports = {
  summary: true,
  frequency: true,
  output: 'my-instrumentation-logs.txt'
}

Configuration properties

dependencies

Specifies if dependencies should be instrumented. Default value is false.

summary

Enable this property to print a summary of the instrumented calls that were captured. Default value is true.

structured

It changes the log output to be JSON formatted. Default value is false.

frequency

In case "summary" property is set to true, then also prints a frequency indicator for each call.

output

If you want to avoid printing the output to stdout you can specify a file to be used for logging.

modules

It accepts an array of the native modules you want to be instrumented. Default values are ["child_process","http","https","fs","require"].

runtimeLogs

Enables or disables the logging at runtime for instrumented calls. Default value is false.

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100