Selaa lähdekoodia

Enhance logging for timed out transport requests (#64433)

Apropos of nothing—

The current logging:

Received response for a request that has timed out, sent [2148898ms] ago, timed out [348859ms] ago

This just saves having to do the mental math for milliseconds and produces:

Received response for a request that has timed out, sent [35.8m/2148898ms] ago, timed out [5.8m/348859ms] ago
Lee Hinman 5 vuotta sitten
vanhempi
commit
c6b4b953f7

+ 6 - 2
server/src/main/java/org/elasticsearch/transport/TransportService.java

@@ -947,8 +947,12 @@ public class TransportService extends AbstractLifecycleComponent implements Repo
         TimeoutInfoHolder timeoutInfoHolder = timeoutInfoHandlers.remove(requestId);
         if (timeoutInfoHolder != null) {
             long time = threadPool.relativeTimeInMillis();
-            logger.warn("Received response for a request that has timed out, sent [{}ms] ago, timed out [{}ms] ago, " +
-                    "action [{}], node [{}], id [{}]", time - timeoutInfoHolder.sentTime(), time - timeoutInfoHolder.timeoutTime(),
+            long sentMs = time - timeoutInfoHolder.sentTime();
+            long timedOutMs = time - timeoutInfoHolder.timeoutTime();
+            logger.warn("Received response for a request that has timed out, sent [{}/{}ms] ago, timed out [{}/{}ms] ago, " +
+                    "action [{}], node [{}], id [{}]",
+                TimeValue.timeValueMillis(sentMs), sentMs,
+                TimeValue.timeValueMillis(timedOutMs), timedOutMs,
                 timeoutInfoHolder.action(), timeoutInfoHolder.node(), requestId);
             action = timeoutInfoHolder.action();
             sourceNode = timeoutInfoHolder.node();