0.1.11 • Published 3 years ago

progvis v0.1.11

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

ProgVis Node Client

This is the Node client library for ProgVis.

ProgVis is a simple to use tool for instrumenting periodic and long running batch jobs so you can easily track their progress and state.

Table of Contents

Screenshot

ProgVis Web UI lets you track current and past jobs, view logs, etc.

Here is a sample screen grab:

Sample Progress Bars

Features

ProgVis lets you...

  • Track your cron and batch jobs as they run to completion.
  • Keep records of each run - when they ran, for how long & exit status.
  • Search/view logs to help with troubleshooting.
  • Compare to historical stats to spot performance issues.

Installation

Install ProgVis Node Client using npm or yarn.

$ npm install progvis

Then visit ProgVis, register and get a client access token.

Set your client access token as PV_TOKEN environement variable or pass it in as options.token to the ProgVis constructor.

Example Usage

:information_source: if you can't modify your program, you can use ProgVis CLI to track your jobs.

ProgVis API is similar to cli progress tracking libraries. Instead of logging to terminal, it uploads progress data to progvis.io where you can access it.

import ProgVis from "progvis";

async function main() {
  const things = await getThingsToProcess();

  // opts = { token: <ACCESS_TOKEN> }
  const pv = new ProgVis("job_name", things.length, opts);

  while (things.length) {
    const thing = things.shift();
    const result = await process(thing);
    pv.step(1);                // indicate you made some progress
    pv.log({ thing, result }); // optionally log some stuff
  })

  pv.done(); // success OR pv.error(); for failure
}

main();
...

API

new ProgVis(name, expected, options)

Construct a new ProgVis instance.

ParamTypeDefaultDescription
namestringA unique, stable name for this job
expectednumberNumber of expected steps for this job
optionsobject
options.collect_argvbooleanfalseEnable collecting argv. :warning: Don't use if args contains sensitive information
options.tokenstringAPI Access Token. Takes precedence over env.PV_TOKEN

.step(delta = 1)

Increment progress by specifed amount. Defaults to 1.

.log(data)

Make a log entry. 'data' has to be JSON serializable.

.done()

Indicate the job has completed successfully.

:warning: If .done() is not called for any reason, the job will be marked as 'zombie' and eventually as 'error'.

.error()

Indicate the job did not complete successfully.

Roadmap

  • Realtime updates using WebSockets
  • Alerts / Notifications on job anamolies
  • Capture system metrics (memory, cpu etc...)
  • Recover from client crashes (save a crashfile and upload on next invocation)
  • Different types of visualization

License

ProgVis Node Client is MIT Licensed.

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago