Monitors the vitals of the Kickq Queueing System.
npm install kickq-vitals --save
- Argument:
fn
Type:Function(Object)
Default: Required! - Argument:
optInterval
Type:Number
Default:300000
milliseconds (5')
By invoking the listen()
function Kickq Vitals starts collecting data and invokes the callback in the defined or default interval. The interval time affects any listeners that hook on listen()
, the latest listener with an interval value overwrites all.
Stop Kickq Vitals from collecting data. Optionally define a specific function instead of all the listeners.
kickq-vitals can be configured using the config()
function, adding an Object with key-value pairs or a single key, value pair:
vitals.config({key: value, otherKey: otherValue});
vitals.config(key, value);
Type: boolean
Default: false
Log vitals to files.
Type: string
Default: ./log
kickq-vitals requires a folder to start saving the logfiles.
Type: string
Default: kickq-vitals.log
The filename to store the main vitals.
Type: boolean
Default: boolean
Wether to save vitals per queue.
Type: string
Default: queue-
Prefix to use when storing queue log files.
Start monitoring vitals using a callback
var vitals = require('kickq-vitals');
// listen for vitals every 5 minutes
vitals.listen(fn, 300000);
function fn(vitals) {
console.log('vitals: ', vitals);
}
/* ... */
// stop listening
vitals.stop();
Start monitoring vitals using a logfile
var vitals = require('kickq-vitals');
// define the log folder
vitals.config('logpath', './logs');
// start logging to file
vitals.config('logToFile', true);
/* ... */
// stop logging to file
vitals.config('logToFile', false);
The vitals.listen() will provide as an argument an Object Literal with the following structure:
{
time: 1364226587925, // {number} JS timestamp.
period: 300000, // {number} the period in ms.
errors: {
db: 0, // {number} database error count
app: 0 // {number} kickq application errors
},
// Measures only the jobs created during the period.
jobStats: {
created: 0,
processed: 0,
success: 0,
failed: 0,
ghosts: 0,
avgProcessingTime: 0.0
},
jobQueues: {
// The Job's name as key
"a job": {
// the same object struct as "jobStats"
created: 0,
processed: 0,
success: 0,
failed: 0,
ghosts: 0,
avgProcessingTime: 0.0
}
}
}
- v0.0.3, 24 Apr 2013
- Added option to save vitals to file.
- Bug fixes, better handling of stopping.
- v0.0.1, 23 Apr 2013
- Big Bang
Copyright 2012 Verbling (Fluency Forums Corporation)
Licensed under the MIT License