diff --git a/src/SIL.Machine.AspNetCore/Services/ServalTranslationEngineServiceV1.cs b/src/SIL.Machine.AspNetCore/Services/ServalTranslationEngineServiceV1.cs index 20333359c..fb87853c6 100644 --- a/src/SIL.Machine.AspNetCore/Services/ServalTranslationEngineServiceV1.cs +++ b/src/SIL.Machine.AspNetCore/Services/ServalTranslationEngineServiceV1.cs @@ -136,7 +136,7 @@ ServerCallContext context public override async Task HealthCheck(Empty request, ServerCallContext context) { HealthReport healthReport = await _healthCheckService.CheckHealthAsync(); - HealthCheckResponse healthCheckResponse = WriteHealthCheckResponse.Generate(healthReport); + HealthCheckResponse healthCheckResponse = WriteGrpcHealthCheckResponse.Generate(healthReport); return healthCheckResponse; } diff --git a/src/SIL.Machine.AspNetCore/Utils/WriteHealthCheckResponse.cs b/src/SIL.Machine.AspNetCore/Utils/WriteHealthCheckResponse.cs deleted file mode 100644 index 402deee4b..000000000 --- a/src/SIL.Machine.AspNetCore/Utils/WriteHealthCheckResponse.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Serval.Translation.V1; - -namespace SIL.Machine.AspNetCore.Utils; - -public class WriteHealthCheckResponse -{ - public static HealthCheckResponse Generate(HealthReport healthReport) - { - Dictionary healthCheckResultData = []; - string? healthCheckResultException = null; - - // Combine data and exceptions from all health checks - foreach (KeyValuePair entry in healthReport.Entries) - { - healthCheckResultData.Add(entry.Key, $"{entry.Value.Status}: {entry.Value.Description ?? ""}"); - if ((entry.Value.Exception?.ToString() ?? "") != "") - if(healthCheckResultException is null) - healthCheckResultException = $"{entry.Key}: {entry.Value.Exception}"; - else - healthCheckResultException += $"\n{entry.Key}: {entry.Value.Exception}"; - } - // Assemble response - HealthCheckResponse healthCheckReponse = new HealthCheckResponse{ - Status = (HealthCheckStatus)healthReport.Status, - Duration = healthReport.TotalDuration.ToString(), - Exception = healthCheckResultException - }; - foreach (KeyValuePair entry in healthCheckResultData) - { - healthCheckReponse.Data.Add(entry.Key, entry.Value); - } - return healthCheckReponse; - } -} \ No newline at end of file