Azure web.app AI:性能计数器在 Web 应用程序支持列表中不可用

Azure web.app AI: Performance counter is not available in the web app supported list

我的 Azure web.app (s3) 存在内存泄漏。 为了进行调查,我想在应用程序洞察力中添加更多 PerformanceCounter。

但我做不到。

这是我添加的 ApplicationInsights.config。 (https://stebet.net/monitor-your-net-garbage-collector-using-application-insights/)

<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
    <Counters>
      <Add PerformanceCounter="\.NET CLR Memory(??APP_CLR_PROC??)\# Bytes in all Heaps" ReportAs="Bytes in all Heaps" />
    </Counters>
  </Add>

我将我的新计数器添加到 ApplicationInsights.config 并部署到 azure web.app。在 Portal 中我看不到任何数据并发现错误。

AI:性能计数器在 Web 应用程序支持列表中不可用。计数器是 \Process(??APP_WIN32_PROC??)\Bytes in all Heaps.

请帮助我了解问题所在。

谢谢, 亨里克

Please help me understand what is the problem.

我们可以从System performance counters in Application Insights中得到答案。

性能计数器对 Azure Web 应用不可用

Application Insights can show these performance counters if your application is running under IIS on an on-premises host or virtual machine to which you have administrative access.But you can send Azure Diagnostics to Application Insights.

但是我们可以使用 Application Insight API 来获取数据,我们需要 create a Apikey. We also could get demo code from the document. I did a demo before, for more detail information you could refer to another