0.0.3 • Published 11 years ago

kickq-vitals v0.0.3

Weekly downloads
1
License
-
Repository
github
Last release
11 years ago

Kickq Vitals

Monitors the vitals of the Kickq Queueing System.

Install

npm install kickq-vitals --save

What Vitals are Monitored

Kickq Vitals will emit events about the following vitals:

  • Average processing time. (per job and total)
  • Errors occured.
  • New Jobs created.
  • Jobs queued to be processed. (per job and total)
  • Jobs completed successfully.
  • Jobs completed with error.
  • Jobs timing out and becoming ghosts.

The API

Function listen(fn, optInterval)

  • 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.

vitals.listen() Callback Data Object

The event callback will contain 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
    }
  }
}

Function stop(optCb)

Stop Kickq Vitals from collecting data. Optionally define a specific function instead of all the listeners.

Example

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();

Authors

Release History

  • v0.0.1, 23 Apr 2013
    • Big Bang

License

Copyright 2012 Verbling (Fluency Forums Corporation)

Licensed under the MIT License