diff --git a/packages/zipkin/src/batch-recorder.js b/packages/zipkin/src/batch-recorder.js index ef687279..35d25605 100644 --- a/packages/zipkin/src/batch-recorder.js +++ b/packages/zipkin/src/batch-recorder.js @@ -72,16 +72,12 @@ class BatchRecorder { * @property {number} batchInterval interval for reporting in miliseconds. * The value -1 means that there won't be batch reporting on interval basis. */ - constructor({logger, timeout = defaultTimeout, batchInterval = defaultBatchInterval}) { + constructor({logger, timeout = defaultTimeout}) { this.logger = logger; this.timeout = timeout; this.partialSpans = new Map(); this[defaultTagsSymbol] = {}; - if (batchInterval === -1) { - return; - } - // read through the partials spans regularly // and collect any timed-out ones const timer = setInterval(() => { @@ -94,7 +90,7 @@ class BatchRecorder { this._writeSpan(id, span); } }); - }, batchInterval); + }, 1000); if (timer.unref) { // unref might not be available in browsers timer.unref(); // Allows Node to terminate instead of blocking on timer } diff --git a/packages/zipkin/test/batch-recorder.test.js b/packages/zipkin/test/batch-recorder.test.js index b8eee031..fd5f0bfd 100644 --- a/packages/zipkin/test/batch-recorder.test.js +++ b/packages/zipkin/test/batch-recorder.test.js @@ -245,7 +245,7 @@ describe('Batch Recorder', () => { trace.recordAnnotation(new Annotation.ServerRecv()); }); - clock.tick('01:00'); // 1 minute is the default timeout + clock.tick(100); // 1000 is de batching interval expect(logSpan.calledOnce).to.equal(false); @@ -253,9 +253,6 @@ describe('Batch Recorder', () => { expect(logSpan.calledOnce).to.equal(true); - const loggedSpan = logSpan.getCall(0).args[0]; - expect(loggedSpan.annotations[0].value).to.equal('zipkin-js.flush'); - clock.uninstall(); });