public static LatestAggregate GetLatestMetric(string category, string metricName) { IEnumerable <KeyValuePair <string, MetricAggregate> > list = LastAggregates .Where(x => x.Value.Category.Equals(category, StringComparison.OrdinalIgnoreCase) && x.Value.Name.Equals(metricName, StringComparison.OrdinalIgnoreCase)); foreach (KeyValuePair <string, MetricAggregate> item in list) { var findVal = item.Value; var agg = new LatestAggregate { Category = findVal.Category, Count = findVal.Count, MetricType = findVal.MetricType, MetricID = findVal.MonitorID, Name = findVal.Name, OccurredUtc = findVal.OccurredUtc, Value = findVal.Value }; return(agg); } return(null); }
public static LatestAggregate GetLatestMetric(string category, string metricName) { foreach (var item in _LastAggregates.Where(x => x.Value.Category.Equals(category, StringComparison.OrdinalIgnoreCase) && x.Value.Name.Equals(metricName, StringComparison.OrdinalIgnoreCase))) { var findVal = item.Value; LatestAggregate agg = new LatestAggregate(); agg.Count = findVal.Count; agg.MetricType = findVal.MetricType; agg.MetricID = findVal.MonitorID; agg.Name = findVal.Name; agg.OccurredUtc = findVal.OccurredUtc; agg.Value = findVal.Value; agg.Count = findVal.Count; agg.Category = findVal.Category; return(agg); } return(null); }
public static List <LatestAggregate> GetLatestMetrics() { var latest = new List <LatestAggregate>(); foreach (var item in _LastAggregates) { var findVal = item.Value; LatestAggregate agg = new LatestAggregate(); agg.Count = findVal.Count; agg.MetricType = findVal.MetricType; agg.MetricID = findVal.MonitorID; agg.Name = findVal.Name; agg.OccurredUtc = findVal.OccurredUtc; agg.Value = findVal.Value; agg.Count = findVal.Count; agg.Category = findVal.Category; latest.Add(agg); } return(latest); }
public static List <LatestAggregate> GetLatestMetrics() { var latest = new List <LatestAggregate>(); foreach (KeyValuePair <string, MetricAggregate> item in LastAggregates) { var findVal = item.Value; var agg = new LatestAggregate { Category = findVal.Category, Count = findVal.Count, MetricType = findVal.MetricType, MetricID = findVal.MonitorID, Name = findVal.Name, OccurredUtc = findVal.OccurredUtc, Value = findVal.Value }; latest.Add(agg); } return(latest); }