TsgcWSCircuitBreakerProperties › Thresholds

Thresholds Property

Conditions that trip the circuit from Closed to Open (failure counts, failure rate and slow-call rate).

Syntax

property Thresholds: TsgcCircuitBreakerThresholds read FThresholds
      write SetThresholds;

Default Value

Remarks

The breaker opens when any of the configured thresholds is reached inside the current rolling window. Sub-properties: Enabled (enables threshold-based opening), FailureCount (absolute failures in the window that trip the breaker, default 5), FailureRatePercent (0-100 failure percentage that trips once MinCalls is reached, default 50), SlowCallDurationMs (ms above which a successful call is also counted as "slow", default 3000), SlowCallRatePercent (0-100 slow-call percentage that trips the breaker; 0 disables slow-call detection), MinCalls (minimum calls observed before rate thresholds are evaluated, default 10 — avoids tripping on small samples). Combine a modest FailureCount with a non-zero MinCalls and FailureRatePercent to catch both sudden outages and gradual degradation.

Example

// Open after 5 failures, or 50% failure rate on 10+ calls, or 60% slow calls
sgcWSCircuitBreaker1.Thresholds.Enabled := True;
sgcWSCircuitBreaker1.Thresholds.FailureCount := 5;
sgcWSCircuitBreaker1.Thresholds.FailureRatePercent := 50;
sgcWSCircuitBreaker1.Thresholds.MinCalls := 10;
sgcWSCircuitBreaker1.Thresholds.SlowCallDurationMs := 3000;
sgcWSCircuitBreaker1.Thresholds.SlowCallRatePercent := 60;

Back to Properties