Interface CircuitBreakerListener

All Known Implementing Classes:
CircuitBreakerListenerAdapter

public interface CircuitBreakerListener
The listener interface for receiving CircuitBreaker events.
  • Method Details

    • metricCollecting

      static CircuitBreakerListener metricCollecting​(MeterRegistry registry)
      Returns a new CircuitBreakerListener that collects metric with the specified MeterRegistry. 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.rejected.requests{name="<circuit breaker name>"} The number of requests rejected by the circuit breaker.
    • metricCollecting

      static CircuitBreakerListener metricCollecting​(MeterRegistry registry, String name)
      Returns a new CircuitBreakerListener that collects metric with the specified MeterRegistry and Meter 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>.rejected.requests{name="<circuit breaker name>"} The number of requests rejected by the circuit breaker.
    • onInitialized

      default void onInitialized​(String circuitBreakerName, CircuitState initialState) throws Exception
      Invoked when the circuit breaker is initialized.
      Throws:
      Exception
    • onStateChanged

      void onStateChanged​(String circuitBreakerName, CircuitState state) throws Exception
      Invoked when the circuit state is changed.
      Throws:
      Exception
    • onEventCountUpdated

      void onEventCountUpdated​(String circuitBreakerName, EventCount eventCount) throws Exception
      Invoked when the circuit breaker's internal EventCount is updated.
      Throws:
      Exception
    • onRequestRejected

      void onRequestRejected​(String circuitBreakerName) throws Exception
      Invoked when the circuit breaker rejects a request.
      Throws:
      Exception