gpt4 book ai didi

c# - 桌面应用程序中的 Application Insights 不会发送性能计数器

转载 作者:行者123 更新时间:2023-11-30 15:24:44 26 4
gpt4 key购买 nike

我正在关注these instructions 将 App Insights 添加到 Windows 桌面应用。我在代码中添加了一些 TrackMetric 和 TrackException 调用,并且这些数据在门户中显示得很好,所以我知道基本管道正在工作。

基于these instructions ,然后我将 AI.Web NuGet 包添加到我的项目中(是的,我知道这听起来很奇怪,但特别推荐)并禁用配置文件中的所有除了以下模块/初始化程序:

  • 诊断遥测模块
  • DependencyTrackingTelemetryModule
  • 性能收集器模块
  • DeviceTelemetryInitializer

附加设备信息开始显示在我的遥测数据中,因此我知道应用程序至少正在获取配置文件设置。

不幸的是,无论我做什么,都没有显示任何标准性能计数器指标。

我还需要做些什么才能在桌面应用程序中启用性能计数器收集吗?

预先感谢您提供的任何、呃、见解...:)

编辑:“标准性能计数器”是指默认情况下跟踪的 ​​Windows 性能计数器 PerformanceCollectorModule,根据 instructions之前链接,其中指出:

PerformanceCollectorModule tracks a number of Windows performance counters. You can see these counters when you click a chart in Metric Explorer to open its details blade.

You can monitor additional performance counters - both standard Windows counters and any others that you have added...

很明显,我不必将标准计数器添加到配置文件中——只需添加我想要包含的任何其他计数器即可。

最佳答案

理想情况下,您应该能够仅使用 Perf Counter Collector nuget package在您的应用的基本 Application Insights 包之上。

您仍然需要在 appinsights.config 文件中或通过代码设置要监视的性能计数器,这在 instructions you linked 中进行了记录。到,例如:

<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector">
<Counters>
<Add PerformanceCounter="\MyCategory\MyCounter" />
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
<!-- ... -->
</Counters>
</Add>

我相信 Web SDK 只是设置了一堆 ASP.NET 管道/w3wp 性能计数器,这在标准 Windows 应用程序中不会执行任何操作。

关于c# - 桌面应用程序中的 Application Insights 不会发送性能计数器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32418946/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com