Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Good 3.0.0 Release Notes #203

Closed
arb opened this issue Oct 8, 2014 · 0 comments
Closed

Good 3.0.0 Release Notes #203

arb opened this issue Oct 8, 2014 · 0 comments
Assignees
Milestone

Comments

@arb
Copy link
Contributor

@arb arb commented Oct 8, 2014

Summary

Version 3 of good includes a complete rewrite of the core "monitor.js" file. The main focus of this rewrite was to allow easy implementation of custom reporting options called reporters.

  • Upgrade Time: low - half a day
  • Complexity: low - In general, you'll only have to change the options passed into good
  • Risk: low to moderate - while the core of the core functionality remains unchanged, there may be some edge configurations that could introduce issues. No pre-build UDP support currently.
  • Dependencies: high - many dependencies have been removed and put into the smaller reporter modules. good-file and moment are two new dependencies.

Breaking Changes

  • Removed broadcast - moved to good-broadcast
  • Removed replay - moved to good-replay [soon to be retired]
  • Currently no UDP support - good-udp development is underway
  • Currently no redis support - development is underway
  • Many good options will no longer work and will need to be completely changed. Please check the README for options that are no longer supported directly by good and are instead options in each reporter that needs them.
  • Breaks the ability to register the plugin via JSON.

Additional Features

  • since the entire emitter is exported, developers can listen for report events in other parts of hapi if they choose to.
  • ability to add any number of reporters via options.reporters
  • when you stop the hapi server, good will go through all of the reporters and try to gracefully shut them down by calling stop on each of them. This gives the reporters a chance to finalize any remaining items before the server closes.

Migration

The biggest change will be the way you tell good to dispatch messages.

This:

var Hapi = require('hapi');
var Good = require('good');
var server = new Hapi.Server('0.0.0.0', 3000);
var options = {
    subscribers: {
        'console': ['ops', 'request', 'log', 'error'],
        'http://localhost/logs': ['log'],
        '/tmp/logs/': ['request', 'log']
    }
};
server.pack.register({
    plugin: Good,
    options: options
}, function (error) {
    if (error) {
        return console.error(error);
    }
   server.start(function (error) {
       if (error) {
           return console.error(error);
       }
       console.log('Server started at: %s', server.info.uri);
   });
});

will become this:

var Hapi = require('hapi');
var Good = require('good');
var server = new Hapi.Server('0.0.0.0', 3000);
var options = {
    reporters: [{
        reporter: Good.GoodConsole,
        args: [{
            events: {
                request: '*',
                log: '*',
                error: '*',
                ops: '*'
            }
        }]
    }, {
        reporter: Good.GoodFile,
        args:['/tmp/logs/', {
            events: {
                request:'*',
                log: '*'
            }
        }]
    }, {
        reporter: require('good-http'),
        args: ['http://localhost/logs', {
            events: {
                log: '*'
            }
        }]
    }]
};

server.pack.register({
    plugin: Good,
    options: options
}, function (error) {
    if (error) {
        return console.error(error);
    }
   server.start(function (error) {
       if (error) {
           return console.error(error);
       }
       console.log('Server started at: %s', server.info.uri);
   });
});

It is more verbose, but it will allow for a far greater amount of flexibility in the future. This way, each reporter can have it's own set of options, subscriptions, and tag filtering. Please see good-reporter for more information about these options.

UDP and REDIS

If you need UDP or REDIS support, please see the good-reporter documentation for implementing this on your own as there is currently not support for either of these transmission methods. Getting file, http(s) and console nailed down was a much higher priority.

@arb arb added this to the 3.0.0 milestone Oct 8, 2014
@arb arb self-assigned this Oct 8, 2014
@arb arb closed this Oct 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.