public final class MetricCollectingCircuitBreakerListener extends Object implements CircuitBreakerListener
CircuitBreakerListener which exports the status of CircuitBreakers 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 and Description |
|---|
MetricCollectingCircuitBreakerListener(MeterRegistry registry)
Creates a new instance with the default name .
|
MetricCollectingCircuitBreakerListener(MeterRegistry registry,
String name)
Creates a new instance with the specified
Meter name. |
| Modifier and Type | Method and Description |
|---|---|
void |
onEventCountUpdated(String circuitBreakerName,
EventCount eventCount)
Invoked when the circuit breaker's internal
EventCount 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.
|
public MetricCollectingCircuitBreakerListener(MeterRegistry registry)
public MetricCollectingCircuitBreakerListener(MeterRegistry registry, String name)
Meter name.public void onStateChanged(String circuitBreakerName, CircuitState state)
CircuitBreakerListeneronStateChanged in interface CircuitBreakerListenerpublic void onEventCountUpdated(String circuitBreakerName, EventCount eventCount)
CircuitBreakerListenerEventCount is updated.onEventCountUpdated in interface CircuitBreakerListenerpublic void onRequestRejected(String circuitBreakerName)
CircuitBreakerListeneronRequestRejected in interface CircuitBreakerListenerCopyright © 2020 LeanCloud. All rights reserved.