@@ -23,7 +23,7 @@ public QoSOptions(FileQoSOptions from)
23
23
public QoSOptions (
24
24
int exceptionsAllowedBeforeBreaking ,
25
25
int durationOfBreak ,
26
- int timeoutValue ,
26
+ int timeoutValue ,
27
27
string key )
28
28
{
29
29
DurationOfBreak = durationOfBreak ;
@@ -32,6 +32,36 @@ public QoSOptions(
32
32
TimeoutValue = timeoutValue ;
33
33
}
34
34
35
+ public QoSOptions (
36
+ int exceptionsAllowedBeforeBreaking ,
37
+ int durationOfBreak ,
38
+ double failureRatio ,
39
+ int timeoutValue ,
40
+ string key )
41
+ {
42
+ DurationOfBreak = durationOfBreak ;
43
+ ExceptionsAllowedBeforeBreaking = exceptionsAllowedBeforeBreaking ;
44
+ Key = key ;
45
+ TimeoutValue = timeoutValue ;
46
+ FailureRatio = failureRatio ;
47
+ }
48
+
49
+ public QoSOptions (
50
+ int exceptionsAllowedBeforeBreaking ,
51
+ int durationOfBreak ,
52
+ double failureRatio ,
53
+ int samplingDuration ,
54
+ int timeoutValue ,
55
+ string key )
56
+ {
57
+ DurationOfBreak = durationOfBreak ;
58
+ ExceptionsAllowedBeforeBreaking = exceptionsAllowedBeforeBreaking ;
59
+ Key = key ;
60
+ TimeoutValue = timeoutValue ;
61
+ FailureRatio = failureRatio ;
62
+ SamplingDuration = samplingDuration ;
63
+ }
64
+
35
65
/// <summary>
36
66
/// How long the circuit should stay open before resetting in milliseconds.
37
67
/// </summary>
@@ -54,6 +84,22 @@ public QoSOptions(
54
84
/// </value>
55
85
public int ExceptionsAllowedBeforeBreaking { get ; }
56
86
87
+ /// <summary>
88
+ /// The failure-success ratio that will cause the circuit to break/open.
89
+ /// </summary>
90
+ /// <value>
91
+ /// An <see cref="double"/> 0.8 means 80% failed of all sampled executions.
92
+ /// </value>
93
+ public double FailureRatio { get ; } = .8 ;
94
+
95
+ /// <summary>
96
+ /// The time period over which the failure-success ratio is calculated (in seconds).
97
+ /// </summary>
98
+ /// <value>
99
+ /// An <see cref="int"/> Time period in seconds, 10 means 10 seconds.
100
+ /// </value>
101
+ public int SamplingDuration { get ; } = 10 ;
102
+
57
103
public string Key { get ; }
58
104
59
105
/// <summary>
0 commit comments