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.

public class HealthInformation
继承
java.lang.Object
HealthInformation

构造函数

HealthInformation(String sourceId, String property, HealthState healthState)

Initializes a new instance of the system.fabric.health.HealthInformation class.

字段

autoSequenceNumber
unknownSequenceNumber

方法

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.

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.

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.

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.

getSourceId()

Gets the source Identifier which identifies the watchdog/system component which generated the health information.

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.

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.

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.

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.

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.

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.

适用于