src/stats.js
function(options) {
  assert(options,                   "options are required");
  assert(options.connectionString,  "options.connectionString is missing");
  assert(url.parse(options.connectionString).protocol === 'https:' ||
         options.allowHTTP, "InfluxDB connectionString must use HTTPS!");
  options = _.defaults({}, options, {
    maxDelay:             60 * 5,
    maxPendingPoints:     250
  });
  this._options           = options;
  this._pendingPoints     = {};
  this._nbPendingPoints   = 0;
  this._flushTimeout = setTimeout(
    this.flush.bind(this, true),
    options.maxDelay * 1000
  );
}
function(options) {
  assert(options,                   "options are required");
  assert(options.connectionString,  "options.connectionString is missing");
  assert(url.parse(options.connectionString).protocol === 'https:' ||
         options.allowHTTP, "InfluxDB connectionString must use HTTPS!");
  options = _.defaults({}, options, {
    maxDelay:             60 * 5,
    maxPendingPoints:     250
  });
  this._options           = options;
  this._pendingPoints     = {};
  this._nbPendingPoints   = 0;
  this._flushTimeout = setTimeout(
    this.flush.bind(this, true),
    options.maxDelay * 1000
  );
}
Create an Influx Database Connection

options:
{
// Connection string for
connectionString:  '<protocol>://<user>:<pwd>@<host>:<port>/db/<database>',

// Max submission delay
maxDelay:          60 * 5, // 5 minutes

// Maximum number of pending points before writing
maxPendingPoints:  250,

// Allow the connection string to use HTTP instead of HTTPS, this option
// is just to prevent accidental deployments with HTTP instead of HTTPS
// (there is no reason not to use HTTPS).
allowHTTP:         false
}