Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Exception handler for cluster

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 tests
Octocat-spinner-32 views
Octocat-spinner-32 .gitignore
Octocat-spinner-32 History.md
Octocat-spinner-32 Makefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
Readme.md

cluster.exception

Exception notification plugin for Cluster

Installation

The easiest way to install the module is through the node package manager (npm).

> npm install cluster.exception

Or you could clone this github repository and point your require statement to that.

> git clone git://github.com/3rd-Eden/cluster.exception.git

Usage

Options:

  • from sender email address. Optional, should be a string. Defaults to cluster@dev.null.
  • to receiving email addresses. Required, a array or string.
  • subject email subject. Optional, string, can contain optional template tags. Defaults to Cluster.exception {date}.
  • methods console.* methods that need to be monitored. Optional, array. Defaults to ['log','info','warn','error'].
  • template verbosity of the email content. Optional, string. Defaults to default. Can either be default, basic or history.
  • history options for the History metrics module. Optional, object.
    • limit The amount samples it should store internally. Optional, number. Defaults to 50.
    • duration The interval of the snapshots. Optional, number in ms. Defaults to 25 seconds (25000 ms).

Example

var http = require('http')
  , cluster = require('cluster')
  , exception = require('../');

var app = http.createServer(function httpServer(req, res){
  res.writeHead(200);
  res.end("hello world");
  if(req.url.match('favicon')){
    console.info('Im a console.info');
    console.warn('Im a console.warn');
    console.log('Im a console.log');
    console.error('Im a console.error');
    console.info(req);

    throw new Error("Omfg, uncaught error");
  }
});

cluster = cluster(app)
  .use(cluster.stats())
  .use(cluster.pidfiles('pids'))
  .use(cluster.cli())
  .use(cluster.repl(8888))
  .use(exception({to: 'your-email@ddress.here'}))
  .listen(8080);

Or check the examples folder for more examples.

Templates

  • basic This includes the Stracktrace and Cluster instance information.
  • history This includes the Stracktrace, Cluster instance, Log snapshot and graphs.
  • default This includes.. Everything you see in the screenshot below, you can never have to much information.

Screenshots

Roadmap

The initial release will only contain support for email notifications. In the next iteration there will be support for multiple backends available. There are some use cases where you would want to store the details of the exception + the context in a database or somewhere else. So a configurable backend is something that would make a fine addition to the plugin.

Once this has been realized, I will rip out the History module and create a new node-metrics module from it, so it will be completely customizable and reusable with only the metrics that you think are important. If you have application that does allot database queries, it might be useful to know see if the queries per second where increasing, or that it took to long for your database server to respond. The possibilities are endless.

License

(The MIT License)

Copyright (c) 2011 Arnout Kazemier <info@3rd-Eden.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.