Naming is a compromise between Failsafe ("rate") and existing names ("in-period"), but I realize "rate" vs "ratio" may end up being a source of confusion. I had assumed that the :failure-threshold-ratio... options used rate thresholding, but was surprised to see that they are actually count-based.
Based on my reading of the Failsafe docs and some testing, (.withFailureThreshold cb 50 500) (aka :failure-threshold-ratio [50 500]) would actually trip after 50 total failures as long as 500 executions have happened ever, not 50 out of the last 500 executions. That is, repeating 1000 successes and 10 failures 5 times (for a total of 50 failures and 5000 successes) would end up tripping the circuit, even though the failure ratio in this case is < 1% in total (50 out of 5050), and only 2% in the last 500 (10 out of 500).
Adds support for Failsafe's rate-based CircuitBreaker using withFailureRateThreshold.
Naming is a compromise between Failsafe ("rate") and existing names ("in-period"), but I realize "rate" vs "ratio" may end up being a source of confusion. I had assumed that the
:failure-threshold-ratio...
options used rate thresholding, but was surprised to see that they are actually count-based.Based on my reading of the Failsafe docs and some testing,
(.withFailureThreshold cb 50 500)
(aka:failure-threshold-ratio [50 500]
) would actually trip after 50 total failures as long as 500 executions have happened ever, not 50 out of the last 500 executions. That is, repeating 1000 successes and 10 failures 5 times (for a total of 50 failures and 5000 successes) would end up tripping the circuit, even though the failure ratio in this case is < 1% in total (50 out of 5050), and only 2% in the last 500 (10 out of 500).