private static void AddMetric <TTelemetry>(
            CalculatedMetricInfo metricInfo,
            List <CalculatedMetric <TTelemetry> > metrics,
            out CollectionConfigurationError[] errors)
        {
            errors = new CollectionConfigurationError[] { };

            try
            {
                metrics.Add(new CalculatedMetric <TTelemetry>(metricInfo, out errors));
            }
            catch (Exception e)
            {
                // error creating the metric
                errors =
                    errors.Concat(
                        new[]
                {
                    CollectionConfigurationError.CreateError(
                        CollectionConfigurationErrorType.MetricFailureToCreate,
                        string.Format(CultureInfo.InvariantCulture, "Failed to create metric {0}.", metricInfo),
                        e,
                        Tuple.Create("MetricId", metricInfo.Id))
                }).ToArray();
            }
        }
        public CalculatedMetric(CalculatedMetricInfo info, out CollectionConfigurationError[] errors)
        {
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            this.info = info;

            this.CreateFilters(out errors);

            this.CreateProjection();
        }