wenbingshen opened a new pull request, #4179: URL: https://github.com/apache/bookkeeper/pull/4179
### Motivation After support group flush add response, we missing update add requests stats:  ```java @Override public void writeComplete(int rc, long ledgerId, long entryId, BookieId addr, Object ctx) { if (BookieProtocol.EOK == rc) { requestProcessor.getRequestStats().getAddEntryStats() .registerSuccessfulEvent(MathUtils.elapsedNanos(startTimeNanos), TimeUnit.NANOSECONDS); } else { requestProcessor.getRequestStats().getAddEntryStats() .registerFailedEvent(MathUtils.elapsedNanos(startTimeNanos), TimeUnit.NANOSECONDS); } sendWriteReqResponse(rc, ResponseBuilder.buildAddResponse(request), requestProcessor.getRequestStats().getAddRequestStats()); // this line has been removed after group flush add response requestHandler.prepareSendResponseV2(rc, request); requestProcessor.onAddRequestFinish(); request.recycle(); recycle(); } ``` ### Changes `AddRequestStats` describes that the metric is updated after the add entry request into the `writeThreadPool` and the response is sent to the client through the network. We need to update the `AddRequestStat` corresponding to the add request after the group flush add response. So here I record the time when the first request of Group Add into the queue of `writeThreadPool`, the number of successes and failures of Add, the statistics of the difference between the enqueuing time of all successful requests and the enqueuing time of the first request, and all failures. Statistics on the difference between the requested enqueuing time and the first requested enqueuing time. The count of `AddRequestStats` reflects the number of requests, so we need to call `registerEvent` for each individual `AddRequest` loop, and the time-consuming metric of each `AddRequest` uses the average time-consuming of the `Group Add ` as a whole. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
