alibaba / alibaba/Sentinel

sentinel zuul异常熔断不生效

Open
#3,011 0 comments 0 reactions 0 assignees View on GitHub
area/circuit-breaking area/gateway-flow-control kind/question
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

你好!我在项目中使用sentinel进行限流、熔断。网关使用的zuul,目前限流正常,超时熔断正常,但是错误熔断碰到了问题,问题是当下游服务无法正常响应结果导致的异常可以正常“错误熔断”,当下游服务可以正常响应结果但是结果是业务异常时无法正常“错误熔断”。当发生业务异常是我会通过如下关键代码记录异常到sentinel但貌似没有生效?

AsyncEntry entry = null;
try {
String resourceName = "sentinel_gateway_context$$route$$" + apiInfo.get(ApiInfoConstant.API_ID);
entry = SphU.asyncEntry(resourceName, 3, EntryType.IN);
Tracer.traceEntry(new Throwable(), entry);
entry.exit();
} catch (Exception e) {
log.error("sentinel记录异常失败!", e);
} finally {
if (entry != null) {
entry.exit();
}
}

我也尝试通过一下代码记录异常,但同样不生效:

Tracer.trace(new Throwable());

我需要怎么做才能主动记录异常到sentinel从而让“异常熔断”生效?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.