Kickq Vitals
Monitors the vitals of the Kickq Queueing System.
Install
npm install kickq-vitals --save
The API
listen(fn, optInterval)
Function -
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(optCb)
Function Stop Kickq Vitals from collecting data. Optionally define a specific function instead of all the listeners.
Configuration
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);
Configuration Options
logToFile
Option :: Type: boolean
Default: false
Log vitals to files.
logpath
Option :: Type: string
Default: ./log
kickq-vitals requires a folder to start saving the logfiles.
logFilename
Option :: Type: string
Default: kickq-vitals.log
The filename to store the main vitals.
logSaveQueues
Option :: Type: boolean
Default: boolean
Wether to save vitals per queue.
logQueuePrefix
Option :: Type: string
Default: queue-
Prefix to use when storing queue log files.
Examples
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);
What Vitals are Monitored
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
}
}
}
Authors
Release History
-
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
License
Copyright 2012 Verbling (Fluency Forums Corporation)
Licensed under the MIT License