예제 #1
0
        /// <summary />
        /// <param name="seriesCountLimit"></param>
        /// <param name="valuesPerDimensionLimit"></param>
        /// <param name="seriesConfig"></param>
        public MetricConfiguration(
            int seriesCountLimit,
            int valuesPerDimensionLimit,
            IMetricSeriesConfiguration seriesConfig)
        {
            if (seriesCountLimit < 1)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(seriesCountLimit),
                          $"Metrics must allow at least one data series (but {seriesCountLimit} was specified).");
            }

            if (valuesPerDimensionLimit < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(valuesPerDimensionLimit));
            }

            Util.ValidateNotNull(seriesConfig, nameof(seriesConfig));

            SeriesCountLimit        = seriesCountLimit;
            ValuesPerDimensionLimit = valuesPerDimensionLimit;

            SeriesConfig = seriesConfig;

            _hashCode = Util.CombineHashCodes(
                SeriesCountLimit.GetHashCode(),
                ValuesPerDimensionLimit.GetHashCode(),
                SeriesConfig.GetType().FullName.GetHashCode(),
                SeriesConfig.GetHashCode());
        }
예제 #2
0
        public SimpleUInt32DataSeriesAggregator(IMetricSeriesConfiguration configuration, MetricSeries dataSeries, MetricAggregationCycleKind aggregationCycleKind)
            : base(configuration, dataSeries, aggregationCycleKind)
        {
            Util.ValidateNotNull(configuration, nameof(configuration));

            SimpleMetricSeriesConfiguration simpleSeriesConfig = configuration as SimpleMetricSeriesConfiguration;

            if (simpleSeriesConfig == null)
            {
                throw new ArgumentException(
                          $"{nameof(SimpleUInt32DataSeriesAggregator)} expects a configuration of type {nameof(SimpleMetricSeriesConfiguration)},"
                          + $" however the specified configuration is {configuration?.GetType()?.FullName ?? Util.NullString}.",
                          nameof(configuration));
            }

            if (false == simpleSeriesConfig.RestrictToUInt32Values)
            {
                throw new ArgumentException(
                          $"{nameof(SimpleUInt32DataSeriesAggregator)} expects a configuration of type {nameof(SimpleMetricSeriesConfiguration)}"
                          + $" where 'RestrictToUInt32Values' is TRUE, however it is False.",
                          nameof(configuration));
            }
        }