Table of Contents

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

status HealthStatus

The health status.

description string

The optional description.

exception Exception

The optional exception.

data IReadOnlyDictionary<string, object>

The optional additional data.

duration TimeSpan

The execution duration.

Properties

Data

Gets additional data associated with the health check result.

public IReadOnlyDictionary<string, object>? Data { get; }

Property Value

IReadOnlyDictionary<string, object>

Description

Gets the description of the health check result.

public string? Description { get; }

Property Value

string

Duration

Gets the duration of the health check execution.

public TimeSpan Duration { get; }

Property Value

TimeSpan

Exception

Gets the exception that occurred during the health check, if any.

public Exception? Exception { get; }

Property Value

Exception

Status

Gets the status of the health check.

public HealthStatus Status { get; }

Property Value

HealthStatus

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

description string

The optional description.

exception Exception

The optional exception.

data IReadOnlyDictionary<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

description string

The optional description.

data IReadOnlyDictionary<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

description string

The optional description.

exception Exception

The optional exception.

data IReadOnlyDictionary<string, object>

The optional additional data.

Returns

HealthCheckResult

An unhealthy health check result.