Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend Modifying the Windows Azure Diagnostics Configuration

Modifying the Windows Azure Diagnostics Configuration

These two applications can also be used to demonstrate how to revise the diagnostic configuration. Suppose we want to add a performance counter to our diagnostic configuration. The OnDemandDiagnosticTransfer application is set up to make that technique easy to demonstrate. Select the Performance Counter you want to add, along with the sample rate. When the Tickets application is running, click the Add Performance Counter button. Then click the Transfer Data button to do an on-demand transfer. You'll see both the Working Set counter and the Performance Counter you selected in Azure storage. To view the information, you would use the same procedure demonstrated in Video 2.

The following code fragment illustrates how this is done:

IEnumerable<RoleInstanceDiagnosticManager> roleDiagnosticManagers =
                  diagnosticManager.GetRoleInstanceDiagnosticManagersForRole(roleName);
foreach (RoleInstanceDiagnosticManager roleInstanceDiagnosticManager
                                                                                                                in roleDiagnosticManagers)
{
     DiagnosticMonitorConfiguration diagnosticConfiguration =
                           roleInstanceDiagnosticManager.GetCurrentConfiguration();
        diagnosticConfiguration.PerformanceCounters.DataSources.
                                Add(performanceCounterConfiguration);
        roleInstanceDiagnosticManager.SetCurrentConfiguration(diagnosticConfiguration);
}
  • + Share This
  • 🔖 Save To Your Account