Interface CircuitBreakerListener
- All Known Implementing Classes:
CircuitBreakerListenerAdapter
public interface CircuitBreakerListener
The listener interface for receiving
CircuitBreaker
events.-
Method Summary
Modifier and TypeMethodDescriptionstatic CircuitBreakerListener
metricCollecting
(io.micrometer.core.instrument.MeterRegistry registry) Returns a newCircuitBreakerListener
that collects metric with the specifiedMeterRegistry
.static CircuitBreakerListener
metricCollecting
(io.micrometer.core.instrument.MeterRegistry registry, String name) Returns a newCircuitBreakerListener
that collects metric with the specifiedMeterRegistry
andMeter
name.void
onEventCountUpdated
(String circuitBreakerName, EventCount eventCount) Invoked when the circuit breaker's internalEventCount
is updated.default void
onInitialized
(String circuitBreakerName, CircuitState initialState) Invoked when the circuit breaker is initialized.void
onRequestRejected
(String circuitBreakerName) Invoked when the circuit breaker rejects a request.void
onStateChanged
(String circuitBreakerName, CircuitState state) Invoked when the circuit state is changed.
-
Method Details
-
metricCollecting
static CircuitBreakerListener metricCollecting(io.micrometer.core.instrument.MeterRegistry registry) Returns a newCircuitBreakerListener
that collects metric with the specifiedMeterRegistry
. The returned listener will generate the following metrics:metrics that will be generated by this class metric name description armeria.client.circuit.breaker.requests{name="<circuit breaker name>",result="success"}
The number of successful requests in the counter time window. armeria.client.circuit.breaker.requests{name="<circuit breaker name>",result="failure"}
The number of failed requests in the counter time window. armeria.client.circuit.breaker.transitions{name="<circuit breaker name>",state="CLOSED"}
The number of circuit breaker state transitions to CircuitState.CLOSED
.armeria.client.circuit.breaker.transitions{name="<circuit breaker name>",state="OPEN"}
The number of circuit breaker state transitions to CircuitState.OPEN
.armeria.client.circuit.breaker.transitions{name="<circuit breaker name>",state="HALF_OPEN"}
The number of circuit breaker state transitions to CircuitState.HALF_OPEN
.armeria.client.circuit.breaker.transitions{name="<circuit breaker name>",state="FORCED_OPEN"}
The number of circuit breaker state transitions to CircuitState.FORCED_OPEN
.armeria.client.circuit.breaker.rejected.requests{name="<circuit breaker name>"}
The number of requests rejected by the circuit breaker. -
metricCollecting
static CircuitBreakerListener metricCollecting(io.micrometer.core.instrument.MeterRegistry registry, String name) Returns a newCircuitBreakerListener
that collects metric with the specifiedMeterRegistry
andMeter
name. The returned listener will generate the following metrics:metrics that will be generated by this class metric name description <name>.requests{name="<circuit breaker name>",result="success"}
The number of successful requests in the counter time window. <name>.requests{name="<circuit breaker name>",result="failure"}
The number of failed requests in the counter time window. <name>.transitions{name="<circuit breaker name>",state="CLOSED"}
The number of circuit breaker state transitions to CircuitState.CLOSED
.<name>.transitions{name="<circuit breaker name>",state="OPEN"}
The number of circuit breaker state transitions to CircuitState.OPEN
.<name>.transitions{name="<circuit breaker name>",state="HALF_OPEN"}
The number of circuit breaker state transitions to CircuitState.HALF_OPEN
.<name>.transitions{name="<circuit breaker name>",state="FORCED_OPEN"}
The number of circuit breaker state transitions to CircuitState.FORCED_OPEN
.<name>.rejected.requests{name="<circuit breaker name>"}
The number of requests rejected by the circuit breaker. -
onInitialized
Invoked when the circuit breaker is initialized.- Throws:
Exception
-
onStateChanged
Invoked when the circuit state is changed.- Throws:
Exception
-
onEventCountUpdated
Invoked when the circuit breaker's internalEventCount
is updated.- Throws:
Exception
-
onRequestRejected
Invoked when the circuit breaker rejects a request.- Throws:
Exception
-