add limit rate filter debug log. (#436)

Co-authored-by: 许路路 <499319126@qq.com>
pull/439/head
Haotian Zhang 2 years ago committed by GitHub
parent 6dc1b246c8
commit 4b880a6dbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
# Change Log
---
- [Bugfix: optimize ratelimit actuator](https://github.com/Tencent/spring-cloud-tencent/pull/419)
- [Bugfix: optimize ratelimit actuator](https://github.com/Tencent/spring-cloud-tencent/pull/419)
- [Feature: add rate limit filter debug log](https://github.com/Tencent/spring-cloud-tencent/pull/436)

@ -114,6 +114,7 @@ public class QuotaCheckReactiveFilter implements WebFilter, Ordered {
}
// Unirate
if (quotaResponse.getCode() == QuotaResultCode.QuotaResultOk && quotaResponse.getWaitMs() > 0) {
LOG.debug("The request of [{}] will waiting for {}ms.", path, quotaResponse.getWaitMs());
return Mono.delay(Duration.ofMillis(quotaResponse.getWaitMs())).flatMap(e -> chain.filter(exchange));
}
}

@ -110,7 +110,7 @@ public class QuotaCheckServletFilter extends OncePerRequestFilter {
}
// Unirate
if (quotaResponse.getCode() == QuotaResultCode.QuotaResultOk && quotaResponse.getWaitMs() > 0) {
LOG.debug("Unirate sleep for {}ms.", quotaResponse.getWaitMs());
LOG.debug("The request of [{}] will waiting for {}ms.", request.getRequestURI(), quotaResponse.getWaitMs());
Thread.sleep(quotaResponse.getWaitMs());
}
@ -150,8 +150,7 @@ public class QuotaCheckServletFilter extends OncePerRequestFilter {
return labelResolver.resolve(request);
}
catch (Throwable e) {
LOG.error("resolve custom label failed. resolver = {}",
labelResolver.getClass().getName(), e);
LOG.error("resolve custom label failed. resolver = {}", labelResolver.getClass().getName(), e);
}
}
return Collections.emptyMap();

Loading…
Cancel
Save