private bool TryUpdateEntity(string functionId, Action<FunctionStatistics> modifier) { IConcurrentDocument<FunctionStatistics> result = _store.Read(functionId); if (result == null || result.Document == null) { FunctionStatistics statistics = new FunctionStatistics(); modifier.Invoke(statistics); return _store.TryCreate(functionId, statistics); } else { FunctionStatistics statistics = result.Document; modifier.Invoke(statistics); return _store.TryUpdate(functionId, result.ETag, statistics); } }
private bool TryUpdateEntity(string functionId, Action <FunctionStatistics> modifier) { IConcurrentDocument <FunctionStatistics> result = _store.Read(functionId); if (result == null || result.Document == null) { FunctionStatistics statistics = new FunctionStatistics(); modifier.Invoke(statistics); return(_store.TryCreate(functionId, statistics)); } else { FunctionStatistics statistics = result.Document; modifier.Invoke(statistics); return(_store.TryUpdate(functionId, result.ETag, statistics)); } }
private async Task<FunctionStatistics> LookupAsync(string functionId) { var total = new FunctionStatistics { }; // summarize over last 7 days. DateTime now = DateTime.UtcNow; DateTime start = now.AddDays(-7); var segment = await _reader.GetAggregateStatsAsync(functionId, start, now, null); var items = segment.Results; foreach (var item in items) { total.SucceededCount += item.TotalPass; total.FailedCount += item.TotalFail; } return total; }
private async Task <FunctionStatistics> LookupAsync(FunctionId functionId) { var total = new FunctionStatistics { }; // summarize over last 7 days. DateTime now = DateTime.UtcNow; DateTime start = now.AddDays(-7); var segment = await _reader.GetAggregateStatsAsync(functionId, start, now, null); var items = segment.Results; foreach (var item in items) { total.SucceededCount += item.TotalPass; total.FailedCount += item.TotalFail; } return(total); }