Reputation: 31
AI: Error collecting 3 of the configured performance counters. Please check the configuration. Counter \ASP.NET Applications(??APP_W3SVC_PROC??)\Requests/Sec: Failed to perform the first read for performance counter. Please make sure it exists. Category: ASP.NET Applications, counter: Requests/Sec, instance example.exe Counter \ASP.NET Applications(??APP_W3SVC_PROC??)\Request Execution Time: Failed to perform the first read for performance counter. Please make sure it exists. Category: ASP.NET Applications, counter: Request Execution Time, instance example.exe Counter \ASP.NET Applications(??APP_W3SVC_PROC??)\Requests In Application Queue: Failed to perform the first read for performance counter. Please make sure it exists. Category: ASP.NET Applications, counter: Requests In Application Queue, instance example.exe
Upvotes: 0
Views: 1923
Reputation: 29840
Probably those counters are not available on the platform or hosting option of your app.
For .Net Core
You can disable collecting them at all like this:
public void ConfigureServices(IServiceCollection services)
{
...
services.AddApplicationInsightsTelemetry(options =>
{
options.EnablePerformanceCounterCollectionModule = false;
});
...
}
or you can remove (or add) counters like this:
public static void Configure(IApplicationBuilder app)
{
...
var modules = app.ApplicationServices.GetServices<ITelemetryModule>();
var perfModule = modules.OfType<PerformanceCollectorModule>().FirstOrDefault();
if (perfModule != null)
{
perfModule.DefaultCounters.Remove(perfModule.DefaultCounters.First(dc =>
dc.PerformanceCounter == @"somecounter"));
}
...
}
For Asp.Net
Edit your applicationinsights.config
file and remove the counters that give errors / you don't want:
<TelemetryModules>
...
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
<DefaultCounters/>
<Counters>
<!--<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\% Processor Time" ReportAs="\Process(??APP_WIN32_PROC??)\% Processor Time" />
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\% Processor Time Normalized" ReportAs="\Process(??APP_WIN32_PROC??)\% Processor Time Normalized" /> -->
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Private Bytes" ReportAs="\Process(??APP_WIN32_PROC??)\Private Bytes" />
<Add PerformanceCounter="\Memory\Available Bytes" ReportAs="\Memory\Available Bytes" />
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\IO Data Bytes/sec" ReportAs="\Process(??APP_WIN32_PROC??)\IO Data Bytes/sec" />
<Add PerformanceCounter="\Processor(_Total)\% Processor Time" ReportAs="\Processor(_Total)\% Processor Time" />
</Counters>
</Add>
...
</TelemetryModules>
Upvotes: 2