/// <summary> /// Select Seconds Of Type /// </summary> /// <param name="seconds">Seconds</param> /// <returns>Throughput</returns> public Throughput SelectSecondsOf(int seconds) { Contract.Requires <ArgumentOutOfRangeException>(0 < seconds); ////Don't Perf; too much logging var time = DateTime.UtcNow.AddSeconds(-1 * seconds); Throughput metrics = null; try { var results = from data in this.generalMetricTable.QueryByPartition(GeneralMetricRow.Partition()) where data.Time >= time select data; var list = results.ToList(); metrics = new Throughput() { ServerStatistics = list.Sum(m => m.ServerStatisticsCount), Messages = list.Sum(m => m.MessageCount), EventLog = list.Sum(m => m.EventLogCount), Exceptions = list.Sum(m => m.ErrorCount), Performance = list.Sum(m => m.PerformanceCount), }; } catch { ////Don't log, table misses are frequent } return(metrics ?? new Throughput()); }
public void PartitionKey() { Assert.AreEqual <string>(GeneralMetricRow.Partition(), new GeneralMetricRow().PartitionKey); }