Struct HealthCheckResult
Result of a health check
Inherited Members
Namespace:App.Metrics.Health
Assembly:cs.temp.dll.dll
Syntax
public struct HealthCheckResult
Fields
Status
True if the check was healthy, degraded or unhealthy.
Declaration
public readonly HealthCheckStatus Status
Field Value
Type | Description |
---|---|
HealthCheckStatus |
Properties
Message
Gets the status message of the check. A status can be provided for both healthy and unhealthy states.
Declaration
public string Message { get; }
Property Value
Type | Description |
---|---|
System.String | The message. |
Methods
Degraded()
Create a Degraded status response. This is useful for when a health check may fail but the application itself is still functioning correct. E.g. There could be a health check checking the number of messages in a queue, if that number reaches a specified threshold, a degraded status could be returned rather than raising a critical alert.
Declaration
public static HealthCheckResult Degraded()
Returns
Type | Description |
---|---|
HealthCheckResult | Degraded status response. |
Degraded(Exception)
Create a Degraded status response. This is useful for when a health check may fail but the application itself is still functioning correct. E.g. There could be a health check checking the number of messages in a queue, if that number reaches a specified threshold, a degraded status could be returned rather than raising a critical alert.
Declaration
public static HealthCheckResult Degraded(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | Exception to use for reason. |
Returns
Type | Description |
---|---|
HealthCheckResult | Degraded status response. |
Degraded(String, Object[])
Create a Degraded status response. This is useful for when a health check may fail but the application itself is still functioning correct. E.g. There could be a health check checking the number of messages in a queue, if that number reaches a specified threshold, a degraded status could be returned rather than raising a critical alert.
Declaration
public static HealthCheckResult Degraded(string message, params object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Status message. |
System.Object[] | values | Values to format the status message with. |
Returns
Type | Description |
---|---|
HealthCheckResult | A degraded health check result |
Healthy()
Create a healthy status response.
Declaration
public static HealthCheckResult Healthy()
Returns
Type | Description |
---|---|
HealthCheckResult | Healthy status response. |
Healthy(String, Object[])
Create a healthy status response.
Declaration
public static HealthCheckResult Healthy(string message, params object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Status message. |
System.Object[] | values | Values to format the status message with. |
Returns
Type | Description |
---|---|
HealthCheckResult | Healthy status response. |
Ignore()
Ignores this health check.
Declaration
public static HealthCheckResult Ignore()
Returns
Type | Description |
---|---|
HealthCheckResult | An ignored health check result |
Ignore(String)
Ignores this health check.
Declaration
public static HealthCheckResult Ignore(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Status message. |
Returns
Type | Description |
---|---|
HealthCheckResult | An ignored health check result |
Unhealthy()
Create a unhealthy status response.
Declaration
public static HealthCheckResult Unhealthy()
Returns
Type | Description |
---|---|
HealthCheckResult | Unhealthy status response. |
Unhealthy(Exception)
Create a unhealthy status response.
Declaration
public static HealthCheckResult Unhealthy(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception | Exception to use for reason. |
Returns
Type | Description |
---|---|
HealthCheckResult | Unhealthy status response. |
Unhealthy(String, Object[])
Create a unhealthy status response.
Declaration
public static HealthCheckResult Unhealthy(string message, params object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | Status message. |
System.Object[] | values | Values to format the status message with. |
Returns
Type | Description |
---|---|
HealthCheckResult | Unhealthy status response. |