GithubHelp home page GithubHelp logo

rlugojr / nodejs-dashboard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from formidablelabs/nodejs-dashboard

0.0 2.0 0.0 120 KB

Telemetry dashboard for node.js apps from the terminal!

License: MIT License

JavaScript 100.00%

nodejs-dashboard's Introduction

nodejs-dashboard

Telemetry dashboard for node.js apps from the terminal!

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

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

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 with layouts
  -p, --port [port]           Socket listener port
  -r, --refreshinterval [ms]  Metrics refresh interval, default 1000ms
  -s, --scrollback [count]    Maximum scroll history for log windows
  -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 below). 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).

--scrollback

Specifies the maximum number of lines that log windows (e.g. stdout, stderr) will buffer in order to scroll backwards and see the history. The default is 1000 lines.

Customizing layouts

See lib/default-layout-config.js and test/app/layouts.js for examples.

A layouts config file should export an array of layouts:

  • Each layout is an array of panels
  • A panel is a object representing a vertical section of the screen (i.e. a column). Its properties are:
    • position: optional, see below
    • views: array of views
  • A view is an object identifying one of the existing ___View classes to be displayed. Its properties are:
    • name: one of stdout, stderr, stdouterr, cpu, memory, eventloop
    • position: optional, see below
    • limit: line graph views accept this option indicating how many data points to display

position defines the item's height (for views) or width (for panels). It can have one of:

  • size: fixed value (rows/cols)
  • grow: proportional to the container

position is optional - it defaults to { grow: 1 } if not specified

For example, if a panel has 3 views with these positions:

  • A: size 15
  • B: grow 1
  • C: grow 3

A will have a height of 15. B and C will split the remaining area proportionally (B gets 25%, C gets 75%).

nodejs-dashboard's People

Contributors

aisapatino avatar alexkuz avatar bbohen avatar dangkhue27 avatar jasonwilson avatar steveslayden avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.