chore: removing force flush (#916)
Co-authored-by: Mayur Kale <mayurkale@google.com>
This commit is contained in:
parent
3d26f822f4
commit
7719c9151c
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue