BUG/MINOR: stream/cli: report correct stream age in "show sess"
Since 2.4-dev2 with commit 15e525f49 ("MINOR: stream: Don't retrieve
anymore timing info from the mux csinfo"), we don't replace the
tv_accept (now accept_ts) anymore with the current request's, so that
it properly reflects the session's accept date and not the request's
date. However, since then we failed to update "show sess" to make use
of the request's timestamp instead of the session's timestamp, resulting
in fantasist values in the "age" field of "show sess" for the task.
Indeed, the session's age is displayed instead of the stream's, which
leads to great confusion when debugging, particularly when it comes to
multiplexed inter-proxy connections which are kept up forever.
Let's fix this now. This must be backported as far as 2.4. However,
for 2.7 and older, the field was named tv_request and was a timeval.
(cherry picked from commit ec76e0138b418ccb57da45f00e97f4cf2dcc2582)
[cf: ctx adjt]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 1842014aeb47b859987f26ae1983d086ba9300e6)
[cf: Adapted as expected]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 56bf84824dd0b30e08de57e139d97abee4c5c80d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 08e65620d31976261aed8839484be52a77cd715a)
[cf: ctx adjt]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/stream.c b/src/stream.c
index 735cbab..19e7a03 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -3203,7 +3203,7 @@
chunk_appendf(&trash,
" age=%s)\n",
- human_time(now.tv_sec - strm->logs.accept_date.tv_sec, 1));
+ human_time(tv_ms_elapsed(&strm->logs.tv_request, &now), TICKS_TO_MS(1000)));
if (strm->txn)
chunk_appendf(&trash,
@@ -3546,7 +3546,7 @@
chunk_appendf(&trash,
" ts=%02x epoch=%#x age=%s calls=%u rate=%u cpu=%llu lat=%llu",
curr_strm->task->state, curr_strm->stream_epoch,
- human_time(now.tv_sec - curr_strm->logs.tv_accept.tv_sec, 1),
+ human_time(tv_ms_elapsed(&curr_strm->logs.tv_request, &now), TICKS_TO_MS(1000)),
curr_strm->task->calls, read_freq_ctr(&curr_strm->call_rate),
(unsigned long long)curr_strm->task->cpu_time, (unsigned long long)curr_strm->task->lat_time);