簡體   English   中英

桌面應用程序中的Application Insights不會發送perf計數器

[英]Application Insights in desktop app won't send perf counters

我按照這些說明 將App Insights添加到Windows桌面應用程序 我在我的代碼中添加了一些TrackMetric和TrackException調用,這些數據在門戶網站中顯示得很好,所以我知道基本的管道工作正常。

基於這些說明 ,我然后將AI.Web NuGet包添加到我的項目中(是的,我知道這聽起來很奇怪,但是特別推薦)並禁用配置文件中的以下模塊/初始化器之外的所有內容:

  • DiagnosticsTelemetryModule
  • DependencyTrackingTelemetryModule
  • PerformanceCollectorModule
  • DeviceTelemetryInitializer

其他設備信息開始顯示在我的遙測數據中,所以我知道該應用程序至少會獲取配置文件設置。

不幸的是,無論我做什么, 都沒有出現任何標准性能計數器指標。

我還需要做些什么才能在桌面應用中啟用perf計數器收集嗎?

在此先感謝任何,呃,見解...... :)

編輯 :通過“標准性能計數器”我的意思是Windows性能計數器PerformanceCollectorModule默認情況下根據之前鏈接的說明進行跟蹤,其中說明:

PerformanceCollectorModule跟蹤許多Windows性能計數器。 單擊Metric Explorer中的圖表以打開其詳細信息刀片時,可以看到這些計數器。

您可以監視其他性能計數器 - 標准Windows計數器和您添加的任何其他計數器...

很明顯,我不應該將標准文件添加到配置文件中 - 只需要包含任何其他計數器。

理想情況下,您應該只能在應用程序的基礎Application Insights包之上使用Perf Counter Collector nuget包

您仍然需要在appinsights.config文件中或通過代碼( 您在鏈接說明中記錄的代碼)設置要監視的perf計數器,例如:

<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應用程序中無法做任何事情。

確保該帳戶(您的應用程序正在運行)可以訪問該計算機上的性能計數器(通常它應該只是Performance Monitor Users組的成員)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM