index.js
function Panopticon(options) {
	var isInstance = this instanceof Panopticon;

	if (!isInstance) {
		return new Panopticon(options);
	}

	EventEmitter.call(this);
	this.id = instanceCount;
	instanceCount += 1;

	// First we sort out the methods and data which handle are local to this process.
	genericSetup(this, options);

	// If the process is a worker, we only need to send the master results then return. If the
	// process is not a worker, it is either the master or stand alone. The master also handles
	// the delivery of aggregated data.
	if (cluster.isWorker) {
		workerSetup(this);
	} else {
		masterSetup(this);
		setupDelivery(this);
	}
}
function Panopticon(options) {
	var isInstance = this instanceof Panopticon;

	if (!isInstance) {
		return new Panopticon(options);
	}

	EventEmitter.call(this);
	this.id = instanceCount;
	instanceCount += 1;

	// First we sort out the methods and data which handle are local to this process.
	genericSetup(this, options);

	// If the process is a worker, we only need to send the master results then return. If the
	// process is not a worker, it is either the master or stand alone. The master also handles
	// the delivery of aggregated data.
	if (cluster.isWorker) {
		workerSetup(this);
	} else {
		masterSetup(this);
		setupDelivery(this);
	}
}
function Panopticon ( options ) { var isInstance = this instanceof Panopticon ; if ( ! isInstance ) { return new Panopticon ( options ) ; } EventEmitter . call ( this ) ; this . id = instanceCount ; instanceCount += 1 ; // First we sort out the methods and data which handle are local to this process. genericSetup ( this , options ) ; // If the process is a worker, we only need to send the master results then return. If the // process is not a worker, it is either the master or stand alone. The master also handles // the delivery of aggregated data. if ( cluster . isWorker ) { workerSetup ( this ) ; } else { masterSetup ( this ) ; setupDelivery ( this ) ; } }
The constructor for Panopticon. Handles the differences between master and worker processes.
Please refer to the README for more information.

@param {Object}   options               The configuration object.
@param {Number}   options.startTime     Time in ms elapsed since 1 January 1970 00:00:00 UTC.
@param {String}   options.name          The name of the panopticon being constructed.
@param {Number}   options.interval      Interval time in milliseconds.
@param {Number}   [options.scaleFactor] 1 -> kHz, 1000 -> Hz. If no positive finite number is
given, defaults to 1.
@param {Boolean}  [options.persist]     Keep a logger once initialized. Each interval reset it.
@param {Function} [options.transformer] A custom function to transform data before merging with
the aggregate.
@constructor
@extends EventEmitter
@alias module:Panopticon
The constructor for Panopticon . Handles the differences between master and worker processes . Please refer to the README for more information .