From 8e91f0274bfec5f38d1fd4158d33d0d61210ae9d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 31 May 2020 20:26:24 +0000 Subject: [PATCH] --- devdocs/todo.txt | 4 ++ .../Controllers/ServerMetricsController.cs | 37 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index ebd84387..76b60ddf 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -8,6 +8,10 @@ todo: enable response compression todo: tag refcount Move this into a procedure, it's apparently quite slow now that I can see the metrics + + +todo: I might be using List<> too much when I should be using IEnumerable instead + read this: https://www.claudiobernasconi.ch/2013/07/22/when-to-use-ienumerable-icollection-ilist-and-list/ TODO: Why is this adding UTC bit to this query check the source code maybe something is up Schema settings mean that pg will ignore any tz specification so in theory it's ignored, but... diff --git a/server/AyaNova/Controllers/ServerMetricsController.cs b/server/AyaNova/Controllers/ServerMetricsController.cs index d8e55d1a..82cdf3f5 100644 --- a/server/AyaNova/Controllers/ServerMetricsController.cs +++ b/server/AyaNova/Controllers/ServerMetricsController.cs @@ -66,10 +66,45 @@ namespace AyaNova.Api.Controllers await Task.Delay(1500); //await Task.CompletedTask; } - + //MiniProfiler.Current.RenderPlainText() return Content(MiniProfiler.Current.RenderPlainText()); + + /* + https://github.com/MiniProfiler/dotnet/blob/95eddc7d57cee9f377419733bf18e76f3e5879e5/src/MiniProfiler/MiniProfilerHandler.cs + + private string ResultsList(HttpContext context) + { + if (!AuthorizeRequest(context, isList: true, message: out string message)) + { + return message; + } + var guids = Options.Storage.List(100); + var lastId = context.Request["last-id"]; + + if (!lastId.IsNullOrWhiteSpace() && Guid.TryParse(lastId, out var lastGuid)) + { + guids = guids.TakeWhile(g => g != lastGuid); + } + + return guids.Reverse() + .Select(g => Options.Storage.Load(g)) + .Where(p => p != null) + .Select(p => new + { + p.Id, + p.Name, + p.ClientTimings, + p.Started, + p.HasUserViewed, + p.MachineName, + p.User, + p.DurationMilliseconds + }).ToJson(); + } + */ + } ///