Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Worker Role Custom Performance Counters

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

like image 850
Danjuro Avatar asked Jan 12 '15 20:01

Danjuro


People also ask

How do I add a performance counter in perfmon?

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.

How do I add a performance counter in log analytics?

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.

What is .NET CLR JIT performance 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.


1 Answers

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.

like image 108
Danjuro Avatar answered Nov 11 '22 18:11

Danjuro