HealthInformation Class
- java.
lang. Object - system.
fabric. health. HealthInformation
- system.
public class HealthInformation
Contains the health information about the entity. This information is included in the health report. It is also provided as part of the health event.
Field Summary
Modifier and Type | Field and Description |
---|---|
final long | autoSequenceNumber |
final long | unknownSequenceNumber |
Constructor Summary
Constructor | Description |
---|---|
HealthInformation(String sourceId, String property, HealthState healthState) |
Initializes a new instance of the system.fabric.health.HealthInformation class. |
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Gets the description of the health information. It represents free text used to add human readable information about the report.
Remarks:The maximum string length for the description is 4096 characters. |
Health |
getHealthState()
Gets the health state of the health information.
Remarks:The accepted health states are system.fabric.health.HealthState#Ok, system.fabric.health.HealthState#Warning and system.fabric.health.HealthState#Error. |
String |
getProperty()
Gets the property of the health report.
Remarks:The property is a String and not a fixed enumeration to allow the reporter to categorize the health event for a specific property of the entity. For example, reporter A can report the health of the Node01 "storage" property and reporter B can report the health of the Node01 "connectivity" property. In the health store, these reports are treated as separate health events for the Node01 entity. |
long |
getSequenceNumber()
Gets the sequence number associated with the report. Must be greater than system.fabric.health.HealthInformation#unknownSequenceNumber.
Remarks:The report sequence number is used by health store to detect stale reports. Most of the times, the reporter doesn't need to specify the sequence number. The default value AutoSequenceNumber can be used instead. When a health client receives a report with Auto sequence number, it replaces the auto sequence number with a valid sequence number. The sequence number is guaranteed to increase in the same process, even if the client machine time goes backwards. |
String |
getSourceId()
Gets the source Identifier which identifies the watchdog/system component which generated the health information. |
Duration |
getTimeToLive()
Gets how long the health report is valid. Must be larger than TimeSpan.Zero.
Remarks:When clients report periodically, they should send reports with higher frequency than time to live. If clients report on transition, they can set the time to live to infinite. When time to live expires, the health event that contains the health information is either removed from health store, if RemoveWhenExpired is true or evaluated at error, if RemoveWhenExpired is false. |
boolean |
isRemoveWhenExpired()
Gets a value that indicates whether the report is removed from health store when it expires. If set to false, the report is treated as an error when expired. false by default.
Remarks:When clients report periodically, they should set RemoveWhenExpired false (default). This way, is the reporter has issues (eg. deadlock) and can't report, the entity is evaluated at error when the health report expires, and this will flag the entity as system.fabric.health.HealthState#Error. Periodic health clients should send reports with higher frequency than time to live to account for delays due to health client batching, message transport over the wire and health store processing. |
void |
setDescription(String description)
Sets the description of the health information. It represents free text used to add human readable information about the report.
Remarks:The maximum string length for the description is 4096 characters. |
void |
setRemoveWhenExpired(boolean removeWhenExpired)
Sets a value that indicates whether the report is removed from health store when it expires. If set to false, the report is treated as an error when expired. false by default.
Remarks:When clients report periodically, they should set RemoveWhenExpired false (default). This way, is the reporter has issues (eg. deadlock) and can't report, the entity is evaluated at error when the health report expires, and this will flag the entity as system.fabric.health.HealthState#Error. Periodic health clients should send reports with higher frequency than time to live to account for delays due to health client batching, message transport over the wire and health store processing. |
void |
setSequenceNumber(long sequenceNumber)
Sets the sequence number associated with the report. Must be greater than system.fabric.health.HealthInformation#unknownSequenceNumber.
Remarks:The report sequence number is used by health store to detect stale reports. Most of the times, the reporter doesn't need to specify the sequence number. The default value AutoSequenceNumber can be used instead. When a health client receives a report with Auto sequence number, it replaces the auto sequence number with a valid sequence number. The sequence number is guaranteed to increase in the same process, even if the client machine time goes backwards. |
void |
setTimeToLiveSeconds(Duration timeToLive)
Sets how long the health report is valid. Must be larger than TimeSpan.Zero.
Remarks:When clients report periodically, they should send reports with higher frequency than time to live. If clients report on transition, they can set the time to live to infinite. When time to live expires, the health event that contains the health information is either removed from health store, if RemoveWhenExpired is true or evaluated at error, if RemoveWhenExpired is false. |
Field Details
autoSequenceNumber
public final long autoSequenceNumber= 0
unknownSequenceNumber
public final long unknownSequenceNumber= -1
Constructor Details
HealthInformation
public HealthInformation(String sourceId, String property, HealthState healthState)
Initializes a new instance of the system.fabric.health.HealthInformation class.
Parameters:
Method Details
getDescription
public String getDescription()
Gets the description of the health information. It represents free text used to add human readable information about the report.
Remarks:The maximum string length for the description is 4096 characters.
Returns:
getHealthState
public HealthState getHealthState()
Gets the health state of the health information.
Remarks:The accepted health states are system.fabric.health.HealthState#Ok, system.fabric.health.HealthState#Warning and system.fabric.health.HealthState#Error.
Returns:
getProperty
public String getProperty()
Gets the property of the health report.
Remarks:The property is a String and not a fixed enumeration to allow the reporter to categorize the health event for a specific property of the entity. For example, reporter A can report the health of the Node01 "storage" property and reporter B can report the health of the Node01 "connectivity" property. In the health store, these reports are treated as separate health events for the Node01 entity.
Returns:
getSequenceNumber
public long getSequenceNumber()
Gets the sequence number associated with the report. Must be greater than system.fabric.health.HealthInformation#unknownSequenceNumber.
Remarks:The report sequence number is used by health store to detect stale reports. Most of the times, the reporter doesn't need to specify the sequence number. The default value AutoSequenceNumber can be used instead. When a health client receives a report with Auto sequence number, it replaces the auto sequence number with a valid sequence number. The sequence number is guaranteed to increase in the same process, even if the client machine time goes backwards.
Returns:
getSourceId
public String getSourceId()
Gets the source Identifier which identifies the watchdog/system component which generated the health information.
Returns:
getTimeToLive
public Duration getTimeToLive()
Gets how long the health report is valid. Must be larger than TimeSpan.Zero.
Remarks:When clients report periodically, they should send reports with higher frequency than time to live. If clients report on transition, they can set the time to live to infinite. When time to live expires, the health event that contains the health information is either removed from health store, if RemoveWhenExpired is true or evaluated at error, if RemoveWhenExpired is false.
Returns:
isRemoveWhenExpired
public boolean isRemoveWhenExpired()
Gets a value that indicates whether the report is removed from health store when it expires. If set to false, the report is treated as an error when expired. false by default.
Remarks:When clients report periodically, they should set RemoveWhenExpired false (default). This way, is the reporter has issues (eg. deadlock) and can't report, the entity is evaluated at error when the health report expires, and this will flag the entity as system.fabric.health.HealthState#Error. Periodic health clients should send reports with higher frequency than time to live to account for delays due to health client batching, message transport over the wire and health store processing.
Returns:
setDescription
public void setDescription(String description)
Sets the description of the health information. It represents free text used to add human readable information about the report.
Remarks:The maximum string length for the description is 4096 characters.
Parameters:
setRemoveWhenExpired
public void setRemoveWhenExpired(boolean removeWhenExpired)
Sets a value that indicates whether the report is removed from health store when it expires. If set to false, the report is treated as an error when expired. false by default.
Remarks:When clients report periodically, they should set RemoveWhenExpired false (default). This way, is the reporter has issues (eg. deadlock) and can't report, the entity is evaluated at error when the health report expires, and this will flag the entity as system.fabric.health.HealthState#Error. Periodic health clients should send reports with higher frequency than time to live to account for delays due to health client batching, message transport over the wire and health store processing.
Parameters:
setSequenceNumber
public void setSequenceNumber(long sequenceNumber)
Sets the sequence number associated with the report. Must be greater than system.fabric.health.HealthInformation#unknownSequenceNumber.
Remarks:The report sequence number is used by health store to detect stale reports. Most of the times, the reporter doesn't need to specify the sequence number. The default value AutoSequenceNumber can be used instead. When a health client receives a report with Auto sequence number, it replaces the auto sequence number with a valid sequence number. The sequence number is guaranteed to increase in the same process, even if the client machine time goes backwards.
Parameters:
Throws:
setTimeToLiveSeconds
public void setTimeToLiveSeconds(Duration timeToLive)
Sets how long the health report is valid. Must be larger than TimeSpan.Zero.
Remarks:When clients report periodically, they should send reports with higher frequency than time to live. If clients report on transition, they can set the time to live to infinite. When time to live expires, the health event that contains the health information is either removed from health store, if RemoveWhenExpired is true or evaluated at error, if RemoveWhenExpired is false.
Parameters:
Applies to
Azure SDK for Java