OrchardCoreContrib/OrchardCoreContrib.Modules

Use Degraded instead of Unhealthy in SystemUpdatesHealthCheck

hishamco opened this issue · 1 comments

On the last OC standup meeting @sebastienros comment about why we are using HealthStatus.Unhealthy if there's a new update available and the system is still up & running, which is making sense. Changing the status to a less than HealthStatus.Unhealthy would be fine

FYI Seb, the terminologies might little bit different on Azure, where you need to restart the node

namespace Microsoft.Extensions.Diagnostics.HealthChecks
{
    /// <summary>
    /// Represents the reported status of a health check result.
    /// </summary>
    /// <remarks>
    /// <para>
    /// A status of <see cref="Unhealthy"/> should be considered the default value for a failing health check. Application
    /// developers may configure a health check to report a different status as desired.
    /// </para>
    /// <para>
    /// The values of this enum or ordered from least healthy to most healthy. So <see cref="HealthStatus.Degraded"/> is
    /// greater than <see cref="HealthStatus.Unhealthy"/> but less than <see cref="HealthStatus.Healthy"/>.
    /// </para>
    /// </remarks>
    public enum HealthStatus
    {
        /// <summary>
        /// Indicates that the health check determined that the component was unhealthy, or an unhandled
        /// exception was thrown while executing the health check.
        /// </summary>
        Unhealthy = 0,

        /// <summary>
        /// Indicates that the health check determined that the component was in a degraded state.
        /// </summary>
        Degraded = 1,

        /// <summary>
        /// Indicates that the health check determined that the component was healthy.
        /// </summary>
        Healthy = 2,
    }
}

So, I think it's fine now to use Unhealthy if there's something goes wrong such as the email service doesn't working or we can't connect to the database

Backing to the SystemUpdatesHealthCheck if there's a new update it would be nice to notify the user that there's a new update - probably a patch release - so an action should be taken, even if the app is healthy