我使用的是带Spring Boot的resilence4j断路器,如下所示:
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
@Component
@CircuitBreaker(name = "ExternalService")
public class ExternalServiceClient implements APIClient {
//....
}
我没有在我的中指定任何其他配置 application.yml
因此,断路器以默认值运行。每当断路器断开时,我都会看到如下错误:
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)
这是告诉我断路器由于某些错误情况而断开(因此不允许再调用),但没有指定最初的错误是什么。有没有办法找出最初的错误?是否有具体的文字,我应该在日志中寻找或有一些设置,我需要打开,所以这个错误也告诉我断路器打开的原始原因?
1条答案
按热度按时间wgx48brx1#
callnotpermittedexception和底层堆栈跟踪在断路器打开后发生在状态机逻辑中,这不是查看的正确位置。
通过执行器端点公开的事件使用者缓冲区
/actuator/circuitbreakerevents
将列出断路器中的所有事件、错误以及相应的消息。https://resilience4j.readme.io/docs/getting-started-3#events-终结点