Danjuro
Danjuro

Reputation: 215

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

Upvotes: 7

Views: 1755

Answers (1)

Danjuro
Danjuro

Reputation: 215

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.

Upvotes: 3

Related Questions