TsgcWSCircuitBreaker › Events › OnSlowCall
Fired when a successful call exceeds Thresholds.SlowCallDurationMs.
property OnSlowCall: TsgcCircuitBreakerOnSlowCall;
// TsgcCircuitBreakerOnSlowCall = procedure(Sender: TObject; const aKey: string; aDurationMs: Integer) of object
—
Fires when Execute / ExecuteWithResult (or the HTTP API client integration) completes a successful call that took longer than Thresholds.SlowCallDurationMs. The aKey parameter identifies the circuit and aDurationMs is the measured wall-clock duration in milliseconds. Slow calls are counted in the rolling window alongside successes and failures; when Thresholds.SlowCallRatePercent is non-zero the breaker may open even without any hard failures — a degraded-but-not-broken upstream. Use this event to log latency outliers and feed p95/p99 dashboards. Does not fire when SlowCallDurationMs is 0. Runs synchronously on the calling thread.
procedure TForm1.CircuitSlowCall(Sender: TObject; const aKey: string;
aDurationMs: Integer);
begin
Log(Format('Slow call on %s: %d ms', [aKey, aDurationMs]));
// Feed p95/p99 histogram
LatencyHistogram.Observe(aKey, aDurationMs);
end;