lib/client/ingest/signal_fx_client.js
function SignalFxClient(apiToken, options) {
  var _this = this;

  this.apiToken = apiToken;
  var params = options || {};

  this.ingestEndpoint = params.ingestEndpoint || conf.DEFAULT_INGEST_ENDPOINT;
  this.timeout = params.timeout || conf.DEFAULT_TIMEOUT;
  this.batchSize = Math.max(1, (params.batchSize ? params.batchSize : conf.DEFAULT_BATCH_SIZE));
  this.userAgents = params.userAgents || null;
  this.globalDimensions = params.dimensions || {};
  this.enableAmazonUniqueId = params.enableAmazonUniqueId || false;
  this.proxy = params.proxy || null;

  this.rawData = [];
  this.rawEvents = [];
  this.queue = [];

  this.loadAWSUniqueId = new Promise(function (resolve) {
    if (!_this.enableAmazonUniqueId) {
      resolve();
      return;
    } else {
      if (_this.AWSUniqueId !== undefined && _this.AWSUniqueId !== '') {
        resolve();
        return;
      }
    }

    _this._retrieveAWSUniqueId(function (isSuccess, AWSUniqueId) {
      if (isSuccess) {
        _this.AWSUniqueId = AWSUniqueId;
        _this.globalDimensions[_this.AWSUniqueId_DIMENTION_NAME] = AWSUniqueId;
      } else {
        _this.enableAmazonUniqueId = false;
        _this.AWSUniqueId = '';
        delete _this.globalDimensions[_this.AWSUniqueId_DIMENTION_NAME];
      }
      resolve();
    });
  });
}
function SignalFxClient(apiToken, options) {
  var _this = this;

  this.apiToken = apiToken;
  var params = options || {};

  this.ingestEndpoint = params.ingestEndpoint || conf.DEFAULT_INGEST_ENDPOINT;
  this.timeout = params.timeout || conf.DEFAULT_TIMEOUT;
  this.batchSize = Math.max(1, (params.batchSize ? params.batchSize : conf.DEFAULT_BATCH_SIZE));
  this.userAgents = params.userAgents || null;
  this.globalDimensions = params.dimensions || {};
  this.enableAmazonUniqueId = params.enableAmazonUniqueId || false;
  this.proxy = params.proxy || null;

  this.rawData = [];
  this.rawEvents = [];
  this.queue = [];

  this.loadAWSUniqueId = new Promise(function (resolve) {
    if (!_this.enableAmazonUniqueId) {
      resolve();
      return;
    } else {
      if (_this.AWSUniqueId !== undefined && _this.AWSUniqueId !== '') {
        resolve();
        return;
      }
    }

    _this._retrieveAWSUniqueId(function (isSuccess, AWSUniqueId) {
      if (isSuccess) {
        _this.AWSUniqueId = AWSUniqueId;
        _this.globalDimensions[_this.AWSUniqueId_DIMENTION_NAME] = AWSUniqueId;
      } else {
        _this.enableAmazonUniqueId = false;
        _this.AWSUniqueId = '';
        delete _this.globalDimensions[_this.AWSUniqueId_DIMENTION_NAME];
      }
      resolve();
    });
  });
}
function SignalFxClient ( apiToken , options ) { var _this = this ; this . apiToken = apiToken ; var params = options || { } ; this . ingestEndpoint = params . ingestEndpoint || conf . DEFAULT_INGEST_ENDPOINT ; this . timeout = params . timeout || conf . DEFAULT_TIMEOUT ; this . batchSize = Math . max ( 1 , ( params . batchSize ? params . batchSize : conf . DEFAULT_BATCH_SIZE ) ) ; this . userAgents = params . userAgents || null ; this . globalDimensions = params . dimensions || { } ; this . enableAmazonUniqueId = params . enableAmazonUniqueId || false ; this . proxy = params . proxy || null ; this . rawData = [ ] ; this . rawEvents = [ ] ; this . queue = [ ] ; this . loadAWSUniqueId = new Promise ( function ( resolve ) { if ( ! _this . enableAmazonUniqueId ) { resolve ( ) ; return ; } else { if ( _this . AWSUniqueId !== undefined && _this . AWSUniqueId !== '' ) { resolve ( ) ; return ; } } _this . _retrieveAWSUniqueId ( function ( isSuccess , AWSUniqueId ) { if ( isSuccess ) { _this . AWSUniqueId = AWSUniqueId ; _this . globalDimensions [ _this . AWSUniqueId_DIMENTION_NAME ] = AWSUniqueId ; } else { _this . enableAmazonUniqueId = false ; _this . AWSUniqueId = '' ; delete _this . globalDimensions [ _this . AWSUniqueId_DIMENTION_NAME ] ; } resolve ( ) ; } ) ; } ) ; }
SignalFx API client.
This class presents a programmatic interface to SignalFx's metadata and
ingest APIs. At the time being, only ingest is supported; more will come
later.

@constructor
@param apiToken
@param options - {
enableAmazonUniqueId: boolean, // "false by default"
dimensions:"object", // dimensions for each datapoint and event
ingestEndpoint:"string",
timeout:"number",
batchSize:"number",
userAgents:"array",
proxy:"string" //http://<USER>:<PASSWORD>@<HOST>:<PORT>
}
SignalFx API client . This class presents a programmatic interface to SignalFx s metadata and ingest APIs . At the time being only ingest is supported ; more will come later .