From e04be4def11aed578e4434ed8ab79973a606cc71 Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Tue, 31 Mar 2020 16:58:42 +0200 Subject: [PATCH] chore: removing force flush --- .../opentelemetry-exporter-jaeger/package.json | 3 ++- .../src/jaeger.ts | 4 ---- .../opentelemetry-exporter-jaeger/src/types.ts | 2 -- .../test/jaeger.test.ts | 18 ++---------------- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 23755c85a5..e73677551f 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -15,7 +15,8 @@ "precompile": "tsc --version", "version:update": "node ../../scripts/version-update.js", "compile": "npm run version:update && tsc -p .", - "prepare": "npm run compile" + "prepare": "npm run compile", + "watch": "tsc -w" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 50bdb042c0..eae71a518e 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -29,14 +29,11 @@ export class JaegerExporter implements SpanExporter { private readonly _logger: api.Logger; private readonly _process: jaegerTypes.ThriftProcess; private readonly _sender: typeof jaegerTypes.UDPSender; - private readonly _forceFlushOnShutdown: boolean = true; private readonly _onShutdownFlushTimeout: number; constructor(config: jaegerTypes.ExporterConfig) { this._logger = config.logger || new NoopLogger(); const tags: jaegerTypes.Tag[] = config.tags || []; - this._forceFlushOnShutdown = - typeof config.forceFlush === 'boolean' ? config.forceFlush : true; this._onShutdownFlushTimeout = typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000; @@ -69,7 +66,6 @@ export class JaegerExporter implements SpanExporter { /** Shutdown exporter. */ shutdown(): void { - if (!this._forceFlushOnShutdown) return; // Make an optimistic flush. this._flush(); // Sleeping x seconds before closing the sender's connection to ensure diff --git a/packages/opentelemetry-exporter-jaeger/src/types.ts b/packages/opentelemetry-exporter-jaeger/src/types.ts index f7f060e16f..c902cfd309 100644 --- a/packages/opentelemetry-exporter-jaeger/src/types.ts +++ b/packages/opentelemetry-exporter-jaeger/src/types.ts @@ -26,8 +26,6 @@ export interface ExporterConfig { host?: string; // default: 'localhost' port?: number; // default: 6832 maxPacketSize?: number; // default: 65000 - /** Force a flush on shutdown */ - forceFlush?: boolean; // default: true /** Time to wait for an onShutdown flush to finish before closing the sender */ flushTimeout?: number; // default: 2000 } diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index 9b79bcc838..12b34f466b 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -54,40 +54,26 @@ describe('JaegerExporter', () => { assert.strictEqual(process.tags[0].vStr, '0.1.0'); }); - it('should construct an exporter with forceFlush and flushTimeout', () => { + it('should construct an exporter with flushTimeout', () => { const exporter = new JaegerExporter({ serviceName: 'opentelemetry', - forceFlush: true, flushTimeout: 5000, }); assert.ok(typeof exporter.export === 'function'); assert.ok(typeof exporter.shutdown === 'function'); - assert.ok(exporter['_forceFlushOnShutdown']); assert.strictEqual(exporter['_onShutdownFlushTimeout'], 5000); }); - it('should construct an exporter without forceFlush and flushTimeout', () => { + it('should construct an exporter without flushTimeout', () => { const exporter = new JaegerExporter({ serviceName: 'opentelemetry', }); assert.ok(typeof exporter.export === 'function'); assert.ok(typeof exporter.shutdown === 'function'); - assert.ok(exporter['_forceFlushOnShutdown']); assert.strictEqual(exporter['_onShutdownFlushTimeout'], 2000); }); - - it('should construct an exporter with forceFlush = false', () => { - const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', - forceFlush: false, - }); - assert.ok(typeof exporter.export === 'function'); - assert.ok(typeof exporter.shutdown === 'function'); - - assert.ok(!exporter['_forceFlushOnShutdown']); - }); }); describe('export', () => {