Class PhiAccrualFailureDetector
Represents Phi Accrual implementation of the failure detector.
Inherited Members
Namespace: DotNext.Diagnostics
Assembly: DotNext.Net.Cluster.dll
Syntax
public class PhiAccrualFailureDetector : IFailureDetector, IResettable, ISupplier<double>, IFunctional<Func<double>>
Constructors
| Edit this page View SourcePhiAccrualFailureDetector(TimeSpan)
Initializes a new failure detector.
Declaration
public PhiAccrualFailureDetector(TimeSpan estimatedFirstHeartbeat)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | estimatedFirstHeartbeat | The estimated interval to the first heartbeat. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
Properties
| Edit this page View SourceAcceptableHeartbeatPause
Gets or sets duration corresponding to number of potentially lost/delayed heartbeats that will be accepted before considering it to be an anomaly.
Declaration
public TimeSpan AcceptableHeartbeatPause { get; init; }
Property Value
Type | Description |
---|---|
TimeSpan |
Remarks
Too low standard deviation might result in too much sensitivity for sudden, but normal, deviations in heartbeat inter arrival times.
IsHealthy
Indicates that the resource associated with this detector is considered to be up and healthy.
Declaration
public bool IsHealthy { get; }
Property Value
Type | Description |
---|---|
bool |
IsMonitoring
Indicates that this detector has received any heartbeats and started monitoring of the resource.
Declaration
public bool IsMonitoring { get; }
Property Value
Type | Description |
---|---|
bool |
MaxSampleSize
Gets or sets a number of samples to use for calculation of mean and standard deviation of inter-arrival times.
Declaration
public int MaxSampleSize { get; init; }
Property Value
Type | Description |
---|---|
int |
MinStdDeviation
Gets or sets minimum standard deviation to use for the normal distribution used when calculating phi.
Declaration
public TimeSpan MinStdDeviation { get; init; }
Property Value
Type | Description |
---|---|
TimeSpan |
Remarks
Too low standard deviation might result in too much sensitivity for sudden, but normal, deviations in heartbeat inter-arrival times.
Threshold
Gets or sets Phi value threshold that is used to determine whether the underlying resource is no longer available.
Declaration
public double Threshold { get; init; }
Property Value
Type | Description |
---|---|
double |
Remarks
A low threshold is prone to generate many wrong suspicions but ensures a quick detection in the event of a real crash. Conversely, a high threshold generates fewer mistakes but needs more time to detect actual crashes.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
TreatUnknownValueAsUnhealthy
Gets or sets a value indicating that this detector interprets false value of IsMonitoring as unhealthy resource.
Declaration
public bool TreatUnknownValueAsUnhealthy { get; init; }
Property Value
Type | Description |
---|---|
bool |
Remarks
By default, this property is false.
Value
Gets Phi value.
Declaration
public double Value { get; }
Property Value
Type | Description |
---|---|
double |
Methods
| Edit this page View SourceGetValue(Timestamp)
Gets Phi value.
Declaration
public double GetValue(Timestamp ts)
Parameters
Type | Name | Description |
---|---|---|
Timestamp | ts | The timestamp of the heartbeat. |
Returns
Type | Description |
---|---|
double | Phi value. |
ReportHeartbeat()
Notifies that this detector received a heartbeat from the associated resource.
Declaration
public void ReportHeartbeat()
ReportHeartbeat(Timestamp)
Notifies that this detector received a heartbeat from the associated resource.
Declaration
public void ReportHeartbeat(Timestamp ts)
Parameters
Type | Name | Description |
---|---|---|
Timestamp | ts | The timestamp of the heartbeat. |
Reset()
Resets this detector to its initial state.
Declaration
public void Reset()
Events
| Edit this page View SourceSuspiciousIntervalGrowth
An event occurred when this detector considers than the interval between two heartbeats is growing too fast.
Declaration
public event Action<TimeSpan> SuspiciousIntervalGrowth
Event Type
Type | Description |
---|---|
Action<TimeSpan> |