我已经设置了一个带有很多性能计数器(90+)的 diagnostics.wadcfg。但是,它没有反映在 wad-control-container blob 上。我还确保该文件位于BIN文件夹下。
我的 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>
谢谢。