Ejemplo n.º 1
0
        public void CreateAggregateUnsafe()
        {
            var aggregationManager = new MetricAggregationManager();
            var seriesConfig       = new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: true);

            IEnumerable <KeyValuePair <string, string> > setDimensionNamesValues = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("Dim 1", "DV1"),
                                                                                                                         new KeyValuePair <string, string>("Dim 2", "DV2"),
                                                                                                                         new KeyValuePair <string, string>("Dim 3", "DV3"),
                                                                                                                         new KeyValuePair <string, string>("Dim 2", "DV2a") };

            IEnumerable <KeyValuePair <string, string> > expectedDimensionNamesValues = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("Dim 1", "DV1"),
                                                                                                                              new KeyValuePair <string, string>("Dim 2", "DV2a"),
                                                                                                                              new KeyValuePair <string, string>("Dim 3", "DV3") };

            var metric = new MetricSeries(
                aggregationManager,
                new MetricIdentifier(String.Empty, "Cows Sold", expectedDimensionNamesValues.Select(nv => nv.Key).ToArray()),
                setDimensionNamesValues,
                seriesConfig);

            var aggregator = new MeasurementAggregator(
                (MetricSeriesConfigurationForMeasurement)metric.GetConfiguration(),
                metric,
                CycleKind.Custom);

            CommonSimpleDataSeriesAggregatorTests.CreateAggregateUnsafe(aggregator, metric, expectedDimensionNamesValues);
        }
Ejemplo n.º 2
0
        public void TryRecycle()
        {
            var measurementAggregator = new MeasurementAggregator(
                new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: true),
                dataSeries: null,
                aggregationCycleKind: CycleKind.Custom);

            CommonSimpleDataSeriesAggregatorTests.TryRecycle_NonpersistentAggregator(measurementAggregator);
        }
Ejemplo n.º 3
0
        public void Reset()
        {
            {
                var aggregator = new MeasurementAggregator(
                    new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: true),
                    dataSeries: null,
                    aggregationCycleKind: CycleKind.Custom);

                CommonSimpleDataSeriesAggregatorTests.Reset_NonersistentAggregator(aggregator, aggregateKindMoniker: "Microsoft.Azure.Measurement");
            }
        }
Ejemplo n.º 4
0
        public void CompleteAggregation()
        {
            var aggregationManager = new MetricAggregationManager();

            var mesurementConfig  = new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: true);
            var measurementMetric = new MetricSeries(aggregationManager, new MetricIdentifier("Cows Sold"), null, mesurementConfig);

            var measurementAggregator = new MeasurementAggregator(
                (MetricSeriesConfigurationForMeasurement)measurementMetric.GetConfiguration(),
                measurementMetric,
                CycleKind.Custom);

            CommonSimpleDataSeriesAggregatorTests.CompleteAggregation_NonpersistentAggregator(measurementAggregator);
        }
        public void TryRecycle()
        {
            var measurementAggregator = new MeasurementAggregator(
                new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: false),
                dataSeries: null,
                aggregationCycleKind: CycleKind.Custom);

            var accumulatorAggregator = new MetricSeriesConfigurationForTestingAccumulatorBehavior.Aggregator(
                new MetricSeriesConfigurationForTestingAccumulatorBehavior(),
                dataSeries: null,
                aggregationCycleKind: CycleKind.Custom);


            CommonSimpleDataSeriesAggregatorTests.TryRecycle_NonpersistentAggregator(measurementAggregator);
            CommonSimpleDataSeriesAggregatorTests.TryRecycle_PersistentAggregator(accumulatorAggregator);
        }
Ejemplo n.º 6
0
        public void GetDataSeries()
        {
            var aggregationManager = new MetricAggregationManager();
            var seriesConfig       = new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: true);
            var metric             = new MetricSeries(aggregationManager, new MetricIdentifier("Cows Sold"), null, seriesConfig);

            var aggregatorForConcreteSeries = new MeasurementAggregator(
                (MetricSeriesConfigurationForMeasurement)metric.GetConfiguration(),
                dataSeries: metric,
                aggregationCycleKind: CycleKind.Custom);

            var aggregatorForNullSeries = new MeasurementAggregator(
                new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: true),
                dataSeries: null,
                aggregationCycleKind: CycleKind.Custom);

            CommonSimpleDataSeriesAggregatorTests.GetDataSeries(aggregatorForConcreteSeries, aggregatorForNullSeries, metric);
        }
        public void Reset()
        {
            {
                var aggregator = new MeasurementAggregator(
                    new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false),
                    dataSeries: null,
                    aggregationCycleKind: CycleKind.Custom);

                CommonSimpleDataSeriesAggregatorTests.Reset_NonersistentAggregator(aggregator, aggregateKindMoniker: "Microsoft.Azure.SimpleStatistics");
            }
            {
                var aggregator = new AccumulatorAggregator(
                    new AccumulatorMetricSeriesConfiguration(restrictToUInt32Values: false),
                    dataSeries: null,
                    aggregationCycleKind: CycleKind.Custom);

                CommonSimpleDataSeriesAggregatorTests.Reset_PersistentAggregator(aggregator, aggregateKindMoniker: "Microsoft.Azure.Accumulator");
            }
        }
        public void Reset()
        {
            {
                var aggregator = new MeasurementAggregator(
                    new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: false),
                    dataSeries: null,
                    aggregationCycleKind: CycleKind.Custom);

                CommonSimpleDataSeriesAggregatorTests.Reset_NonpersistentAggregator(aggregator, aggregateKindMoniker: "Microsoft.Azure.Measurement");
            }
            {
                var aggregator = new MetricSeriesConfigurationForTestingAccumulatorBehavior.Aggregator(
                    new MetricSeriesConfigurationForTestingAccumulatorBehavior(),
                    dataSeries: null,
                    aggregationCycleKind: CycleKind.Custom);

                CommonSimpleDataSeriesAggregatorTests.Reset_PersistentAggregator(aggregator, aggregateKindMoniker: "Microsoft.Azure.AccumulatorForTesting");
            }
        }
        public void CompleteAggregation()
        {
            var aggregationManager = new MetricAggregationManager();

            var mesurementConfig  = new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false);
            var measurementMetric = new MetricSeries(aggregationManager, "Cows Sold", null, mesurementConfig);

            var measurementAggregator = new MeasurementAggregator(
                (SimpleMetricSeriesConfiguration)measurementMetric.GetConfiguration(),
                measurementMetric,
                CycleKind.Custom);

            var accumulatorConfig = new AccumulatorMetricSeriesConfiguration(restrictToUInt32Values: false);
            var accumulatorMetric = new MetricSeries(aggregationManager, "Cows Sold", null, accumulatorConfig);

            var accumulatorAggregator = new AccumulatorAggregator(
                (AccumulatorMetricSeriesConfiguration)accumulatorMetric.GetConfiguration(),
                accumulatorMetric,
                CycleKind.Custom);

            CommonSimpleDataSeriesAggregatorTests.CompleteAggregation_NonpersistentAggregator(measurementAggregator);
            CommonSimpleDataSeriesAggregatorTests.CompleteAggregation_PersistentAggregator(accumulatorAggregator);
        }
        public void CreateAggregateUnsafe()
        {
            var aggregationManager = new MetricAggregationManager();
            var seriesConfig       = new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false);

            IEnumerable <KeyValuePair <string, string> > setDimensionNamesValues = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("Dim 1", "DV1"),
                                                                                                                         new KeyValuePair <string, string>("Dim 2", "DV2"),
                                                                                                                         new KeyValuePair <string, string>("Dim 3", "DV3"),
                                                                                                                         new KeyValuePair <string, string>("Dim 2", "DV2a") };

            IEnumerable <KeyValuePair <string, string> > expectedDimensionNamesValues = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("Dim 1", "DV1"),
                                                                                                                              new KeyValuePair <string, string>("Dim 2", "DV2a"),
                                                                                                                              new KeyValuePair <string, string>("Dim 3", "DV3") };

            var metric = new MetricSeries(aggregationManager, "Cows Sold", setDimensionNamesValues, seriesConfig);

            var aggregator = new MeasurementAggregator(
                (SimpleMetricSeriesConfiguration)metric.GetConfiguration(),
                metric,
                CycleKind.Custom);

            CommonSimpleDataSeriesAggregatorTests.CreateAggregateUnsafe(aggregator, metric, expectedDimensionNamesValues);
        }
        public void CompleteAggregation()
        {
            var aggregationManager = new MetricAggregationManager();

            var mesurementConfig  = new MetricSeriesConfigurationForMeasurement(restrictToUInt32Values: false);
            var measurementMetric = new MetricSeries(aggregationManager, new MetricIdentifier("Animal Metrics", "Cows Sold"), null, mesurementConfig);

            var measurementAggregator = new MeasurementAggregator(
                (MetricSeriesConfigurationForMeasurement)measurementMetric.GetConfiguration(),
                measurementMetric,
                CycleKind.Custom);

            var accumulatorConfig = new MetricSeriesConfigurationForTestingAccumulatorBehavior();
            var accumulatorMetric = new MetricSeries(aggregationManager, new MetricIdentifier("Animal Metrics", "Cows Sold"), null, accumulatorConfig);

            var accumulatorAggregator = new MetricSeriesConfigurationForTestingAccumulatorBehavior.Aggregator(
                (MetricSeriesConfigurationForTestingAccumulatorBehavior)accumulatorMetric.GetConfiguration(),
                accumulatorMetric,
                CycleKind.Custom);

            CommonSimpleDataSeriesAggregatorTests.CompleteAggregation_NonpersistentAggregator(measurementAggregator);
            CommonSimpleDataSeriesAggregatorTests.CompleteAggregation_PersistentAggregator(accumulatorAggregator);
        }