<commit_before>var
	_         = require('lodash'),
	assert    = require('assert'),
	events    = require('events'),
	net       = require('net'),
	os        = require('os'),
	stream    = require('readable-stream'),
	UDPStream = require('./udp-stream'),
	url       = require('url'),
	util      = require('util')
;

var Emitter = module.exports = function Emitter(opts)
{
	assert(opts && _.isObject(opts), 'you must pass an options object to the Emitter constructor');
	assert((opts.host && opts.port) || opts.path || opts.uri, 'you must pass uri, path, or a host/port pair for the collector');
	if (opts.node && !opts.app) opts.app = opts.node;
	assert(opts.app && _.isString(opts.app), 'you must pass an `app` option naming this service or app');

	events.EventEmitter.call(this);

	if (opts.uri) Emitter.parseURI(opts);
	if (opts.maxretries) this.maxretries = parseInt(opts.maxretries, 10);
	if (opts.maxbacklog) this.maxbacklog = parseInt(opts.maxbacklog, 10);

	this.options = opts;
	this.defaults = {};
	this.defaults.host = os.hostname();
	this.defaults.app = opts.app;
	this.backlog = [];
	this.output = new JSONOutputStream();

	this.connect();
};
util.inherits(Emitter, events.EventEmitter);

Emitter.prototype.defaults = null;
Emitter.prototype.backlog  = null;
Emitter.prototype.maxbacklog = 1000;
Emitter.prototype.client   = null;
Emitter.prototype.ready    = false;
Emitter.prototype.retries  = 0;
Emitter.prototype.maxretries = 100;
Emitter.prototype.maxbacklog = 1000;

Emitter.parseURI = function(options)
{
	var parsed = url.parse(options.uri);<commit_msg>Node name is distinct from app name. E.g., "www" vs "www:8081". To distinguish processes on the same host.<commit_after>var
	_         = require('lodash'),
	assert    = require('assert'),
	events    = require('events'),
	net       = require('net'),
	os        = require('os'),
	stream    = require('readable-stream'),
	UDPStream = require('./udp-stream'),
	url       = require('url'),
	util      = require('util')
;

var Emitter = module.exports = function Emitter(opts)
{
	assert(opts && _.isObject(opts), 'you must pass an options object to the Emitter constructor');
	assert((opts.host && opts.port) || opts.path || opts.uri, 'you must pass uri, path, or a host/port pair for the collector');
	if (opts.node && !opts.app) opts.app = opts.node;
	assert(opts.app && _.isString(opts.app), 'you must pass an `app` option naming this service or app');

	events.EventEmitter.call(this);

	if (opts.uri) Emitter.parseURI(opts);
	if (opts.maxretries) this.maxretries = parseInt(opts.maxretries, 10);
	if (opts.maxbacklog) this.maxbacklog = parseInt(opts.maxbacklog, 10);

	this.options = opts;
	this.defaults = {};
	this.defaults.host = os.hostname();
	this.defaults.app = opts.app;
	this.defaults.node = opts.node;
	this.backlog = [];
	this.output = new JSONOutputStream();

	this.connect();
};
util.inherits(Emitter, events.EventEmitter);

Emitter.prototype.defaults = null;
Emitter.prototype.backlog  = null;
Emitter.prototype.maxbacklog = 1000;
Emitter.prototype.client   = null;
Emitter.prototype.ready    = false;
Emitter.prototype.retries  = 0;
Emitter.prototype.maxretries = 100;
Emitter.prototype.maxbacklog = 1000;

Emitter.parseURI = function(options)
{
	var parsed = url.parse(options.uri);
{'fraction_non_alphanumeric': 0.15299877600979192, 'fraction_numerical': 0.011015911872705019, 'mean_word_length': 4.188888888888889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2828181', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1072, 'n_words': 254}