Is there memory impact or performance cause without TelemetryClient.Flush()

删除回忆录丶 提交于 2019-12-11 08:03:53

问题


Using telemetry client to log custom event log as follow:

  var telemetryClient = new TelemetryClient();
  telemetryClient.InstrumentationKey = "<your actual insight instrumentkey>";    
  telemetryClient.TrackRequest(req.RequestUri.ToString(), DateTime.Now, Stopwatch.StartNew().Elapsed, "200", true);

My question is: do we need to flush the client using telemetryClient.Flush() or is it not required?

Even when not flushing it also works and we are able to see the log.


回答1:


Usually, you don't need to call flush() if you not aware of the point in which the application is shut down. The flush is really pushing all the data into app insights (background).

But let say if you know the point in which the application is shut down then you can call the flush manually to make sure all the data sent properly(without keeping anything in the buffer)

Typically if you call the flush it will send the data immediately without keeping in the buffer

Refer this SO



来源:https://stackoverflow.com/questions/52099180/is-there-memory-impact-or-performance-cause-without-telemetryclient-flush

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!