网关限流中,我抛出auth异常过多导致服务熔断,这个异常应该被忽略的
这个异常可以在我定义DegradeRule时被忽略
原提问者GitHub用户Lawrence-Albet
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
您可以利用Tracer中的setExceptionsToIgnore来忽略一些异常:
Sentinel/sentinel-core/src/main/java/com/alibaba/csp/sentinel/Tracer.java
Lines 144 to 158 in 5ac112e
/**
* Set exceptions to ignore. if not set, all Exception except for {@link BlockException} will be traced.
* <p>
* Note that if both {@link #setExceptionsToTrace(Class[])} and this method is set,
* the ExceptionsToIgnore will be of higher precedence.
* </p>
*
* @param ignoreClasses the list of exception classes to ignore.
* @since 1.6.1
*/
@SafeVarargs
public static void setExceptionsToIgnore(Class<? extends Throwable>... ignoreClasses) {
checkNotNull(ignoreClasses);
Tracer.ignoreClasses = ignoreClasses;
}
原回答者GitHub用户sczyh30
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。