From a66f5be0adb77d57b6f5f0a8254bae977e355285 Mon Sep 17 00:00:00 2001 From: Nick Vollmar Date: Fri, 23 Mar 2018 13:18:16 -0500 Subject: [PATCH] Fix firstResponseLatency metric #740 Swapped calculation to subtract sent time from first response (response is usually later than sent). Original pull request: #741. --- src/main/java/io/lettuce/core/protocol/CommandHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/lettuce/core/protocol/CommandHandler.java b/src/main/java/io/lettuce/core/protocol/CommandHandler.java index 34775ff807..459cc4ec36 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandHandler.java +++ b/src/main/java/io/lettuce/core/protocol/CommandHandler.java @@ -728,7 +728,7 @@ private void recordLatency(WithLatency withLatency, ProtocolKeyword commandType) if (withLatency != null && clientResources.commandLatencyCollector().isEnabled() && channel != null && remote() != null) { - long firstResponseLatency = withLatency.getSent() - withLatency.getFirstResponse(); + long firstResponseLatency = withLatency.getFirstResponse() - withLatency.getSent(); long completionLatency = nanoTime() - withLatency.getSent(); clientResources.commandLatencyCollector().recordCommandLatency(local(), remote(), commandType,