Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

nodejs-dashboard

FormidableLabs2.4kMIT0.5.1

Telemetry dashboard for node.js apps from the terminal!

dashboard, telemetry, terminal, realtime, statistics

readme

nodejs-dashboard

Telemetry dashboard for node.js apps from the terminal!

Build Status

http://g.recordit.co/WlUvKhXqnp.gif

Determine in realtime what's happening inside your node process from the terminal. No need to instrument code to get the deets. Also splits stderr/stdout to help spot errors sooner.

Install Setup Usage Using with other programs CLI options Customizing layouts

NOTE: This module isn't designed for production use and should be limited to development environments.

Install

The preferred method is global install. npm install -g nodejs-dashboard

Local install works also; just use ./node_modules/.bin/nodejs-dashboard instead of nodejs-dashboard to execute.

Setup

The dashboard agent needs to be required by your app. There are two ways to do this:

Including via code

From within a dev.index.js script or other dev entry point simply require the nodejs-dashboard module.

// dev.index.js
require("nodejs-dashboard");
require("./index");

To launch: nodejs-dashboard node dev.index.js

Including via preload argument

This method utilizes Node's -r flag to introduce the nodejs-dashboard module. In this setup no code modifications are required. This is functionally equivalent to the above example.

To launch: nodejs-dashboard -- node -r nodejs-dashboard index.js

Fonts

nodejs-dashboard uses the Braille Unicode character set to show graphs via the node-drawille dependancy. Ensure your terminal program's font supports this character set.

Environment variables

nodejs-dashboard uses several environment variables to modify its behavior. These include some required values to prevent mangled output.

Variable Required Source Description
TERM required blessed Terminal value matching terminal program
LANG required blessed Matches encoding of terminal program to display font correctly
FORCE_COLOR optional chalk Used to force color output by the subprocess

Usage

Press ? to see a list of keybindings. Use arrow keys to change the layout.

You may want to add an npm script to to your package.json to launch your app using nodejs-dashboard using one of the options above. Example:

"scripts": {
  "dev": "nodejs-dashboard -- node -r nodejs-dashboard index.js"
}

Passing arguments

If your app requires additional arguments you'll need to use the -- flag to separate them from nodejs-dashboard options. For example:

nodejs-dashboard --port=8002 -- node -m=false --bar=true index.js

Launching your app with something other than node

Most CLI interfaces provide a mechanism for launching other tools. If you're looking to use something like nodemon or babel checkout the exec options provided by the CLI.

% nodemon --exec "nodejs-dashboard babel-node" src/index.js

Docker and Docker Compose support

nodejs-dashboard can run inside a container if that container has a TTY allocated to it. The Docker documentation shows how to run a container with an interactive terminal session. Additional the Docker Compose documentation indicates that docker-compose run defaults to allocating a TTY and docker-compose up defaults to not allocating one.

CLI options

Usage: nodejs-dashboard [options] -- [node] [script] [arguments]

Options:
  -h, --help                  output usage information
  -e, --eventdelay [ms]       Minimum threshold for event loop reporting, default 10ms
  -l, --layouts [file]        Path to file or npm module with layouts
  -p, --port [port]           Socket listener port
  -r, --refreshinterval [ms]  Metrics refresh interval, default 1000ms
  -s, --settings [settings]   Overrides layout settings for given view types           
  -V, --version               output the version number
--eventdelay

This tunes the minimum threshold for reporting event loop delays. The default value is 10ms. Any delay below this value will be reported at 0.

--layouts

Optionally supply a custom layout configuration (for details, see Customizing Layouts). Default: lib/default-layout-config.js

--port

Under the hood the dashboard utilizes SocketIO with a default port of 9838. If this conflicts with an existing service you can optionally change this value.

--refreshinterval

Specifies the interval in milliseconds that the metrics should be refreshed. The default is 1000 ms (1 second).

--settings

Overrides default or layout settings for views. Option value settings should have a format <view_type.setting.path>=<value>,.... For example --settings log.scrollback=100 will override scrollback setting for any view of log type (nested paths can be used if needed). For details about layouts, see Customizing Layouts).

changelog

Change log

v0.5.1 - 2019-11-22

  • Fixed: Support global installs of nodejs-dashboard. Add the node_modules directory from wherever nodejs-dashboard is installed to NODE_PATH to support node -r nodejs-dashboard required for full usage. #90
  • Internal: Use SIGINT for Ctrl-c. #93

v0.5.0 - 2019-11-21

  • Breaking: Update node engines to 8+
  • Internal: Upgrade all prod + dev dependencies
  • Internal: Update to es-next code from at least auto-fixes.

v0.4.3 - 2017-12-01

  • Fixed: Environment variable names on Linux #76
  • Added: Goto User-Defined Time Index #68
  • Added: Pause, Rewind and Fast Forward Graphs #67
  • Added: Longer history for graphs #64

v0.4.2 - 2017-12-01

  • Not Published: Bad release.

v0.4.1 - 2017-03-21

  • Added: Historical memory usage graph #63
  • Added: Support for log filtering - see README #62

v0.4.0 - 2017-02-18

  • Added: Support multiple customizable layouts #53, #59 - see README
  • Removed: -i, --interleave option - now available through layouts
  • Changed: Line graphs in default layout show 30s instead of 10s of data #59
  • Changed: Improve views positioning, rerender on screen resize #51
  • Fixed: Properly disable autoscroll if user has scrolled up #56
  • Internal: Add description and keywords to package.json #49
  • Internal: Test coverage #52, set up travis #54, add tests for views #57

v0.3.0 - 2016-12-20

  • Added: interleave mode for stdout/stderr #47

v0.2.1 - 2016-12-01

  • Fixed: Memory leak bug #45

v0.2.0 - 2016-11-03

  • Added: Support older versions of node (0.10+) by converting to es5 syntax #43, #44

v0.1.2 - 2016-10-20

  • Changed: Round cpu percentage to nearest decimal #35
  • Docs: Add examples to README #28, describe global install usage #37
  • Internal: Better tests #34

v0.1.1 - 2016-10-14

  • Changed: Limit node version in package.json #18
  • Docs: Update README #4, include exit keybindings #11

v0.1.0 - 2016-10-11

  • Docs: Update readme styling #1
  • Internal: Remove dependency on root-require, update repo url in package.json #2
  • Internal: Test scaffolding and basic reporter integration test #3