Esempio n. 1
0
        private static AggregatedValue ParseAggregatedValue(StoredCounter entry)
        {
            DateTime date = entry.Date;
            Dictionary <string, string> properties = entry.Props;
            AggregationKey  ak  = new AggregationKey(date, properties);
            AggregatedValue val = new AggregatedValue(ak);

            if (entry.Data.Sum != null)
            {
                val.AddResult(new AggregationOperationResult(AggregationType.Sum, entry.Data.Sum.Value));
            }
            if (entry.Data.Count != null)
            {
                val.AddResult(new AggregationOperationResult(AggregationType.Count, entry.Data.Count.Value));
            }
            if (entry.Data.Min != null)
            {
                val.AddResult(new AggregationOperationResult(AggregationType.Min, entry.Data.Min.Min()));
            }
            if (entry.Data.Max != null)
            {
                val.AddResult(new AggregationOperationResult(AggregationType.Max, entry.Data.Max.Max()));
            }
            if (entry.Data.Avg != null)
            {
                val.AddResult(new AggregationOperationResult(AggregationType.Avg, entry.Data.Avg.Average()));
            }
            if (entry.Data.RawValues != null)
            {
                val.AddRawValues(entry.Data.RawValues);
            }
            return(val);
        }
 private static AggregatedValue ParseAggregatedValue(StoredCounter entry)
 {
     DateTime date = entry.Date;
     Dictionary<string, string> properties = entry.Props;
     AggregationKey ak = new AggregationKey(date, properties);
     AggregatedValue val = new AggregatedValue(ak);
     if (entry.Data.Sum != null) val.AddResult(new AggregationOperationResult(AggregationType.Sum, entry.Data.Sum.Value));
     if (entry.Data.Count != null) val.AddResult(new AggregationOperationResult(AggregationType.Count, entry.Data.Count.Value));
     if (entry.Data.Min != null) val.AddResult(new AggregationOperationResult(AggregationType.Min, entry.Data.Min.Min()));
     if (entry.Data.Max != null) val.AddResult(new AggregationOperationResult(AggregationType.Max, entry.Data.Max.Max()));
     if (entry.Data.Avg != null) val.AddResult(new AggregationOperationResult(AggregationType.Avg, entry.Data.Avg.Average()));
     if (entry.Data.RawValues != null) val.AddRawValues(entry.Data.RawValues);
     return val;
 }