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 2018/10/11 10:52:10 UTC

[GitHub] liubao68 closed pull request #945: [SCB-954] improve consumer stage time record when failed

liubao68 closed pull request #945: [SCB-954] improve consumer stage time record when failed
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/945
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/java/org/apache/servicecomb/core/invocation/InvocationStageTrace.java b/core/src/main/java/org/apache/servicecomb/core/invocation/InvocationStageTrace.java
index 193644cc5..bf7879541 100644
--- a/core/src/main/java/org/apache/servicecomb/core/invocation/InvocationStageTrace.java
+++ b/core/src/main/java/org/apache/servicecomb/core/invocation/InvocationStageTrace.java
@@ -27,30 +27,33 @@
  *     start/finish/startBusiness/finishBusiness
  *
  * for consumer:
- *   start -> startHandlersRequest -> startClientFiltersRequest -> startSend -> finishGetConnection -> finishWriteToBuffer
- *                                                                                                             /
- *                                                                                                           \/
- *   finish <- finishHandlersResponse <- finishClientFiltersResponse <- startClientFiltersResponse <- finishReceiveResponse
+ *         (prepare)                      (handlerReq)                                       (clientFilterReq)
+ *   start --------> startHandlersRequest -----------> startClientFiltersRequest --------------------------------------
+ *                                                        <----------------(sendRequest)----------------->            |
+ *                        (receiveResponse)              (writeToBuffer)                   (getConnection)            |
+ *    ---finishReceiveResponse <----- finishWriteToBuffer <----------- finishGetConnection <-------------- startSend <-
+ *   | (wakeConsumer)            (clientFiltersResponse)               (handlersResponse)
+ *   |-----> startClientFiltersResponse -------> finishClientFiltersResponse -------> finishHandlersResponse --> finish
  *
  * for producer:
- *     ? ->
- *   start -> startSchedule -> startExecution -> startServerFiltersRequest -> startHandlersRequest -> startBusinessMethod-----
- *                                                                                                                           |
- *                                                                                                                          \/
- *   finish <- finishWriteToBuffer <- finishServerFiltersResponse <- finishHandlersResponse <- finishBusiness <- finishBusinessMethod
+ *       (prepare)       (threadPoolQueue)                                (serverFiltersRequest)
+ *   start ----> startSchedule -----> startExecution -> startServerFiltersRequest -------> startHandlersRequest -------
+ *                          (handlersResponse)          <-------------(business)------------->      (handlersRequest) |
+ *   -----finishHandlersResponse <------ finishBusiness <------- finishBusinessMethod <------ startBusinessMethod------
+ *   | (serverFiltersResponse)     (sendResponse)
+ *   |---> finishServerFiltersResponse ------> finish
+ *
  * for edge:
- *   ? ->
- *   start -> startSchedule -> startExecution -> startServerFiltersRequest --
- *                                                                         /
- *      ------------------------------------------------------------------
- *    /
- *   ---> startHandlersRequest -> startClientFiltersRequest -> startSend -> finishGetConnection -> finishWriteToBuffer
- *                                                                                                         /
- *                                                                                                       \/
- *         finishHandlersResponse <- finishClientFiltersResponse <- startClientFiltersResponse <- finishReceiveResponse
- *                        |
- *                       \/
- *  finish <- finishServerFiltersResponse
+ *      (prepare)         (threadPoolQueue)                               (serverFiltersRequest)
+ *   start ----> startSchedule -----> startExecution -> startServerFiltersRequest ----> startHandlersRequest ----------
+ *                           <----------(sendRequest)---------->                                                      |
+ *                       (writeToBuffer)              (getConnection)  (clientFilterReq)            (handlersRequest) |
+ *   --- finishWriteToBuffer <------ finishGetConnection <------ startSend <------ startClientFiltersRequest <---------
+ *   | (receiveResponse)     (wakeConsumer)                 (clientFiltersResponse)
+ *   ---> finishReceiveResponse ------> startClientFiltersResponse ------> finishClientFiltersResponse ----------------
+ *                                   (sendResponse)                  (serverFiltersResponse)       (handlersResponse) |
+ *                              finish <------ finishServerFiltersResponse <------ finishHandlersResponse <------------
+ *
  * </pre>
  */
 public class InvocationStageTrace {
diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
index 7ebc70538..1e5b55515 100644
--- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
+++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/RestClientInvocation.java
@@ -233,6 +233,15 @@ protected void fail(Throwable e) {
       stageTrace.finishWriteToBuffer(httpSocketMetric.getRequestEndTime());
     }
 
+    // even failed and did not received response, still set time for it
+    // that will help to know the real timeout time
+    if (stageTrace.getFinishReceiveResponse() == 0) {
+      stageTrace.finishReceiveResponse();
+    }
+    if (stageTrace.getStartClientFiltersResponse() == 0) {
+      stageTrace.startClientFiltersResponse();
+    }
+
     stageTrace.finishClientFiltersResponse();
     asyncResp.fail(invocation.getInvocationType(), e);
   }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services