npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

progvis

v0.1.11

Published

Client library for ProgVis. Use it to instrument your cron and batch jobs. Track progress on progvis.io

Downloads

4

Readme

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.

| Param | Type | Default | Description | | --- | --- | --- | --- | | name | string | | A unique, stable name for this job | | [expected] | number | | Number of expected steps for this job | | [options] | object | | [options.collect_argv] | boolean | false | Enable collecting argv. :warning: Don't use if args contains sensitive information | | [options.token] | string | | API 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.