PerformanceCountersBufferConfiguration.DataSources Property
Gets a list of configurations for performance counters that are being collected.
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)
Property Value
Type: System.Collections.Generic.IList<PerformanceCounterConfiguration>Type: System.Collections.Generic.IList
Returns IList<T>.
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. |
