开发者

Unable to capture Performance Counters for an Azure Web Role

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 t开发者_开发百科he azure cloud? Can anyone point out what could I be doing wrong here?

Kapil


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


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


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜