]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Improve request stats text.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Apr 2017 10:02:17 +0000 (13:02 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Apr 2017 10:29:51 +0000 (13:29 +0300)
It's important to know how long the request was in queue before it was sent.

Also the "n attempts in m secs" makes more sense if it was counting only the
time after the initial request was sent, not including the queuing time.

If there is more than 1 attempt, log separately how long all the attempts
were waited on vs. how long the last attempt took.

src/lib-http/http-client-request.c

index 9e927637f1ca76d81398f126d55056c433cc92d6..5ebfc3500eebe083c1dee8b48cdfaeaed368502b 100644 (file)
@@ -650,17 +650,22 @@ void http_client_request_append_stats_text(struct http_client_request *req,
 
        http_client_request_get_stats(req, &stats);
 
-       if (stats.last_sent_msecs > 0) {
-               str_printfa(str, "sent %u.%03u secs ago",
-                           stats.last_sent_msecs/1000, stats.last_sent_msecs%1000);
-       } else {
-               str_append(str, "not yet sent");
-       }
-       if (stats.attempts > 0) {
+       str_printfa(str, "queued %u.%03u secs ago",
+                   stats.total_msecs/1000, stats.total_msecs%1000);
+
+       if (stats.first_sent_msecs == 0)
+               str_append(str, ", not yet sent");
+       else {
                str_printfa(str, ", %u attempts in %u.%03u secs",
                            stats.attempts + 1,
-                           stats.total_msecs/1000, stats.total_msecs%1000);
+                           stats.first_sent_msecs/1000, stats.first_sent_msecs%1000);
+               if (stats.attempts > 0) {
+                       str_printfa(str, ", %u.%03u in last attempt",
+                                   stats.last_sent_msecs/1000,
+                                   stats.last_sent_msecs%1000);
+               }
        }
+
        if (stats.http_ioloop_msecs > 0) {
                str_printfa(str, ", %u.%03u in http ioloop",
                            stats.http_ioloop_msecs/1000,