C# 没有TelemetryClient.Flush()是否存在内存影响或性能原因

C# 没有TelemetryClient.Flush()是否存在内存影响或性能原因,c#,azure,azure-functions,azure-application-insights,telemetry,C#,Azure,Azure Functions,Azure Application Insights,Telemetry,使用遥测客户端记录自定义事件日志,如下所示: var telemetryClient = new TelemetryClient(); telemetryClient.InstrumentationKey = "<your actual insight instrumentkey>"; telemetryClient.TrackRequest(req.RequestUri.ToString(), DateTime.Now, Stopwatch.StartNew()

使用遥测客户端记录自定义事件日志,如下所示:

  var telemetryClient = new TelemetryClient();
  telemetryClient.InstrumentationKey = "<your actual insight instrumentkey>";    
  telemetryClient.TrackRequest(req.RequestUri.ToString(), DateTime.Now, Stopwatch.StartNew().Elapsed, "200", true);
var telemetryClient=new telemetryClient();
telemetryClient.InstrumentationKey=“”;
TrackRequest(req.RequestUri.ToString(),DateTime.Now,Stopwatch.StartNew()。经过,“200”,true);
我的问题是:我们需要使用
telemetryClient.flush()
刷新客户端还是不需要


即使在不刷新的情况下,它也可以工作,并且我们可以看到日志。

通常,如果您不知道应用程序关闭的时间点,则不需要调用
flush()
flush
实际上是将所有数据推送到app insights(后台)中

但是,假设您知道应用程序关闭的时间点,那么您可以手动调用
flush
,以确保所有数据都正确发送(不在缓冲区中保留任何内容)

通常,如果调用
flush
,它将立即发送数据,而不保留在缓冲区中


感谢您的评论,并分享所附链接。