UTIL_CircuitBreaker.Metrics
Class · Group: Resilience
Learn it: Fast Start - Resilience and Resilience guide
global inherited sharing class UTIL_CircuitBreaker.MetricsPublic class containing circuit breaker metrics
Fields
| Field | Description |
|---|---|
| global String circuitId | The circuit identifier |
| global Integer consecutiveSuccesses | Current consecutive success count |
| global Integer failureCount | The failures recorded while the circuit was CLOSED. |
| global Datetime lastFailureTime | The time the circuit last opened: after too many failures, after a failed trial request, or through forceOpen. |
| global UTIL_CircuitBreaker.State state | The state of the circuit when the metrics were read. |
| global Datetime stateChangedTime | Time when the state last changed. |
circuitId
global String circuitIdType: String
The circuit identifier
Example
String value = instance.circuitId;consecutiveSuccesses
global Integer consecutiveSuccessesType: Integer
Current consecutive success count
Example
Integer value = instance.consecutiveSuccesses;failureCount
global Integer failureCountType: Integer
The failures recorded while the circuit was CLOSED. A success while CLOSED sets it back to zero, and so does closing the circuit. The circuit opens when this count reaches the failure threshold; opening it does not reset the count.
Example
Integer value = instance.failureCount;lastFailureTime
global Datetime lastFailureTimeType: Datetime
The time the circuit last opened: after too many failures, after a failed trial request, or through forceOpen. A failure that leaves the circuit CLOSED does not set it. Null when no opening is on record. The timeout before an OPEN circuit lets trial requests through is counted from this time.
Example
Datetime value = instance.lastFailureTime;state
global UTIL_CircuitBreaker.State stateType: UTIL_CircuitBreaker.State
The state of the circuit when the metrics were read. CLOSED lets every request through, OPEN refuses them, and HALF_OPEN lets a few trial requests through. An OPEN circuit whose timeout has passed is shown as HALF_OPEN, because reading the metrics moves it on first.
Example
State value = instance.state;stateChangedTime
global Datetime stateChangedTimeType: Datetime
Time when the state last changed. While the circuit is HALF_OPEN it is the time the current round of trial requests began.
Example
Datetime value = instance.stateChangedTime;