GithubHelp home page GithubHelp logo

good's Introduction

good Logo

hapi process monitoring

Build StatusCurrent Version

Lead Maintainer: Adam Bretz

good is a hapi plugin to monitor and report on a variety of hapi server events as well as ops information from the host machine. It listens for events emitted by hapi server instances and pushes standardized events to a collection of streams.

Example Usage

const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection();

const options = {
    ops: {
        interval: 1000
    },
    reporters: {
        console: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ log: '*', response: '*' }]
        }, {
            module: 'good-console'
        }, 'stdout'],
        file: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ ops: '*' }]
        }, {
            module: 'good-squeeze',
            name: 'SafeJson'
        }, {
            module: 'good-file',
            args: ['./test/fixtures/awesome_log']
        }],
        http: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{ error: '*' }]
        }, {
            module: 'good-http',
            args: ['http://prod.logs:3000', {
                wreck: headers: {
                    'x-api-key': 12345
                }
            }]
        }]
    }
};

server.register({
    register: require('good'),
    options: options
}, (err) => {

    if (err) {
        console.error(err);
    } else {
        server.start(() => {

            console.info('Server started at ' + server.info.uri);
        });
    }
});

This example does the following:

  1. Sets up the console reporter reporter listening for 'response' and 'log' events.
  2. Sets up the file reporter to listen for 'ops' events and log them to ./test/fixtures/awesome_log according to the file rules listed in the good-file documentation.
  3. Sets up the http reporter to listen for error events and POSTs them to http://prod.logs:3000 with additional settings to passed into Wreck

NOTE: Ensure calling server.connection prior to registering Good. request and response event listeners are only registered on connections that exist on server at the time Good is registered.

Existing streams

A single reporter is either a write stream or a transform stream. Every effort has been made to support any generic stream in the node ecosystem. As long as the stream is properly implemented, you can use it in your reporting pipeline. The following streams were built specifically to work with good.

API

See the API Reference.

good's People

Contributors

geek avatar arb avatar lloydbenson avatar andyroyle avatar cjihrig avatar kevinmstephens avatar fhemberger avatar marsup avatar pon avatar oliverzy avatar nvcexploder avatar achingbrain avatar thegoleffect avatar hulbert avatar totherik avatar dkavassy avatar danecando avatar clarkie avatar adrivanhoudt avatar simon-p-r avatar hostiphur avatar nackjicholson avatar rivergrimm avatar osukaa avatar thebergamo avatar leore avatar lancespeelmon avatar krisb avatar janl avatar jancervinka avatar

Watchers

James Cloos avatar  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.