From 8d92d15299f08774acd25c1a5bddfbbf0e765c73 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 27 May 2022 14:46:59 +0200 Subject: [PATCH] Improve GC health check. --- .../Diagnostics/GCHealthCheck.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs b/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs index 7077b8de7..d66647fbe 100644 --- a/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs +++ b/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs @@ -5,9 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +using System.Diagnostics; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Options; -using System.Diagnostics; namespace Squidex.Infrastructure.Diagnostics { @@ -25,13 +25,17 @@ namespace Squidex.Infrastructure.Diagnostics { var workingSet = Process.GetCurrentProcess().WorkingSet64; + var heapSize = GC.GetTotalMemory(false); + var data = new Dictionary { - { "HeapSize", GC.GetTotalMemory(false) }, { "Gen0CollectionCount", GC.CollectionCount(0) }, { "Gen1CollectionCount", GC.CollectionCount(1) }, { "Gen2CollectionCount", GC.CollectionCount(2) }, - { "WorkingSet", workingSet.ToReadableSize() } + { "HeapSizeBytes", heapSize }, + { "HeapSizeString", heapSize.ToReadableSize() }, + { "WorkingSetBytes", workingSet }, + { "WorkingSetString", workingSet.ToReadableSize() } }; var status = workingSet < threshold ?