简体   繁体   English

关机时冲洗AI遥测

[英]flushing AI telemetry on shutdown

I am attempting to flush my AI telemetry using a Runtime Shutdown Hook that calls telemetryClient.flush(). 我正在尝试使用运行时关闭挂钩(调用telemetryClient.flush())刷新AI遥测。

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) (整个线程只是第一个日志记录语句flush(),然后是第二个日志记录语句)

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. 我查看了Github上的源代码,似乎找不到任何阻止刷新在关闭线程中正常工作的问题。

Is there a special way flush should be used? 是否有使用冲洗的特殊方法?

Efong5, is this related to Java SDK for Application Insights? Efong5,这与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. 冲洗后理想的情况是15秒钟,以便所有剩余的遥测信号都从盒子中流到网络。

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. 如果可能的话,刷新连接到您正在使用的框架的关闭挂钩,否则,如果您使用类似Runtime.addShutdownHook()类的东西,则需要确保在此期间未使用任何记录器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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