Socket
Socket
Sign inDemoInstall

good

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

good - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

18

package.json
{
"name": "good",
"description": "Server and process monitoring plugin",
"version": "0.1.6",
"version": "0.1.7",
"author": "Van Nguyen <the.gol.effect@gmail.com>",

@@ -24,5 +24,5 @@ "contributors":[

"dependencies": {
"hoek": "0.6.x",
"request": "2.11.x",
"async": "0.1.x"
"hoek": "0.7.x",
"request": "2.16.x",
"async": "0.2.x"
},

@@ -35,11 +35,7 @@ "peerDependencies": {

"sinon": "1.x.x",
"mocha": "1.x.x",
"chai": "1.x.x",
"blanket": "1.0.x",
"travis-cov": "0.2.x"
"lab": "0.0.x",
"complexity-report": "0.x.x"
},
"scripts": {
"test": "make test && make test-cov",
"blanket": { "pattern": "//^((?!\/node_modules\/)(?!\/test\/).)*$/ig", "onlyCwd": true, "data-cover-flags": { "branchTracking": true } },
"travis-cov": { "threshold": 100 }
"test": "make test-cov"
},

@@ -46,0 +42,0 @@ "licenses": [

@@ -11,3 +11,3 @@ <a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>

**hapi** comes with a built-in process monitor for three types of events:
**good** is a process monitor for three types of events:
- System and process performance (ops) - CPU, memory, disk, and other metrics.

@@ -17,5 +17,4 @@ - Requests logging (request) - framework and application generated logs generated during the lifecycle of each incoming request.

The monitor is _off_ by default and can be turned on using the `monitor` server option. To use the default settings, simply set the value to _true_.
Applications with multiple server instances, each with its own monitor should only include one _log_ subscription per destination as general events (log)
are a process-wide facility and will result in duplicated log events. To override some or all of the defaults, set `monitor` to an object with the following
Applications with multiple server instances, each with its own monitor should only include one _log_ subscription per destination as general events
are a process-wide facility and will result in duplicated log events. To override some or all of the defaults, set `options` to an object with the following
optional settings:

@@ -33,19 +32,22 @@ - `broadcastInterval` - the interval in milliseconds to send collected events to subscribers. _0_ means send immediately. Defaults to _0_.

var options = {
monitor: {
subscribers: {
console: ['ops', 'request', 'log'],
'http://localhost/logs': ['log']
}
subscribers: {
console: ['ops', 'request', 'log'],
'http://localhost/logs': ['log']
}
};
hapi.plugin.require('good', options, function (err) {
if (!err) {
// Plugin loaded successfully
}
});
```
Disabling hapi console output:
Disabling console output:
```javascript
var options = {
monitor: {
subscribers: {
console: [],
'http://localhost/logs': ['log']
}
subscribers: {
console: [],
'http://localhost/logs': ['log']
}

@@ -58,8 +60,17 @@ };

var options = {
monitor: {
subscribers: {
console: { tags: ['error'], events: ['log'] }
}
subscribers: {
console: { tags: ['error'], events: ['log'] }
}
};
```
### Broadcast Request Structure
When **good** broadcasts data to a remote endpoint it sends json that has the following properties:
- `schema` - the value of 'schemaName' in the settings. Default is 'good.v1'
- `host` - the operating system [hostname](http://nodejs.org/api/os.html#os_os_hostname)
- `appVer` - the version of **good**
- `timestamp` - the current time of the server
- `events` - an array of the events that are subscribed to
// Load modules
var Chai = require('chai');
var Lab = require('lab');
var Hapi = require('hapi');

@@ -14,3 +14,7 @@

var expect = Chai.expect;
var expect = Lab.expect;
var before = Lab.before;
var after = Lab.after;
var describe = Lab.experiment;
var it = Lab.test;

@@ -17,0 +21,0 @@

// Load modules
var Chai = require('chai');
var Lab = require('lab');
var Hapi = require('hapi');

@@ -16,3 +16,7 @@ var Hoek = require('hoek');

var expect = Chai.expect;
var expect = Lab.expect;
var before = Lab.before;
var after = Lab.after;
var describe = Lab.experiment;
var it = Lab.test;

@@ -411,2 +415,30 @@

it('sets the event with the request remote connection address', function (done) {
makePack(function (pack, server) {
var request = {
raw: {
req: {
headers: {
'user-agent': 'test'
},
connection: {
remoteAddress: 'hapi.com'
}
}
},
analytics: {},
server: server
};
var monitor = new Monitor(pack, { subscribers: {} });
var event = monitor._request()(request);
expect(event.event).to.equal('request');
expect(event.source.remoteAddress).to.equal('hapi.com');
done();
});
});
it('logs errors when they occur', function (done) {

@@ -413,0 +445,0 @@

// Load modules
var Chai = require('chai');
var Lab = require('lab');
var ChildProcess = require('child_process');

@@ -16,3 +16,7 @@ var Sinon = require('sinon');

var expect = Chai.expect;
var expect = Lab.expect;
var before = Lab.before;
var after = Lab.after;
var describe = Lab.experiment;
var it = Lab.test;

@@ -19,0 +23,0 @@

// Load modules
var Chai = require('chai');
var Lab = require('lab');
var ChildProcess = require('child_process');

@@ -17,3 +17,7 @@ var Fs = require('fs');

var expect = Chai.expect;
var expect = Lab.expect;
var before = Lab.before;
var after = Lab.after;
var describe = Lab.experiment;
var it = Lab.test;

@@ -20,0 +24,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc