Partilhar via


PerformanceCountersBufferConfiguration.DataSources Property

 

Gets a list of configurations for performance counters that are being collected.

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

Syntax

public IList<PerformanceCounterConfiguration> DataSources { get; }
public:
property IList<PerformanceCounterConfiguration^>^ DataSources {
    IList<PerformanceCounterConfiguration^>^ get();
}
member DataSources : IList<PerformanceCounterConfiguration> with get
Public ReadOnly Property DataSources As IList(Of PerformanceCounterConfiguration)

Property Value

Type: System.Collections.Generic.IList<PerformanceCounterConfiguration>

Type: System.Collections.Generic.IList

Returns IList<T>.

Remarks

The DataSources collection stores the list of PerformanceCounterConfiguration objects for each performance counter in a role instance. This property is used when retrieving or adding a PerformanceCounterConfiguration object to PerformanceCounters for your diagnostic monitor configuration, as PerformanceCounters is of type PerformanceCountersBufferConfiguration.

The following code snippet creates a new PerformanceCounterConfiguration object and adds the specified configuration to a DiagnosticMonitorConfiguration object:

// 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 requests per second.
diagnosticConfiguration.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
{
    CounterSpecifier = @"\ASP.NET\Requests/Sec",
    SampleRate = perfSampleRate
});

Warning

This API is not supported in Azure SDK versions 2.5 and higher. Instead, use the diagnostics.wadcfg XML configuration file. For more information, see Collect Logging Data by Using Azure Diagnostics.

See Also

PerformanceCountersBufferConfiguration Class
Microsoft.WindowsAzure.Diagnostics Namespace

Return to top