我正在尝试在 Azure WebRole 上捕获以下 PerformanceCounters:
private string[] perfCounters = { @"\Processor(_Total)\% Processor Time",
@"\ASP.NET Applications(__Total__)\Requests/Sec",
@"\Memory\Available Bytes",
@"\ASP.NET\Request Execution Time",
@"\ASP.NET\Requests Queued"};
我在我的 WebRole.cs 中有以下代码,可以像这样捕获这些性能计数器:
DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();
int loggingInterval = Int32.Parse(RoleEnvironment.GetConfigurationSettingValue("loggingInterval"));
config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(loggingInterval);
foreach (String s in perCounters)
{
PerformanceCounterConfiguration procTimeConfig = new PerformanceCounterConfiguration();
procTimeConfig.CounterSpecifier = s;
procTimeConfig.SampleRate = System.TimeSpan.FromMinutes(1.0);
config.PerformanceCounters.DataSources.Add(procTimeConfig);
}
config.PerformanceCounters.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1.0);
DiagnosticMonitor.Start("DiagnosticsConnectionString", config);
如您所见,我将 perf 计数器的预定 xfer 周期设置为 1 分钟。
现在,我可以在我的开发结构上的 WADPerformanceCounters 表中获取这些计数器,但我无法在天蓝色云上获取它们?谁能指出我在这里做错了什么?
卡皮尔