lib/node_tracers.js
function BufferingTracer(tracer, options) {
  options = options || {};

  var self = this;

  this._tracer = tracer;
  this._maxTraces = options.maxTraces || 50;
  this._sendInterval = options.sendInterval ? (options.sendInterval * 1000) : 10 * 1000;
  this._lastSentTs = Date.now();
  this._buffer = [];
  this._stopped = false;

  this._periodSendTimeoutId = setTimeout(this._periodicSendFunction.bind(this),
                                         this._sendInterval);
}
function BufferingTracer(tracer, options) {
  options = options || {};

  var self = this;

  this._tracer = tracer;
  this._maxTraces = options.maxTraces || 50;
  this._sendInterval = options.sendInterval ? (options.sendInterval * 1000) : 10 * 1000;
  this._lastSentTs = Date.now();
  this._buffer = [];
  this._stopped = false;

  this._periodSendTimeoutId = setTimeout(this._periodicSendFunction.bind(this),
                                         this._sendInterval);
}
Buffer traces and defer recording until maxTraces have been received or
sendInterval has elapsed since the last trace was recorded.

@param {Tracer} tracer Tracer provider to record buffered tracers to.
@param {Options} options Options object with the following keys:
- maxTraces - Number of traces to buffer before recording occurs (default:
50).
- sendInterval - An average number of seconds which can pass after the last
trace has been sent to the backend before sending all the buffered traces
to the backend again (default: 10).