From: Timo Sirainen Date: Mon, 10 Apr 2017 10:02:17 +0000 (+0300) Subject: lib-http: Improve request stats text. X-Git-Tag: 2.2.29~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f6033ce56919a69b17a6571a796d6892b6a26a3;p=thirdparty%2Fdovecot%2Fcore.git lib-http: Improve request stats text. 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. --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index 9e927637f1..5ebfc3500e 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -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,