ON_ERROR signal and 5xx http status are classified as errors #235

This commit is contained in:
Francis Dong
2021-06-25 11:40:02 +08:00
committed by linwaiwai
parent 63eb0b52e7
commit 7ef813aad5

View File

@@ -151,10 +151,10 @@ public class FlowControlFilter extends FizzWebFilter {
long start = System.currentTimeMillis();
return chain.filter(exchange).doFinally(s -> {
long rt = System.currentTimeMillis() - start;
if (s == SignalType.ON_COMPLETE) {
flowStat.addRequestRT(resourceConfigs, currentTimeSlot, rt, true);
} else {
if (s == SignalType.ON_ERROR || exchange.getResponse().getStatusCode().is5xxServerError()) {
flowStat.addRequestRT(resourceConfigs, currentTimeSlot, rt, false);
} else {
flowStat.addRequestRT(resourceConfigs, currentTimeSlot, rt, true);
}
});
}