@hstech/memviz

1.7.0 • Public • Published

@hstech/memviz

Tool for the visualization of the Node.js memory usage in an application.

NPM Version

memviz demo

Install

npm i -S @hstech/memviz

Usage

Just add this code to your index.js

const memViz = require("@hstech/memviz");

memViz({ port: 10101 });

Options

All options are optional

PS: for S3 snapshot upload please provide these environment variables

AWS_CREDENTIALS_ACCESSKEY_ID // AWS access key associated with an IAM user or role
AWS_CREDENTIALS_SECRET_ACCESS_KEY // The secret key associated with the access key
{
  port: 10100,  // Port (default)
  interval: 300, // Refresh interval of data in milliseconds (default)
  duration: 120000, // Duration of the chart in milliseconds, how much time of data it will show. (default)
  application: 'Application' // Application name (default)

  s3: { // If s3.bucket is null, the heapsnapshot will be written to disc
    bucket: 'YOUR_BUCKET_NAME', // default is null
    folder: '/sub-folder' // default is '/'
  }
}

Interaction

You can zoom in/out the chart using the mouse wheel or via a pinch gesture, you can also move the chart left or right.

MultiView

Visit any of your Visualizer host with the path /memviz/multiview example http://localhost:10100/memviz/multiview.

Let's say you want to display 3 charts on the same view, for these hosts

  • http://localhost:10100/memviz/
  • http://localhost:10101/memviz/
  • http://localhost:10102/memviz/

and you want to display 2 in each row, then your url should look like this:

http://localhost:10100/memviz/multiview?perRow=2&hosts=http://localhost:10100/,http://localhost:10101/,http://localhost:10102/

Integration

Koa

To integrate memviz into Koa, all you have to do is to pass the Instance and the port to memviz

// Koa instance is in app variable

memViz({
  koa: app, // Koa instance
  port: 3000, // Koa instance port
  interval: 300,
  duration: 120000,
  application: "Application 1",
});

Then visit this path /memviz/ you should see the memory graph

License

MIT

Package Sidebar

Install

npm i @hstech/memviz

Weekly Downloads

0

Version

1.7.0

License

MIT

Unpacked Size

27.7 kB

Total Files

10

Last publish

Collaborators

  • roonie007