| 102 | /** @inheritDoc */ |
| 103 | // @ts-expect-error - PromiseLike is a subset of Promise |
| 104 | public async close(timeout?: number | undefined): PromiseLike<boolean> { |
| 105 | if (this._clientReportInterval) { |
| 106 | clearInterval(this._clientReportInterval); |
| 107 | } |
| 108 | |
| 109 | if (this._clientReportOnExitFlushListener) { |
| 110 | process.off('beforeExit', this._clientReportOnExitFlushListener); |
| 111 | } |
| 112 | |
| 113 | if (this._logOnExitFlushListener) { |
| 114 | process.off('beforeExit', this._logOnExitFlushListener); |
| 115 | } |
| 116 | |
| 117 | const allEventsSent = await super.close(timeout); |
| 118 | if (this.traceProvider) { |
| 119 | await this.traceProvider.shutdown(); |
| 120 | } |
| 121 | |
| 122 | return allEventsSent; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Will start tracking client reports for this client. |