You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/01/14 02:55:25 UTC

[GitHub] [servicecomb-java-chassis] develpoerX commented on a change in pull request #2695: [SCB-2369] improve fow controller logs and message

develpoerX commented on a change in pull request #2695:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2695#discussion_r784474897



##########
File path: handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/ConsumerQpsFlowControlHandler.java
##########
@@ -38,9 +47,20 @@ public void handle(Invocation invocation, AsyncResponse asyncResp) throws Except
     }
 
     QpsStrategy qpsStrategy = qpsControllerMgr.getOrCreate(invocation.getMicroserviceName(), invocation);
+    String name = qpsStrategy.name();
     if (qpsStrategy.isLimitNewRequest()) {
+      long tps = 0;
+      if ("FixedWindow".equals(name)) {
+        FixedWindowStrategy windowStrategy = (FixedWindowStrategy) qpsControllerMgr.getGlobalQpsStrategy();
+        tps = windowStrategy.getRequestCount().longValue() - windowStrategy.getLastRequestCount() + 1;
+      } else {
+        LeakyBucketStrategy bucketStrategy = (LeakyBucketStrategy) qpsControllerMgr.getGlobalQpsStrategy();
+        tps = bucketStrategy.getRequestCount().longValue();
+      }
       // return http status 429
-      CommonExceptionData errorData = new CommonExceptionData("rejected by qps flowcontrol");
+      LOGGER.warn("consumer qps flowcontrol open, qpsLimit is {} and tps is {}", qpsLimit, tps);

Review comment:
       Log logic basis? A warn level log is a generic error that does not affect business logic.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org