2013-05-03 54 views
2

我已經設置了一個診斷程序.wadcfg,其中包含很多性能計數器(90+)。但是,它沒有反映在wad-control - 容器一滴。我還確保該文件位於BIN文件夾下。如何強制將diagnostics.wadcfg的內容反映在wad-control-container中

我webrole低於的OnStart代碼段():

// Get the diagnostic monitor for the specified role instance. 
RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = 
     new RoleInstanceDiagnosticManager(myStorageAccount, 
              "28281fc7754b44faa9ccf4911983edf1", 
              "MyWebRole", 
              "deployment(1).MyAzureProject.WebRole1.0"); 

// Get the current diagnostic monitor for the role. 
DiagnosticMonitorConfiguration currentConfiguration = roleInstanceDiagnosticManager.GetCurrentConfiguration(); 

// Use 30 seconds for the performance counter sample rate. 
TimeSpan perfSampleRate = TimeSpan.FromSeconds(30.0); 

// Add a performance counter for processor time to the current configuration. 
currentConfiguration.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration() 
{ 
     CounterSpecifier = @"\Processor(_Total)\% Processor Time", 
     SampleRate = perfSampleRate 
}); 

// Apply the modified configuration to the diagnostic monitor for the role instance. 
roleInstanceDiagnosticManager.SetCurrentConfiguration(currentConfiguration); 

是否有可能的OnStart()邏輯優先,並覆蓋上diagnostics.wadcfg我的內容?

我diagnostics.wadcfg以下文件:

<DiagnosticMonitorConfiguration 
    xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration" 
    configurationChangePollInterval="PT1M" 
    overallQuotaInMB="8192"> 

    <PerformanceCounters bufferQuotaInMB="100" scheduledTransferPeriod="PT1M"> 

    <!-- 1. AZURE_ASP_NET --> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Application Restarts" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Applications Running" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Request Execution Time" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Current" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Disconnected" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Queued" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Rejected" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Request Wait Time" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\State Server Sessions Abandoned" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\State Server Sessions Active" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\State Server Sessions Timed Out" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\State Server Sessions Total" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Worker Processes Running" sampleRate="PT30S" /> 
    <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Worker Process Restarts" sampleRate="PT30S" /> 

    </PerformanceCounters> 

</DiagnosticMonitorConfiguration> 

感謝。

回答

2

如果該部署的BLOB存儲中的wad-control-container中已存在文件,則角色和實例將優先。這樣,如果您要將該文件從外部修改爲系統,則該角色的回收不會丟失設置。

MSDN Documentation

「如果已經存在的WAD控制容器Blob存儲容器的XML配置 的.wadcfg文件將被忽略。」

優先順序可在http://msdn.microsoft.com/en-us/library/windowsazure/dn205146.aspx找到。

我的理解是,通過在您的解決方案中包含wadcfg文件,診斷子系統會選擇該文件並將其用作默認值。如果那裏沒有文件,則將該文件的副本放置在wad-control-container中。

需要注意的另一件事是您共享代碼來配置該性能計數器,但是您是否將該配置傳遞給該性能計數器?你可以發佈更多的OnStart用於處理診斷配置的任何代碼行嗎?

+0

感謝邁克,我已經更新了代碼。如果我從wad-control-container刪除xml,並且我的wadcfg文件只包含性能的東西。這是否意味着我的最終配置將只包含性能計數器或其他IIS,Eventlog等。真的有點混淆 – 2013-05-03 14:11:14

+0

我的理解是,wadcfg變成了配置,所以如果它不在那裏,它不會被包含。我沒有測試過,但從聲明中它取代了默認值,我相信會發生什麼。 – MikeWo 2013-05-04 12:15:09

+0

然後我和產品團隊中的某個人進行了覈實,我指出的文檔中指出的優先級沒有改變。他們正在更新文檔以添加更多信息。 – MikeWo 2013-05-04 12:16:03

相關問題