I am trying to create some custom performance counters within an azure worker role and web role. The web role is correctly collecting and transferring the performance counter data across from the azure VM to the diagnostics table storage, however the worker role is failing. Logging onto the VM and checking the event logs I am seeing the following exceptions:
Source: perflib
Event ID: 1010
The Collect Procedure for the "D:\Windows\System32\winspool.drv" service in DLL "Spooler" generated an exception or returned an invalid status. The performance data returned by the counter DLL will not be returned in the Perf Data Block. The first four bytes (DWORD) of the Data section contains the exception code or status code.
Source: perflib
Event ID: 1008
The Open Procedure for service "BITS" in DLL "D:\Windows\System32\bitsperf.dll" failed. Performance data for this service will not be available. The first four bytes (DWORD) of the Data section contains the error code.
Source: perflib
Event ID: 1023
Windows cannot load the extensible counter DLL ASP.NET_2.0.50727. The first four bytes (DWORD) of the Data section contains the Windows error code.
The diagnostics.wadcfg looks as follows:
<PerformanceCounters bufferQuotaInMB="2048" scheduledTransferPeriod="PT5M">
<PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT30S" />
<PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\Memory\Page Faults/sec" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\Process(WAWorkerHost)\Private Bytes" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\.NET CLR Memory(WAWorkerHost)\# Bytes in all Heaps" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\.NET CLR Memory(WAWorkerHost)\% Time in GC" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\Process(WAWorkerHost)\Thread Count" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\.NET CLR LocksAndThreads(WAWorkerHost)\# of current logical Threads" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\.NET CLR LocksAndThreads(WAWorkerHost)\# of current physical Threads" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\.NET CLR LocksAndThreads(WAWorkerHost)\# of current recognized threads" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\.NET CLR LocksAndThreads(WAWorkerHost)\Current Queue Length" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\Network Interface(*)\Bytes Received/sec" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\Network Interface(*)\Bytes Sent/sec" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\.NET CLR Exceptions(WAWorkerHost)\# of Exceps Thrown / sec" sampleRate="PT30S" />
<!--If I comment out the following two out of the box counters, it works in the azure emulator-->
<PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk(_Total)\Avg. Disk Write Queue Length" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk(_Total)\Avg. Disk Read Queue Length" sampleRate="PT1M" />-->
<PerformanceCounterConfiguration counterSpecifier="\Product\Add Product Forward Recommendation Overall Duration_AverageTimer32" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier="\Product\Add Recommendations Product Handler Duration_AverageTimer32" sampleRate="PT1M" />
</PerformanceCounters>
The out of box performance counters are transferring, just the custom ones causing issue.
I have the performance counters creating during 'Startup', and as noted above, locally if I comment out the two PhysicalDisk counters I see my custom counters working (just not in azure).
Any help is greatly appreciated.
Thanks Dan
In the navigation pane, expand Monitoring Tools, and then choose Performance Monitor. In the console pane toolbar, choose the Add button. In the Add Counters window, in the Select counters from computer drop-down list, choose the computer that is running Business Central Server.
Adding Default Counters First, in your Azure Portal Log Analytics workspace, go to advanced settings, Data, Windows Performance Counters. Note you can do the same for Linux, but this example covers Windows. Click add to add the default suggested counters.
NET CLR JIT category includes counters that provide information about code that has been JIT-compiled. The following table describes these performance counters. Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started.
So the issue was I was running the code to setup the performance counters during 'Startup' however what I did not quite realise is that this code is isolated from the actual web/worker role that is running after startup. Therefore, when your web/worker role is then started, for example in the global.asax, you will need to initialise your performance counters again here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With