Package io.micronaut.health
Class HealthStatus
java.lang.Object
io.micronaut.health.HealthStatus
- All Implemented Interfaces:
Comparable<HealthStatus>
The status of a health indicator.
- Since:
- 1.0
- Author:
- James Kleeh, Graeme Rocher
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HealthStatusIndicates the service is down and unavailable.static final StringThe default name to use for anDOWNstatus.static final StringThe default name to use for anUPstatus.static final HealthStatusIndicates the service status is unknown.static final HealthStatusIndicates the service is operational. -
Constructor Summary
ConstructorsConstructorDescriptionHealthStatus(@NonNull String name) HealthStatus(String name, String description, Boolean operational, Integer severity) -
Method Summary
Modifier and TypeMethodDescriptionintSorts statuses in order of "functioning level".Describe an existingHealthStatus.booleangetName()Whether the status represents a functioning service.The severity of the status.inthashCode()toString()
-
Field Details
-
Constructor Details
-
HealthStatus
- Parameters:
name- The name of the statusdescription- The detailed information about the statusoperational- If it's operationalseverity- The severity, the higher the value, the more sever is situation.
-
HealthStatus
- Parameters:
name- The name of the status
-
-
Method Details
-
describe
Describe an existingHealthStatus.- Parameters:
description- The description- Returns:
- The new health status
-
getName
- Returns:
- The name of the status
-
getDescription
- Returns:
- The description of the status
-
getOperational
Whether the status represents a functioning service.- Returns:
- Empty if partially operational.
-
getSeverity
The severity of the status. A higher severity indicates a more severe error.- Returns:
- Empty if no severity specified.
-
equals
-
hashCode
public int hashCode() -
compareTo
Sorts statuses in order of "functioning level". The most functional will appear first and the least functional will appear last.Operation is sorted (true, null, false). For statuses with matching operations, severity is sorted ascending, with nulls first.
- Specified by:
compareToin interfaceComparable<HealthStatus>- Parameters:
o- The status to compare- Returns:
- -1, 1, or 0
-
toString
-