fix(telemetry): only shutdown telemetry in stop
(#1454)
Reviewed-on: daoyoucloud/tachybase#1454 Reviewed-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: TomyJan <TomyJan6@gmail.com> Co-committed-by: TomyJan <TomyJan6@gmail.com>
This commit is contained in:
parent
4a19aa653b
commit
9720c52628
@ -458,10 +458,6 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
await this.cacheManager.close();
|
await this.cacheManager.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.telemetry.started) {
|
|
||||||
await this.telemetry.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
const oldDb = this.db;
|
const oldDb = this.db;
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
@ -485,10 +481,6 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
await this.cacheManager.close();
|
await this.cacheManager.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.telemetry.started) {
|
|
||||||
await this.telemetry.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
const oldDb = this.db;
|
const oldDb = this.db;
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
|
@ -81,6 +81,11 @@ export class Telemetry {
|
|||||||
this.started = true;
|
this.started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭链路追踪和指标监控, NOTE: 一旦调用此方法,将无法再次启动,需要重新实例化
|
||||||
|
* @returns
|
||||||
|
* @memberof Telemetry
|
||||||
|
*/
|
||||||
async shutdown() {
|
async shutdown() {
|
||||||
await Promise.all([this.trace.shutdown(), this.metric.shutdown()]);
|
await Promise.all([this.trace.shutdown(), this.metric.shutdown()]);
|
||||||
this.started = false;
|
this.started = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user