fix(syncing-server): add opentelemetry sdk shutdown

This commit is contained in:
Karol Sójko 2024-01-03 10:41:26 +01:00
parent 69ce3eb2a8
commit a0e523e64c
No known key found for this signature in database
GPG key ID: C2F813669419D05F
3 changed files with 13 additions and 0 deletions

View file

@ -98,4 +98,8 @@ export class OpenTelemetrySDK implements OpenTelemetrySDKInterface {
start(): void {
this.sdk.start()
}
async shutdown(): Promise<void> {
await this.sdk.shutdown()
}
}

View file

@ -1,3 +1,4 @@
export interface OpenTelemetrySDKInterface {
start(): void
shutdown(): Promise<void>
}

View file

@ -146,6 +146,14 @@ void container.load().then((container) => {
logger.info('gRPC server closed')
}
})
sdk
.shutdown()
.then(() => {
logger.info('OpenTelemetry SDK shut down')
})
.catch((error) => {
logger.error(`Failed to shut down OpenTelemetry SDK: ${error.message}`)
})
})
logger.info(`Server started on port ${process.env.PORT}`)