Esempio n. 1
0
        /// <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();
        }
Esempio n. 2
0
        /// <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;
        }