我已经设置了一个带有大量性能计数器
我的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>
感谢。
答案 0 :(得分:2)
如果该部署的BLOB存储中的wad-control-container中已存在文件,则角色和实例将优先。这样,如果您在系统外部修改该文件,则角色的回收不会丢失设置。
“如果已有XML配置,则忽略.wadcfg文件 在wad-control-container blob存储容器中。“
优先顺序可以在http://msdn.microsoft.com/en-us/library/windowsazure/dn205146.aspx找到。
我的理解是,通过在解决方案中包含wadcfg文件,诊断子系统会选择该文件并将其用作默认值。然后,如果那里没有文件,则将该文件的副本放在wad-control-container中。
另外需要注意的是,您共享了配置该性能计数器的代码,但是您是否已通过该配置?您是否可以针对处理诊断配置的任何代码行发布更多OnStart?