7311: Modify PeerTaskExecutor metric to include response time from peer

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7628/head
Matilda Clerke 2 months ago
parent 96c803030c
commit b0f2ed024f
  1. 11
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java

@ -50,7 +50,7 @@ public class PeerTaskExecutor {
metricsSystem.createLabelledTimer(
BesuMetricCategory.PEERS,
"PeerTaskExecutor:RequestTime",
"Time taken to send a request",
"Time taken to send a request and receive a response",
"className");
}
@ -95,13 +95,14 @@ public class PeerTaskExecutor {
do {
try {
MessageData responseMessageData;
T result ;
try (final OperationTimer.TimingContext timingContext =
requestTimer.labels(peerTask.getClass().getSimpleName()).startTimer()) {
responseMessageData =
requestSender.sendRequest(peerTask.getSubProtocol(), requestMessageData, peer);
MessageData responseMessageData =
requestSender.sendRequest(peerTask.getSubProtocol(), requestMessageData, peer);
result = peerTask.parseResponse(responseMessageData);
}
T result = peerTask.parseResponse(responseMessageData);
peer.recordUsefulResponse();
executorResult = new PeerTaskExecutorResult<>(result, PeerTaskExecutorResponseCode.SUCCESS);

Loading…
Cancel
Save