Class HealthCheckResult
- Namespace
- WorkflowForge.Extensions.Observability.HealthChecks
- Assembly
- WorkflowForge.Extensions.Observability.HealthChecks.dll
Represents the result of a health check execution.
public sealed class HealthCheckResult
- Inheritance
-
HealthCheckResult
- Inherited Members
Constructors
HealthCheckResult(HealthStatus, string?, Exception?, IReadOnlyDictionary<string, object>?, TimeSpan)
Initializes a new instance of the HealthCheckResult class.
public HealthCheckResult(HealthStatus status, string? description = null, Exception? exception = null, IReadOnlyDictionary<string, object>? data = null, TimeSpan duration = default)
Parameters
statusHealthStatusThe health status.
descriptionstringThe optional description.
exceptionExceptionThe optional exception.
dataIReadOnlyDictionary<string, object>The optional additional data.
durationTimeSpanThe execution duration.
Properties
Data
Gets additional data associated with the health check result.
public IReadOnlyDictionary<string, object>? Data { get; }
Property Value
Description
Gets the description of the health check result.
public string? Description { get; }
Property Value
Duration
Gets the duration of the health check execution.
public TimeSpan Duration { get; }
Property Value
Exception
Gets the exception that occurred during the health check, if any.
public Exception? Exception { get; }
Property Value
Status
Gets the status of the health check.
public HealthStatus Status { get; }
Property Value
Methods
Degraded(string?, Exception?, IReadOnlyDictionary<string, object>?)
Creates a degraded result.
public static HealthCheckResult Degraded(string? description = null, Exception? exception = null, IReadOnlyDictionary<string, object>? data = null)
Parameters
descriptionstringThe optional description.
exceptionExceptionThe optional exception.
dataIReadOnlyDictionary<string, object>The optional additional data.
Returns
- HealthCheckResult
A degraded health check result.
Healthy(string?, IReadOnlyDictionary<string, object>?)
Creates a healthy result.
public static HealthCheckResult Healthy(string? description = null, IReadOnlyDictionary<string, object>? data = null)
Parameters
descriptionstringThe optional description.
dataIReadOnlyDictionary<string, object>The optional additional data.
Returns
- HealthCheckResult
A healthy health check result.
Unhealthy(string?, Exception?, IReadOnlyDictionary<string, object>?)
Creates an unhealthy result.
public static HealthCheckResult Unhealthy(string? description = null, Exception? exception = null, IReadOnlyDictionary<string, object>? data = null)
Parameters
descriptionstringThe optional description.
exceptionExceptionThe optional exception.
dataIReadOnlyDictionary<string, object>The optional additional data.
Returns
- HealthCheckResult
An unhealthy health check result.