First calculate elapsed time before logging error
since elapsed time shouldn't include time spent on logging the error.
Change-Id: I69bec59819d515c0456d6abc7a9933fffbedebcc
diff --git a/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AbstractHealthCheck.java b/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AbstractHealthCheck.java
index db0657e..0234e8f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AbstractHealthCheck.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AbstractHealthCheck.java
@@ -101,8 +101,8 @@
}
private StatusSummary handleError(long ts, Exception e, String message, Result result) {
- log.warn(message, e);
Long elapsed = System.currentTimeMillis() - ts;
+ log.warn(message, e);
StatusSummary checkStatusSummary =
new StatusSummary(result, ts, elapsed, Collections.emptyMap());
failureCounterMetric.increment();