Enum Class HealthStatus

java.lang.Object
java.lang.Enum<HealthStatus>
cloud.opencode.base.observability.health.HealthStatus
All Implemented Interfaces:
Serializable, Comparable<HealthStatus>, Constable

public enum HealthStatus extends Enum<HealthStatus>
Enumeration of possible health check statuses. 健康检查状态枚举。

Represents the overall health of a component: UP (healthy), DOWN (unhealthy), or DEGRADED (partially healthy). The aggregate(Collection) method computes the worst-case status from a collection.

表示组件的整体健康状态:UP(健康)、DOWN(不健康) 或 DEGRADED(部分健康)。aggregate(Collection) 方法从集合中计算最差状态。

Since:
JDK 25, opencode-base-observability V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • UP

      public static final HealthStatus UP
      The component is healthy. 组件健康。
    • DOWN

      public static final HealthStatus DOWN
      The component is unhealthy. 组件不健康。
    • DEGRADED

      public static final HealthStatus DEGRADED
      The component is partially healthy. 组件部分健康。
  • Method Details

    • values

      public static HealthStatus[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static HealthStatus valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • aggregate

      public static HealthStatus aggregate(Collection<HealthStatus> statuses)
      Aggregates a collection of statuses into a single worst-case status. 将一组状态聚合为单个最差状态。

      DOWN takes highest priority, followed by DEGRADED, then UP. A null or empty collection returns UP.

      DOWN 优先级最高,其次是 DEGRADED,然后是 UP。 null 或空集合返回 UP

      Parameters:
      statuses - the collection of statuses to aggregate | 要聚合的状态集合
      Returns:
      the aggregated worst-case status | 聚合后的最差状态