From b0f2ed024f59ce6b5846457a90a0beab3a6f2f67 Mon Sep 17 00:00:00 2001 From: Matilda Clerke Date: Thu, 26 Sep 2024 14:42:59 +1000 Subject: [PATCH] 7311: Modify PeerTaskExecutor metric to include response time from peer Signed-off-by: Matilda Clerke --- .../eth/manager/peertask/PeerTaskExecutor.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java index bd6445226b..76d5eb3839 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskExecutor.java +++ b/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);