lib/harvester.js
function harvester (metricConsumer, agentList) {
  var agentsToLoad = []
  this.metricConsumer = metricConsumer
  this.httpAgent = null
  if (agentList) {
    agentsToLoad = agentList
  }
  this.agents = []
  for (var x in agentsToLoad) {
    try {
      var TmpAgentClass = require(agentsToLoad[x])
      var tmpAgentInstance = new TmpAgentClass()
      this.addAgent(tmpAgentInstance)
    } catch (err) {
      logger.error('Loading of agent failed:' + agentsToLoad[x])
      logger.error(err)
    }
  }
  process.on('exit', function () {
    this.stop()
  }.bind(this))
  return this
}
function harvester (metricConsumer, agentList) {
  var agentsToLoad = []
  this.metricConsumer = metricConsumer
  this.httpAgent = null
  if (agentList) {
    agentsToLoad = agentList
  }
  this.agents = []
  for (var x in agentsToLoad) {
    try {
      var TmpAgentClass = require(agentsToLoad[x])
      var tmpAgentInstance = new TmpAgentClass()
      this.addAgent(tmpAgentInstance)
    } catch (err) {
      logger.error('Loading of agent failed:' + agentsToLoad[x])
      logger.error(err)
    }
  }
  process.on('exit', function () {
    this.stop()
  }.bind(this))
  return this
}
function harvester ( metricConsumer , agentList ) { var agentsToLoad = [ ] this . metricConsumer = metricConsumer this . httpAgent = null if ( agentList ) { agentsToLoad = agentList } this . agents = [ ] for ( var x in agentsToLoad ) { try { var TmpAgentClass = require ( agentsToLoad [ x ] ) var tmpAgentInstance = new TmpAgentClass ( ) this . addAgent ( tmpAgentInstance ) } catch ( err ) { logger . error ( 'Loading of agent failed:' + agentsToLoad [ x ] ) logger . error ( err ) } } process . on ( 'exit' , function ( ) { this . stop ( ) } . bind ( this ) ) return this }
This module harvest metrics from agents, registers to all agents and fires own metric events
@metricConsumer - an object that listens on "metric" event. The metric event passes a metric object with (name, value, type, ts) properties
@agentList a list of agents to be created e.g. ['./agents/osAgent.js', './agents/eventLoopAgent.js']
This module harvest metrics from agents registers to all agents and fires own metric events