Class MetricCollectingCircuitBreakerListener
java.lang.Object
com.linecorp.armeria.client.circuitbreaker.MetricCollectingCircuitBreakerListener
- All Implemented Interfaces:
CircuitBreakerListener
public final class MetricCollectingCircuitBreakerListener extends Object implements CircuitBreakerListener
A
CircuitBreakerListener
which exports the status of CircuitBreaker
s to
MeterRegistry
.
This class will generate the following metrics:
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>.rejectedRequests{name="<circuit breaker name>"} |
The number of requests rejected by the circuit breaker. |
-
Constructor Summary
Constructors Constructor Description MetricCollectingCircuitBreakerListener(MeterRegistry registry)
Creates a new instance with the default name "armeria.client.circuit.breaker".MetricCollectingCircuitBreakerListener(MeterRegistry registry, String name)
Creates a new instance with the specifiedMeter
name. -
Method Summary
Modifier and Type Method Description void
onEventCountUpdated(String circuitBreakerName, EventCount eventCount)
Invoked when the circuit breaker's internalEventCount
is updated.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.client.circuitbreaker.CircuitBreakerListener
onInitialized
-
Constructor Details
-
MetricCollectingCircuitBreakerListener
Creates a new instance with the default name "armeria.client.circuit.breaker". -
MetricCollectingCircuitBreakerListener
Creates a new instance with the specifiedMeter
name.
-
-
Method Details
-
onStateChanged
Description copied from interface:CircuitBreakerListener
Invoked when the circuit state is changed.- Specified by:
onStateChanged
in interfaceCircuitBreakerListener
-
onEventCountUpdated
Description copied from interface:CircuitBreakerListener
Invoked when the circuit breaker's internalEventCount
is updated.- Specified by:
onEventCountUpdated
in interfaceCircuitBreakerListener
-
onRequestRejected
Description copied from interface:CircuitBreakerListener
Invoked when the circuit breaker rejects a request.- Specified by:
onRequestRejected
in interfaceCircuitBreakerListener
-