Skip to content

Commit

Permalink
Fix firstResponseLatency metric #740
Browse files Browse the repository at this point in the history
Swapped calculation to subtract sent time from first response (response is usually later than sent).

Original pull request: #741.
  • Loading branch information
nickvollmar authored and mp911de committed Mar 24, 2018
1 parent b95a9f5 commit a66f5be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/io/lettuce/core/protocol/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a66f5be

Please sign in to comment.