简体   繁体   中英

flushing AI telemetry on shutdown

I am attempting to flush my AI telemetry using a Runtime Shutdown Hook that calls telemetryClient.flush().

I have two logging statements inside the thread, before and after the flush, and only the first triggers.

(The entire thread is simply the first logging statement, flush(), then the second logging statement)

I looked through the source on Github and I can't seem to find any issues that prevent the flush from properly working in the shutdown thread.

Is there a special way flush should be used?

Efong5, is this related to Java SDK for Application Insights? Are you facing issues with data loss in regards to flush? If that is the case, I would suggest you have a smaller wait; ideally 15 seconds after flushing so any remaining telemetry flows out of the box to the network.

Turns out that this issue was caused by race conditions between different parts of the application shutting down.

If possible, flush in a shutdown hook attached to the framework you're using, otherwise if you use something like Runtime.addShutdownHook() you'll need to make sure that you are not using any loggers during it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM