public ActionResult Exceptions(string log, ExceptionSorts? sort = null, int? count = null) { // Defaults count = count ?? 250; sort = sort ?? ExceptionSorts.TimeDesc; var vd = GetExceptionsModel(log, sort.Value, count.Value, loadAsync: 500); return View(vd); }
public ExceptionsModel GetExceptionsModel(string log, ExceptionSorts sort, int? count = null, Guid? prevLast = null, int? loadAsync = null) { var errors = ExceptionStores.GetAllErrors(log, sort: sort); var startIndex = 0; if (prevLast.HasValue) { startIndex = errors.FindIndex(e => e.GUID == prevLast.Value); if (startIndex > 0 && startIndex < errors.Count) startIndex++; } errors = errors.Skip(startIndex).Take(count ?? 500).ToList(); var vd = new ExceptionsModel { Sort = sort, SelectedLog = log, LoadAsyncSize = loadAsync.GetValueOrDefault(), Applications = ExceptionStores.Applications, Errors = errors.ToList() }; return vd; }
public ActionResult ExceptionsSimilar(string log, Guid id, ExceptionSorts? sort = null, bool truncate = true, bool byTime = false) { // Defaults sort = sort ?? ExceptionSorts.TimeDesc; log = GetLogName(log); var e = ExceptionStores.GetError(log, id); if (e == null) return View("Exceptions.Detail", null); var errors = ExceptionStores.GetSimilarErrors(e, byTime, sort: sort.Value); var vd = new ExceptionsModel { Sort = sort.Value, Exception = e, SelectedLog = log, ShowingWindow = byTime, Applications = ExceptionStores.Applications, ClearLinkForVisibleOnly = true, Errors = errors }; return View("Exceptions.Similar", vd); }
public async Task <ExceptionsModel> GetExceptionsModel(string group, string log, ExceptionSorts sort, int?count = null, Guid?prevLast = null, int?loadAsync = null) { FixNames(ref group, ref log); var errors = await GetAllErrors(group, log, sort : sort).ConfigureAwait(false); var startIndex = 0; if (prevLast.HasValue) { startIndex = errors.FindIndex(e => e.GUID == prevLast.Value); if (startIndex > 0 && startIndex < errors.Count) { startIndex++; } } errors = errors.Skip(startIndex).Take(count ?? 500).ToList(); var vd = new ExceptionsModel { Sort = sort, SelectedGroup = group, SelectedLog = log, LoadAsyncSize = loadAsync.GetValueOrDefault(), Groups = ApplicationGroups, Errors = errors.ToList() }; return(vd); }
public async Task <ActionResult> LoadMore(string group, string log, ExceptionSorts sort, int?count = null, Guid?prevLast = null) { var vd = await GetExceptionsModel(group, log, sort, count, prevLast).ConfigureAwait(false); return(View("Exceptions.Table.Rows", vd)); }
public static List <Error> FindErrors(string searchText, string appName = null, int max = 200, bool includeDeleted = false, ExceptionSorts sort = ExceptionSorts.TimeDesc) { if (searchText.IsNullOrEmpty()) { return(new List <Error>()); } var stores = appName.HasValue() ? GetStores(appName) : Stores; var results = stores.SelectMany(s => s.FindErrors(searchText, appName, max, includeDeleted)); return(GetSorted(results, sort).ToList()); }
public static List <Error> GetSimilarErrors(Error error, bool byTime = false, int max = 200, ExceptionSorts sort = ExceptionSorts.TimeDesc) { if (error == null) { return(new List <Error>()); } var similarErrors = GetStores(error.ApplicationName).SelectMany(s => byTime ? s.GetSimilarErrorsInTime(error, max) : s.GetSimilarErrors(error, max)); return(GetSorted(similarErrors, sort).ToList()); }
public static List <Error> GetAllErrors(string appName = null, int maxPerApp = 5000, ExceptionSorts sort = ExceptionSorts.TimeDesc) { using (MiniProfiler.Current.Step("GetAllErrors() - All Stores" + (appName.HasValue() ? " (app:" + appName + ")" : ""))) { var allErrors = Stores.SelectMany(s => s.GetErrorSummary(maxPerApp, appName)); return(GetSorted(allErrors, sort).ToList()); } }
public ActionResult ExceptionsLoadMore(string log, ExceptionSorts sort, int? count = null, Guid? prevLast = null) { var vd = GetExceptionsModel(log, sort, count, prevLast); return View("Exceptions.Table.Rows", vd); }
public ActionResult ExceptionsSearch(string q, string log, ExceptionSorts? sort = null, bool showDeleted = false) { // Defaults sort = sort ?? ExceptionSorts.TimeDesc; log = GetLogName(log); // empty searches go back to the main log if (q.IsNullOrEmpty()) return RedirectToAction("Exceptions", new { log }); var errors = ExceptionStores.FindErrors(q, log, includeDeleted: showDeleted, max: 2000, sort: sort.Value); if (!errors.Any() && !showDeleted) { // If we didn't find any current errors, go ahead and search deleted as well return RedirectToAction("ExceptionsSearch", new { q, log, showDeleted = true }); } var vd = new ExceptionsModel { Sort = sort.Value, Search = q, SelectedLog = log, ShowDeleted = showDeleted, Applications = ExceptionStores.Applications, ClearLinkForVisibleOnly = true, Errors = errors }; return View("Exceptions.Search", vd); }
public ActionResult ExceptionsLoadMore(string log, ExceptionSorts sort, int?count = null, Guid?prevLast = null) { var vd = GetExceptionsModel(log, sort, count, prevLast); return(View("Exceptions.Table.Rows", vd)); }
public static async Task <List <Error> > FindErrorsAsync(string searchText, string group = null, string app = null, int max = 200, bool includeDeleted = false, ExceptionSorts sort = ExceptionSorts.TimeDesc) { if (searchText.IsNullOrEmpty()) { return(new List <Error>()); } var stores = app.HasValue() ? GetStores(app) : Stores; // Apps are across stores, group doesn't matter here var errorFetches = stores.Select(s => s.FindErrorsAsync(searchText, max, includeDeleted, GetAppNames(group, app))); var results = (await Task.WhenAll(errorFetches).ConfigureAwait(false)).SelectMany(e => e); return(GetSorted(results, sort).ToList()); }
public static async Task <List <Error> > GetSimilarErrorsAsync(Error error, bool byTime = false, int max = 200, ExceptionSorts sort = ExceptionSorts.TimeDesc) { if (error == null) { return(new List <Error>()); } var errorFetches = GetStores(error.ApplicationName).Select(s => byTime ? s.GetSimilarErrorsInTimeAsync(error, max) : s.GetSimilarErrorsAsync(error, max)); var similarErrors = (await Task.WhenAll(errorFetches).ConfigureAwait(false)).SelectMany(e => e); return(GetSorted(similarErrors, sort).ToList()); }
public static async Task <List <Error> > GetAllErrors(string group = null, string app = null, int?maxPerApp = null, ExceptionSorts sort = ExceptionSorts.TimeDesc) { using (MiniProfiler.Current.Step("GetAllErrors() - All Stores" + (group.HasValue() ? " (group:" + group + ")" : "") + (app.HasValue() ? " (app:" + app + ")" : ""))) { maxPerApp = maxPerApp ?? Current.Settings.Exceptions.PerAppCacheCount; var stores = ExceptionsModule.Stores; IEnumerable <Error> allErrors; if (stores.Count == 1) { allErrors = await stores[0].GetErrorSummary(maxPerApp.Value, group, app).ConfigureAwait(false); } else { var tasks = stores.Select(s => s.GetErrorSummary(maxPerApp.Value, group, app)); var taskResults = await Task.WhenAll(tasks).ConfigureAwait(false); var combined = new List <Error>(); foreach (var r in taskResults) { combined.AddRange(r); } allErrors = combined; } return(GetSorted(allErrors, sort).ToList()); } }