public static SyntheticCountersReporter createDefaultReporter(Logger _log, ICounterSamplingConfiguration counterSamplingConfig) { string signalFxCategory = "SignalFX"; try { System.Diagnostics.CounterCreationDataCollection CounterDatas = new System.Diagnostics.CounterCreationDataCollection(); createCounterIfNotExist(signalFxCategory, "UsedMemory", "Total used memory", System.Diagnostics.PerformanceCounterType.NumberOfItems64, CounterDatas); if (CounterDatas.Count != 0) { System.Diagnostics.PerformanceCounterCategory.Create( signalFxCategory, "SignalFx synthetic counters.", System.Diagnostics.PerformanceCounterCategoryType.SingleInstance, CounterDatas); } } catch (Exception e) { _log.Info(e.ToString()); return null; } SyntheticCountersReporter reporter = new SyntheticCountersReporter(counterSamplingConfig); reporter._sfxCountersUpdateMethods.Add("UsedMemory", updateUsedMemoryCounter); return reporter; }
public static SyntheticCountersReporter createDefaultReporter(Logger _log, ICounterSamplingConfiguration counterSamplingConfig) { string signalFxCategory = "SignalFX"; try { System.Diagnostics.CounterCreationDataCollection CounterDatas = new System.Diagnostics.CounterCreationDataCollection(); createCounterIfNotExist(signalFxCategory, "UsedMemory", "Total used memory", System.Diagnostics.PerformanceCounterType.NumberOfItems64, CounterDatas); if (CounterDatas.Count != 0) { System.Diagnostics.PerformanceCounterCategory.Create( signalFxCategory, "SignalFx synthetic counters.", System.Diagnostics.PerformanceCounterCategoryType.SingleInstance, CounterDatas); } } catch (Exception e) { _log.Info(e.ToString()); return(null); } SyntheticCountersReporter reporter = new SyntheticCountersReporter(counterSamplingConfig); reporter._sfxCountersUpdateMethods.Add("UsedMemory", updateUsedMemoryCounter); return(reporter); }
/// <summary> /// Initializes a new instance of the MonitoringTaskFactory class. /// </summary> /// <param name="counterSamplingConfig"></param> public MonitoringTaskFactory(ICounterSamplingConfiguration counterSamplingConfig, IMetricPublishingConfiguration metricPublishingConfig) { if (null == counterSamplingConfig) { throw new ArgumentNullException("counterSamplingConfig"); } if (null == metricPublishingConfig) { throw new ArgumentNullException("metricPublishingConfig"); } _counterSamplingConfig = counterSamplingConfig; _counterPaths = counterSamplingConfig.DefinitionFilePaths .SelectMany(path => CounterFileParser.ReadCountersFromFile(path.Path)) .Union(_counterSamplingConfig.CounterNames.Select(name => name.Name.Trim())) .Distinct(StringComparer.CurrentCultureIgnoreCase) .ToList(); _metricPublishingConfig = metricPublishingConfig; }
public PerfCounterReporter(MetricsReport report, TimeSpan interval, ICounterSamplingConfiguration counterSamplingConfig) { _report = report; _counterSamplingConfig = counterSamplingConfig; _handler = new PdhPathHandler(); _healthStatus = new HealthStatus(); _timers = new ConcurrentDictionary <string, MetricInfo>(); _currentMetrics = new Dictionary <string, MetricInfo>(); _couunterReporters = new List <CounterReporter>(); this._reportScheduler = new ActionScheduler(); this._reportScheduler.Start(interval, t => RunReport(t)); this._timerScheduler = new ActionScheduler(); this._timerScheduler.Start(TimeSpan.FromSeconds(1), t => ReportMetrics()); }
public PerfCounterReporter(MetricsReport report, TimeSpan interval, ICounterSamplingConfiguration counterSamplingConfig) { _report = report; _counterSamplingConfig = counterSamplingConfig; _handler = new PdhPathHandler(); _healthStatus = new HealthStatus(); _timers = new ConcurrentDictionary<string, MetricInfo>(); _currentMetrics = new Dictionary<string, MetricInfo>(); _couunterReporters = new List<CounterReporter>(); this._reportScheduler = new ActionScheduler(); this._reportScheduler.Start(interval, t => RunReport(t)); this._timerScheduler = new ActionScheduler(); this._timerScheduler.Start(TimeSpan.FromSeconds(1), t => ReportMetrics()); }
/// <summary> /// Initializes a new instance of the MonitoringTaskFactory class. /// </summary> /// <param name="counterSamplingConfig"></param> public MonitoringTaskFactory(ICounterSamplingConfiguration counterSamplingConfig) { if (null == counterSamplingConfig) { throw new ArgumentNullException("counterSamplingConfig"); } _counterSamplingConfig = counterSamplingConfig; _counterFilters = counterSamplingConfig.Filters.Select(x => new CounterFilter { Expression = x.Expression }).ToList(); _counterPaths = counterSamplingConfig.DefinitionFilePaths .SelectMany(path => CounterFileParser.ReadCountersFromFile(path.Path)).Select(item => new CounterName { Name = item.Split('|')[0], MetricSuffix = item.Split('|')[1] }).ToList(); }
/// <summary> /// Initializes a new instance of the MonitoringTaskFactory class. /// </summary> /// <param name="counterSamplingConfig"></param> public MonitoringTaskFactory(ICounterSamplingConfiguration counterSamplingConfig, IMetricPublishingConfiguration metricPublishingConfig) { if (null == counterSamplingConfig) { throw new ArgumentNullException("counterSamplingConfig"); } if (null == metricPublishingConfig) { throw new ArgumentNullException("metricPublishingConfig"); } _counterSamplingConfig = counterSamplingConfig; _counterPaths = counterSamplingConfig.DefinitionFilePaths .SelectMany(path => CounterFileParser.ReadCountersFromFile(path.Path)) .Union(_counterSamplingConfig.CounterNames.Select(name => name.Name.Trim())) .Distinct(StringComparer.CurrentCultureIgnoreCase) .ToList(); _metricPublishingConfig = metricPublishingConfig; }
public SyntheticCountersReporter(ICounterSamplingConfiguration counterSamplingConfig) { _counterSamplingConfig = counterSamplingConfig; _sfxCountersUpdateMethods = new Dictionary<string, Update>(); }
public SyntheticCountersReporter(ICounterSamplingConfiguration counterSamplingConfig) { _counterSamplingConfig = counterSamplingConfig; _sfxCountersUpdateMethods = new Dictionary <string, Update>(); }