Export (0) Print
Expand All

RoleInstanceDiagnosticManager.SetCurrentConfiguration Method

Updated: November 15, 2013

Sets the configuration for the diagnostic monitor.

Namespace: Microsoft.WindowsAzure.Diagnostics.Management
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)

public void SetCurrentConfiguration (
	DiagnosticMonitorConfiguration newConfiguration
)

Parameters

newConfiguration

Type: Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration

A DiagnosticMonitorConfiguration object representing the new configuration.

The SetCurrentConfiguration method is used to set a new configuration for the diagnostic monitor of a role instance. See DiagnosticMonitorConfiguration for more information.

Setting the current configuration while on-demand transfers are pending results in an error.

Example

The following code snippet gets the current diagnostic monitor configuration for a role instance, modifies it, and sets it.

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

See Also


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

Community Additions

ADD
Show:
© 2014 Microsoft