Azure Worker Custom Performance Counters

I am trying to create some custom performance counters in the azure work agent role and web role. The web role correctly collects and transfers performance counter data from the azure virtual machine to the diagnostic table repository, but the working role does not work. When logging into the virtual machine and checking the event logs, I see 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 .wadcfg diagnostics are 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> 

Out-of-box performance counters are passed, but only custom, causing the problem.

I have performance counters created during "Startup", and, as noted above, locally, if I comment on two PhysicalDisk counters, I can see that my user counters work (just not blue).

Any help is greatly appreciated.

Thanks Dan

+6
source share
1 answer

So, the problem was that I ran the code to set up the performance counters during the “run”, but I did not quite understand that this code is isolated from the actual web / worker role that was launched after the run. Therefore, when your web / worker role starts, for example, in global.asax, you need to initialize the performance counters again.

+2
source

Source: https://habr.com/ru/post/980888/


All Articles