From af6db3d3e81844c180a92a85cce9dcfbd56f3648 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Fri, 9 Nov 2018 20:42:37 +0100 Subject: [PATCH] Added health options. --- .../Diagnostics/HealthCheckResult.cs | 6 +++--- .../Diagnostics/HealthCheckMiddleware.cs | 2 +- src/Squidex/appsettings.json | 17 +++++++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Squidex.Infrastructure/Diagnostics/HealthCheckResult.cs b/src/Squidex.Infrastructure/Diagnostics/HealthCheckResult.cs index f396a5a8e..05a9c6817 100644 --- a/src/Squidex.Infrastructure/Diagnostics/HealthCheckResult.cs +++ b/src/Squidex.Infrastructure/Diagnostics/HealthCheckResult.cs @@ -11,15 +11,15 @@ namespace Squidex.Infrastructure.Diagnostics { public sealed class HealthCheckResult { - public bool IsValid { get; } + public bool IsHealthy { get; } public string Description { get; } public Dictionary Data { get; } - public HealthCheckResult(bool isValid, string description = null, Dictionary data = null) + public HealthCheckResult(bool isHealthy, string description = null, Dictionary data = null) { - IsValid = isValid; + IsHealthy = isHealthy; Data = data; Description = description; } diff --git a/src/Squidex/Pipeline/Diagnostics/HealthCheckMiddleware.cs b/src/Squidex/Pipeline/Diagnostics/HealthCheckMiddleware.cs index a7e229164..2589612e6 100644 --- a/src/Squidex/Pipeline/Diagnostics/HealthCheckMiddleware.cs +++ b/src/Squidex/Pipeline/Diagnostics/HealthCheckMiddleware.cs @@ -43,7 +43,7 @@ namespace Squidex.Pipeline.Diagnostics context.Response.StatusCode = 200; context.Response.Headers.Add("content-type", "application/json"); - if (checks.Any(x => !x.Result.IsValid)) + if (checks.Any(x => !x.Result.IsHealthy)) { context.Response.StatusCode = 503; } diff --git a/src/Squidex/appsettings.json b/src/Squidex/appsettings.json index 50a70a503..4f7fd5555 100644 --- a/src/Squidex/appsettings.json +++ b/src/Squidex/appsettings.json @@ -49,19 +49,28 @@ } }, + "healthz": { + "gc": { + /* + * The maximum number of megabyte that the process can consume until it is marked as not healthy. + */ + "threshold": 4096 + } + }, + "contentsController": { /* * Enable surrogate keys as headers. * * Nginx Has problems with long headers. It might make sense to disable this feature if you do not use a CDN. */ - "enableSurrogateKeys": true, + "enableSurrogateKeys": true, - /* + /* * Restrict the surrogate keys to results that have less than 200 items. */ - "maxItemsForSurrogateKeys": 200 - }, + "maxItemsForSurrogateKeys": 200 + }, "content": { /*