From 8e32c477864a21ea3bff8745b4c6a76dac29e50a Mon Sep 17 00:00:00 2001 From: Adam Williams Date: Sun, 3 Nov 2019 23:03:51 +0000 Subject: [PATCH] Derive status from allocated < options.Threshold (#15476) --- .../samples/3.x/HealthChecksSample/MemoryHealthCheck.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aspnetcore/host-and-deploy/health-checks/samples/3.x/HealthChecksSample/MemoryHealthCheck.cs b/aspnetcore/host-and-deploy/health-checks/samples/3.x/HealthChecksSample/MemoryHealthCheck.cs index 01428574aa..374afdb2cd 100644 --- a/aspnetcore/host-and-deploy/health-checks/samples/3.x/HealthChecksSample/MemoryHealthCheck.cs +++ b/aspnetcore/host-and-deploy/health-checks/samples/3.x/HealthChecksSample/MemoryHealthCheck.cs @@ -39,9 +39,11 @@ namespace SampleApp { "Gen1Collections", GC.CollectionCount(1) }, { "Gen2Collections", GC.CollectionCount(2) }, }; + var status = (allocated < options.Threshold) ? + HealthStatus.Healthy : context.Registration.FailureStatus; return Task.FromResult(new HealthCheckResult( - context.Registration.FailureStatus, + status, description: "Reports degraded status if allocated bytes " + $">= {options.Threshold} bytes.", exception: null,