This topic has not yet been rated - Rate this topic

PerformanceCounterConfiguration.CounterSpecifier Property

Gets or sets a performance counter specifier using Windows performance counter syntax.

Namespace: Microsoft.WindowsAzure.Diagnostics
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)
'Usage
Dim instance As PerformanceCounterConfiguration
Dim value As String

value = instance.CounterSpecifier

instance.CounterSpecifier = value
public string CounterSpecifier { get; set; }
/** @property */
/** @attribute CompilerGeneratedAttribute() */ 
public String get_CounterSpecifier ()

/** @property */
/** @attribute CompilerGeneratedAttribute() */ 
public void set_CounterSpecifier (String value)

CompilerGeneratedAttribute 
public function get CounterSpecifier () : String

CompilerGeneratedAttribute 
public function set CounterSpecifier (value : String)

Property Value

Type: System.String

Returns String.

The CounterSpecifier property indicates the performance counter you want to monitor. See Specifying a Counter Path for more information on performance counters.

Performance counters will be transferred to the WADPerformanceCounters table in persistent storage at the specified interval.

Example

The following code sample creates new PerformanceCounterConfiguration objects for ASP.NET performance monitoring. For more information on performance counters in ASP.NET, see Performance Counters for ASP.NET

public override bool OnStart()
{
    // Get the default initial configuration for DiagnosticMonitor.
    DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();

    // Use 30 seconds for the performance counter sample rate.
    TimeSpan perfSampleRate = TimeSpan.FromSeconds(30.0);

    // Add a performance counter for monitoring queued requests.
    diagnosticConfiguration.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
    {
        CounterSpecifier = @"\ASP.NET\Requests Queued",
        SampleRate = perfSampleRate
    });

    // Add a performance counter for request wait time.
    diagnosticConfiguration.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
    {
        CounterSpecifier = @"\ASP.NET\Request Wait Time",
        SampleRate = perfSampleRate
    });

    // Add a performance counter for requests per second.
    diagnosticConfiguration.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
    {
        CounterSpecifier = @"\ASP.NET\Requests/Sec",
        SampleRate = perfSampleRate
    });

    // Transfer the counters every 30 minutes.
    diagnosticConfiguration.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);

    // Start the DiagnosticMonitor using the diagnosticConfig and our connection string.
    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfiguration);

    return base.OnStart();
}


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 and Windows Server 2008

Target Platforms

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ