Browse Source

Improve GC health check.

pull/883/head
Sebastian 4 years ago
parent
commit
8d92d15299
  1. 10
      backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs

10
backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs

@ -5,9 +5,9 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using System.Diagnostics;
using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System.Diagnostics;
namespace Squidex.Infrastructure.Diagnostics namespace Squidex.Infrastructure.Diagnostics
{ {
@ -25,13 +25,17 @@ namespace Squidex.Infrastructure.Diagnostics
{ {
var workingSet = Process.GetCurrentProcess().WorkingSet64; var workingSet = Process.GetCurrentProcess().WorkingSet64;
var heapSize = GC.GetTotalMemory(false);
var data = new Dictionary<string, object> var data = new Dictionary<string, object>
{ {
{ "HeapSize", GC.GetTotalMemory(false) },
{ "Gen0CollectionCount", GC.CollectionCount(0) }, { "Gen0CollectionCount", GC.CollectionCount(0) },
{ "Gen1CollectionCount", GC.CollectionCount(1) }, { "Gen1CollectionCount", GC.CollectionCount(1) },
{ "Gen2CollectionCount", GC.CollectionCount(2) }, { "Gen2CollectionCount", GC.CollectionCount(2) },
{ "WorkingSet", workingSet.ToReadableSize() } { "HeapSizeBytes", heapSize },
{ "HeapSizeString", heapSize.ToReadableSize() },
{ "WorkingSetBytes", workingSet },
{ "WorkingSetString", workingSet.ToReadableSize() }
}; };
var status = workingSet < threshold ? var status = workingSet < threshold ?

Loading…
Cancel
Save