An EventEmitter useful for collecting hapi server ops information
Clone or download
Latest commit c0ec072 Dec 6, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Add cpu process information. Closes #7 Dec 5, 2017
test Add cpu process information. Closes #7 Dec 5, 2017
.gitignore Initial commit. Nov 18, 2015
.travis.yml Migrate to node 8 and async/await Dec 3, 2017
LICENSE Migrate to node 8 and async/await Dec 3, 2017
README.md Migrate to node 8 and async/await Dec 3, 2017
package.json version 2.0.0 Dec 6, 2017

README.md

oppsy

An EventEmitter useful for collecting hapi server ops information.

Build StatusCurrent Version

Lead Maintainer: Adam Bretz

Usage

const Oppsy = require('oppsy');
const Hapi = require('hapi');

const server = new Hapi.Server();
const oppsy = new Oppsy(server);
oppsy.on('ops', (data) => {
  console.log(data);
});

await server.start();

oppsy.start(1000);

This creates a new Oppsy object and starts collecting information every 1000 miliseconds

new Oppsy(server, [config])

Creates a new Oppsy object.

  • server - the hapi server to collect information about.
  • [config] - optional configuration object
    • httpAgents - the list of httpAgents to report socket information about. Can be a single http.Agent or an array of agents objects. Defaults to Http.globalAgent.
    • httpsAgents - the list of httpsAgents to report socket information about. Can be a single https.Agent or an array of agents. Defaults to Https.globalAgent.

The oppsy object is an EventEmitter so it exposes the same API(.on and .emit) as the Node EventEmitter object. After it is started, it emits an "ops" event after a set interval with the collected ops information as the event payload.

oppsy.start(interval)

Starts an Oppsy object collecting network and server information.

  • interval - number of milliseconds to wait between each data sampling.

oppsy.stop()

Stops an Oppsy objects collecting.