I am using the Resilence4j circuit breaker with Spring Boot as shown below:
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
@Component
@CircuitBreaker(name = "ExternalService")
public class ExternalServiceClient implements APIClient {
//....
}
I haven't specified any additional configs in my application.yml
so the circuit breaker is operating with the default values. Whenever the breaker opens, I see errors like:
Failure to call external service for entity id 12343
stack_trace: io.github.resilience4j.circuitbreaker.CallNotPermittedException: CircuitBreaker 'ExternalService' is OPEN and does not permit further calls
at io.github.resilience4j.circuitbreaker.CallNotPermittedException.createCallNotPermittedException(CallNotPermittedException.java:37) ~[resilience4j-circuitbreaker-1.1.0.jar!/:1.1.0]
at io.github.resilience4j.circuitbreaker.internal.CircuitBreakerStateMachine$HalfOpenState.acquirePermission(CircuitBreakerStateMachine.java:685)
at io.github.resilience4j.circuitbreaker.internal.CircuitBreakerStateMachine.acquirePermission(CircuitBreakerStateMachine.java:146)
at io.github.resilience4j.circuitbreaker.CircuitBreaker.lambda$decorateCheckedSupplier$82a9021a$1(CircuitBreaker.java:599)
at io.github.resilience4j.circuitbreaker.CircuitBreaker.executeCheckedSupplier(CircuitBreaker.java:340)
at io.github.resilience4j.circuitbreaker.configure.CircuitBreakerAspect.defaultHandling(CircuitBreakerAspect.java:155) ~[resilience4j-spring-0.16.0.jar!/:0.16.0]
at io.github.resilience4j.circuitbreaker.configure.CircuitBreakerAspect.proceed(CircuitBreakerAspect.java:115)
at io.github.resilience4j.circuitbreaker.configure.CircuitBreakerAspect.circuitBreakerAroundAdvice(CircuitBreakerAspect.java:98)
at jdk.internal.reflect.GeneratedMethodAccessor238.invoke(Unknown Source) ~[na:na]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) ~[spring-aop-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
This is telling me the breaker opened due to some error condition(and as a result no more calls are permitted) but doesn't specify what the original error was. Is there a way to figure out the original error? Is there specific text I should look for in the logs or is there some setting I need to turn on so this error also tells me the original reason for breaker opening?
CallNotPermittedException and the underlying stack trace occur within the state machine logic after the breaker is opened, this is not the right place to look.
The events consumer buffer exposed through the actuator endpoint /actuator/circuitbreakerevents
would list all the events within the breaker, what are errors, and the corresponding message.
https://resilience4j.readme.io/docs/getting-started-3#events-endpoint
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.