Class HealthCheck
Inheritance
System.Object
HealthCheck
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace:App.Metrics.Health
Assembly:cs.temp.dll.dll
Syntax
public class HealthCheck
Constructors
HealthCheck(String)
Declaration
protected HealthCheck(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
HealthCheck(String, Func<Task<HealthCheckResult>>)
Initializes a new instance of the HealthCheck class.
Declaration
public HealthCheck(string name, Func<Task<HealthCheckResult>> check)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | A descriptive name for the health check. |
System.Func<Task<HealthCheckResult>> | check | A function returning either a healthy or un-healthy result. |
HealthCheck(String, Func<Task<String>>)
Initializes a new instance of the HealthCheck class.
Declaration
public HealthCheck(string name, Func<Task<string>> check)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | A descriptive name for the health check. |
System.Func<Task<System.String>> | check | A function returning a message that is a healthy result. |
Properties
Name
Gets the descriptive name for the health check.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String | The name. |
Methods
CheckAsync(CancellationToken)
Declaration
protected virtual Task<HealthCheckResult> CheckAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<HealthCheckResult> |
ExecuteAsync(CancellationToken)
Executes the health check asynchrously
Declaration
public Task<HealthCheck.Result> ExecuteAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HealthCheck.Result> | The HealthCheck.Result of running the health check |