-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial stgab at improved health checking
* upgrade to net8.0 * Add health check endpoint to GRPC engine proto (from serval) * Combine health reports into rich data
1 parent
d941cd2
commit fddf8f5
Showing
18 changed files
with
93 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy | ||
# libgomp needed for thot | ||
RUN apt update && apt install -y unzip libgomp1 && \ | ||
curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l /remote_debugger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/SIL.Machine.AspNetCore/Utils/WriteHealthCheckResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Serval.Translation.V1; | ||
|
||
namespace SIL.Machine.AspNetCore.Utils; | ||
|
||
public class WriteHealthCheckResponse | ||
{ | ||
public static HealthCheckResponse Generate(HealthReport healthReport) | ||
Check failure on line 7 in src/SIL.Machine.AspNetCore/Utils/WriteHealthCheckResponse.cs
|
||
{ | ||
Dictionary<string, string> healthCheckResultData = []; | ||
string? healthCheckResultException = null; | ||
|
||
// Combine data and exceptions from all health checks | ||
foreach (KeyValuePair<string, HealthReportEntry> 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<string, string> entry in healthCheckResultData) | ||
{ | ||
healthCheckReponse.Data.Add(entry.Key, entry.Value); | ||
} | ||
return healthCheckReponse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,4 @@ | |
|
||
var app = builder.Build(); | ||
|
||
app.MapHealthChecks("/health"); | ||
|
||
app.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/SIL.Machine.AspNetCore.Tests/SIL.Machine.AspNetCore.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/SIL.Machine.Morphology.HermitCrab.Tests/SIL.Machine.Morphology.HermitCrab.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...hine.Tokenization.SentencePiece.Tests/SIL.Machine.Tokenization.SentencePiece.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/SIL.Machine.Translation.Thot.Tests/SIL.Machine.Translation.Thot.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters