Azure Worker角色自定义性能计数器

时间:2015-01-12 20:19:15

标签: azure performancecounter

我正在尝试在azure worker角色和Web角色中创建一些自定义性能计数器。 Web角色正在从azure VM正确地收集和传输性能计数器数据到诊断表存储,但是worker角色失败。登录到VM并检查事件日志我看到以下例外情况:

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.

diagnostics.wadcfg如下所示:

<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>

开箱即用的性能计数器正在转移,只是导致问题的自定义计数器。

我在&#39; Startup&#39;期间创建了性能计数器,如上所述,本地如果我注释掉两个PhysicalDisk计数器,我看到我的自定义计数器工作(只是在天蓝色)。

非常感谢任何帮助。

由于 丹

1 个答案:

答案 0 :(得分:3)

所以问题是我在“启动”期间运行代码来设置性能计数器,但是我没有意识到这个代码与启动后运行的实际web / worker角色是隔离的。因此,当您的web / worker角色随后启动时,例如在global.asax中,您需要在此处再次初始化您的性能计数器。