diff --git a/src/nodekit.ts b/src/nodekit.ts index 2d0c2fb..fceced0 100644 --- a/src/nodekit.ts +++ b/src/nodekit.ts @@ -124,7 +124,17 @@ export class NodeKit { this.ctx.stats = prepareClickhouseClient(this.ctx); - this.addShutdownHandler(() => new Promise((resolve) => this.tracer.close(resolve))); + this.addShutdownHandler( + () => + new Promise((resolve) => { + // if tracing is disabled, initTracer returns object without close method + if (typeof this.tracer.close === 'function') { + this.tracer.close(resolve); + } else { + resolve(); + } + }), + ); this.setupShutdownSignals(); }