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)
iferr!=nil {
// invalid arguments given (e.g. negative sample size)panic(err)
}
gofunc() {
for {
time.Sleep(1*time.Second) // some expensive checkfd.Heartbeat()
}
}()
// health checkfmt.Println(fd.IsAvailable())