无法捕获 Azure Web 角色的性能计数器

发布于 2024-09-26 03:57:08 字数 1411 浏览 4 评论 0原文

我正在尝试捕获 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);

如您所见,我将性能计数器的计划 xfer 周期设置为 1 分钟。

现在,我可以在开发结构上的 WADPerformanceCounters 表中获取这些计数器,但无法在天蓝色云上获取它们?谁能指出我在这里做错了什么?

卡皮尔

I am trying to capture the following PerformanceCounters on the Azure WebRole:

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"};

I have in my WebRole.cs the following code to enable capturing of these perf counters as this:

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

As you see, I am setting the scheduled xfer period of perf counters to 1 min.

Now, I am able to get these counters in the WADPerformanceCounters table on my dev fabric, but I am not able to get them on the azure cloud? Can anyone point out what could I be doing wrong here?

Kapil

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

粉红×色少女 2024-10-03 03:57:08

问题应该不在我正在查看的地方。解决这个问题非常简单,我删除了预先存在的部署并将我的 cspkg 文件作为新部署上传。性能计数器似乎是根据 wad-control-container blob 下的 xml 文件获取的。此 xml 文件是为每个部署创建的。我意识到在我的情况下 xml 文件没有得到更新,当我删除部署并创建新部署时,它采用了新值。

谢谢
卡皮尔

The problem supposedly was not at the places I was looking at. The fix for this was pretty simple, I deleted the pre-existing deployment and uploaded my cspkg file as a fresh deployment. It seems that th perf counters are picked up based on an xml file under the wad-control-container blob. This xml file is made for each deployment. I realized that the xml file was not getting updated in my case, and when I deleted the deployment and created a new deployment, it was taking the fresh value.

Thanks
Kapil

骑趴 2024-10-03 03:57:08

对诊断设置的任何更改仅在执行完整部署时更新,而不是在更新时更新。
为了执行完整部署,请转到“发布配置文件”、“设置”和“高级设置”,然后取消选中“部署更新”复选框。当您发布此内容时,这将是一个完整的部署。

此外,可以在不执行部署的情况下更新您的设置。
在服务器资源管理器中,转到 Windows Azure=>云服务=> =>生产=>您的辅助角色并右键单击它,单击“更新诊断设置”。这将获取实际部署的当前诊断设置,您可以在此处更新它们,而无需执行任何部署。
当然,如果您想验证您的代码实际上是否以正确的方式设置,那么您将需要进行如上所述的完整部署,以测试您的代码,然后进行验证。

http://msdn.microsoft.com/library/azure/dn186185.aspx

Any changes to the diagnostic settings get updated only when a full deployment is performed and not on an update.
In order to perform a full deployment, go to the Publish Profile, and Settings, and Advanced Settings, and uncheck the checkbox for Deployment Update. When you publish this, it will be a full deployment.

Also, it is possible to update your settings without performing a deployment.
In Server Explorer, go to Windows Azure=> Cloud Services => => Production => Your worker role and right click on it, Click on Update Diagnostic Settings. This will fetch the actually deployed current Diagnostic settings, and you can update them here without performing any deployment.
Of course if you want to verify that your code is actually setting it the right way, then you will need to do a full deployment as mentioned above that will exercise your code and then verify.

http://msdn.microsoft.com/library/azure/dn186185.aspx

む无字情书 2024-10-03 03:57:08

由于您在 Dev Fabric 中获得了计数器,但在 Azure Fabric 中没有获得计数器,所以让我问一个显而易见的问题:您是否更改了 DiagnosticsConnectionString 设置以引用 Azure 存储连接字符串?

Since you're getting counters in Dev Fabric but not in Azure Fabric, let me ask the obvious: Did you change your DiagnosticsConnectionString setting to reference your Azure Storage connection string?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文