c# - Application Insight 的 TelemetryClient 线程安全吗?

标签 c# multithreading azure azure-application-insights

在此链接上:https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-custom-events-metrics/

它明确表示:

TelemetryClient is thread-safe.

We recommend you use an instance of TelemetryClient for each module of your app.

但是,MSDN 文档 ( https://msdn.microsoft.com/en-us/library/azure/microsoft.applicationinsights.telemetryclient.aspx ) 说:

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

所以问题是,大多数函数(例如 TrackEvent 和 TrackMetric)都不是静态的。如果我遵循第一篇文章,为我的 Web 服务拥有一个单例实例,我会遇到线程问题吗?

最佳答案

TelemetryClient 是线程安全的。有效的用法是创建一个单例并重用它。您不会遇到重用实例的问题。

关于c# - Application Insight 的 TelemetryClient 线程安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37689339/

相关文章:

c# - yield return返回什么样的类

c# - ScrollViewer:当 ComputedHorizo​​ntalScrollBarVisibility 改变时通知

c# - 循环递归自连接表

c# - 为每个线程分配一个cpu核心

c# - 在 WebService 中找不到 Windows Azure 管理证书

php - 如何使用outlookrestapi访问outlook地址簿

c# - SQL按照PK FK关系递归地从多个表中复制行

C# 启动的线程比预期的多

java - 关于多线程编程的赛车场景

security - 如何在 Azure 门户中配置 session 超时?