Azure App Insights中的Flush() [英] Flush() in Azure App Insights

查看:90
本文介绍了Azure App Insights中的Flush()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Azure App Insights中的Flush()方法,我想知道它是否会影响项目的性能?

For Flush() method in Azure App Insights, I was wondering if it impacts the performance of the project?

我试图删除Flush(),所有自定义数据仍发送到App Insights.所以我的问题应该是为什么我们需要Flush()?我们可以删除它吗?

I tried to remove Flush() and all the custom data are still sent to App Insights.So my question should be why do we need the Flush()? Can we remove it?

推荐答案

Flush()将当前在缓冲区中拥有的所有数据推送到App Insights服务. 您可以在此处查看其源代码: https://github.com/Microsoft/ApplicationInsights-dotnet/blob/3115fe1cc866a15d09e9b5f1f7f596385406433d/src/Microsoft.ApplicationInsights/TelemetryClient.cs#L593 .

Flush() on TelemetryClient pushes all the data it currently has in a buffer to the App Insights service. You can see its source code here: https://github.com/Microsoft/ApplicationInsights-dotnet/blob/3115fe1cc866a15d09e9b5f1f7f596385406433d/src/Microsoft.ApplicationInsights/TelemetryClient.cs#L593.

通常,Application Insights将在后台批量发送数据,以便更有效地利用网络. 如果启用了开发人员模式或手动调用Flush(),则会立即发送数据.

Normally, Application Insights will send your data in batches in the background so it uses the network more efficiently. If you have developer mode enabled or call Flush() manually, data is sent immediately.

通常,您不需要调用Flush(). 但是,如果您知道该过程将在那之后退出,那么您将需要调用Flush()来确保所有数据都已发送.

Typically you do not need to call Flush(). But in a case where you know the process will exit after that point, you'll want to call Flush() to make sure all the data is sent.

这篇关于Azure App Insights中的Flush()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆