36 lines
1.5 KiB
C#
36 lines
1.5 KiB
C#
namespace Dada.Supervisor;
|
|
|
|
internal enum DiagnosticResult
|
|
{
|
|
Pass,
|
|
Warning,
|
|
Fail,
|
|
}
|
|
|
|
internal sealed record DiagnosticCheck(string CheckCode, DiagnosticResult Result, string MessageKey, DateTimeOffset CheckedAt)
|
|
{
|
|
internal static DiagnosticCheck Pass(string checkCode, string messageKey) => new(checkCode, DiagnosticResult.Pass, messageKey, DateTimeOffset.UtcNow);
|
|
internal static DiagnosticCheck Warning(string checkCode, string messageKey) => new(checkCode, DiagnosticResult.Warning, messageKey, DateTimeOffset.UtcNow);
|
|
internal static DiagnosticCheck Fail(string checkCode, string messageKey) => new(checkCode, DiagnosticResult.Fail, messageKey, DateTimeOffset.UtcNow);
|
|
}
|
|
|
|
internal sealed record DiagnosticStorageSummary(long UsedBytes, long CapacityBytes, long ReclaimableBytes);
|
|
internal sealed record CredentialStatus(string Service, bool Configured);
|
|
|
|
internal sealed record DiagnosticReport(
|
|
string AppVersion,
|
|
SupervisorState SupervisorState,
|
|
string BindHost,
|
|
int FixedPort,
|
|
IReadOnlyList<DiagnosticCheck> Checks,
|
|
DiagnosticStorageSummary Storage,
|
|
IReadOnlyList<CredentialStatus> Credentials)
|
|
{
|
|
internal static DiagnosticReport Create(
|
|
SupervisorState supervisorState,
|
|
IReadOnlyList<DiagnosticCheck> checks,
|
|
DiagnosticStorageSummary storage,
|
|
IReadOnlyList<CredentialStatus> credentials) =>
|
|
new(typeof(DiagnosticReport).Assembly.GetName().Version?.ToString() ?? "0.0.0", supervisorState, LoopbackEndpoint.Host, LoopbackEndpoint.Port, checks, storage, credentials);
|
|
}
|