-
fb64e2d2: fix: api fallback |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
There is no relationship between |
Beta Was this translation helpful? Give feedback.
-
What you said doesn't seem to match the code. Look at here: if (EngineManager.SCOPE_TRACKER.isExitedHttp() && EngineManager.isEnterHttp()) {
EngineManager.maintainRequestCount();
GraphBuilder.buildAndReport(request, response);
EngineManager.cleanThreadState();
long responseTimeEnd = System.currentTimeMillis()-responseTime.get()+8;
DongTaiLog.debug("url {} response time: {} ms",GraphBuilder.getURL(),responseTimeEnd);
if (RemoteConfigUtils.enableAutoFallback() && responseTimeEnd > RemoteConfigUtils.getApiResponseTime(null)){
RemoteConfigUtils.fallbackReqCount++;
DongTaiLog.warn("url {} response time: {} ms, greater than {} ms",GraphBuilder.getURL(),responseTimeEnd,RemoteConfigUtils.getApiResponseTime(null));
if (!"/".equals(GraphBuilder.getURL())){
ConfigMatcher.getInstance().FALLBACK_URL.add(GraphBuilder.getURI());
}
}
} The URI is added to FALLBACK_URL by public static Object cloneResponse(Object response, boolean isJakarta) {
try {
if (response == null) {
return null;
}
if (ConfigMatcher.getInstance().disableExtension((String) REQUEST_META.get().get("requestURI"))) {
return response;
}
if (ConfigMatcher.getInstance().getBlackUrl(REQUEST_META.get())) {
return response;
}
if (cloneResponseMethod == null) {
loadCloneResponseMethod();
}
return cloneResponseMethod.invoke(null, response, isJakarta);
} catch (IllegalAccessException e) {
return response;
} catch (InvocationTargetException e) {
return response;
} finally {
REQUEST_META.remove();
}
}
|
Beta Was this translation helpful? Give feedback.
-
My fault, it's no big deal if some packaging is missed |
Beta Was this translation helpful? Give feedback.
-
As mentioned above, this is only used for circuit breaker, for skipping some requests with long response times, affecting at most a fraction of the requests collected, and may replace this dynamic blacklist in the future by remote configuration |
Beta Was this translation helpful? Give feedback.
There is no relationship between
URL
/URI
inGraphBuilder
andHttpServletRequest/HttpServletResponse
, only when the circuit breaker will be used to, the circuit breaker will be re-implemented and will not use this again