public MetricState(string name, JsonMetric jsonMetric) { Metric = jsonMetric; if (string.IsNullOrEmpty(Metric.Group)) { Dimensions = new string[] { }; } else { Dimensions = Metric.Group.Split(','); } Aggregates = new Dictionary <string, Aggregate>(); Total = AggregateFactory.Default.Get(Metric); AsOf = MetricState.PeriodTime(Metric.Period); }
public MetricState LoadState() { while (RedisClient.Current.Database == null) { Thread.Sleep(10); } var state = GetState(MetricState.PeriodTime(Metric.Period)); if (state != null) { return(state); } else { return(new MetricState(Name, Metric)); } }
public string StateKey() { return(string.Format("{0}|{1}", MetricSortedListKey, MetricState.PeriodTime(Metric.Period))); }