コード例 #1
0
        public MetricCollector(IEnumerable <MetricConfigurationElement> metrics)
        {
            var metricDefinitionFactory = new MetricDefinitionFactory();
            var metricSourceFactory     = new MetricSourceFactory(metricDefinitionFactory);

            foreach (var metric in metrics)
            {
                var metricSource = metricSourceFactory.CreateMetricSource(metric);
                if (metricSource == null)
                {
                    log.Warn("could not create metric source for '{0}:{1}'", metric.Type, metric.Path);
                    continue;
                } // if

                log.Info("created metric source for '{0}:{1}' with aggregation strategy '{2}'", metric.Type, metric.Name, metric.AggregationStrategy);
                metricSources.Add(metricSource);

                foreach (var metricDefinition in metricSource.GetMetricDefinitions())
                {
                    log.Info("created metric definition '{0}' with aggregation strategy '{1}'", metricDefinition.Name, metricDefinition.AggregationStrategy);
                }
            } // foreach
        }
コード例 #2
0
 public MetricSourceFactory(MetricDefinitionFactory metricDefinitionFactory)
 {
     this.metricDefinitionFactory = metricDefinitionFactory;
 }