This is a port of Akka's excellent implementation of the PhiAccuralFailureDetector as proposed by Hayashibara et al.
fd, err := failuredetector.New(
8.0,
200,
500*time.Millisecond,
0,
500*time.Millisecond,
nil)
if err != nil {
// invalid arguments given (e.g. negative sample size)
panic(err)
}
go func() {
for {
time.Sleep(1 * time.Second) // some expensive check
fd.Heartbeat()
}
}()
// health check
fmt.Println(fd.IsAvailable())