From: Emeric Brun Date: Thu, 18 Apr 2019 09:39:43 +0000 (+0200) Subject: MINOR: peers: adds counters on show peers about tasks calls. X-Git-Tag: v2.0-dev3~219 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bbec0fa340432944d64575e08fc41d034b5ffc9;p=thirdparty%2Fhaproxy.git MINOR: peers: adds counters on show peers about tasks calls. This patch adds a counter of calls on the orchestator peers task and a counter on the tasks linked to applet i/o handler for each peer. Those two counters are useful to detect if a peer sync is active or frozen. This patch is related to the commit: "MINOR: peers: Add a new command to the CLI for peers." and should be backported with it. --- diff --git a/doc/management.txt b/doc/management.txt index cc5ecb9805..952a25f3df 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -2099,7 +2099,7 @@ show peers [] $ echo "show peers" | socat - /tmp/hostA 0x55deb0224320: [15/Apr/2019:11:28:01] id=sharedlb state=0 flags=0x3 \ - resync_timeout= + resync_timeout= task_calls=45122 0x55deb022b540: id=hostC(remote) addr=127.0.0.12:10002 status=CONN \ reconnect=4s confirm=0 flags=0x0 @@ -2108,7 +2108,8 @@ show peers [] flags=0x0 0x55deb0227d70: id=hostB(remote) addr=127.0.0.11:10001 status=ESTA reconnect=2s confirm=0 - flags=0x20000200 appctx:0x55deb028fba0 st0=7 st1=0 state=EST + flags=0x20000200 appctx:0x55deb028fba0 st0=7 st1=0 task_calls=14456 \ + state=EST xprt=RAW src=127.0.0.1:37257 addr=127.0.0.10:10000 remote_table:0x55deb0224a10 id=stkt local_id=1 remote_id=1 last_local_table:0x55deb0224a10 id=stkt local_id=1 remote_id=1 @@ -2120,7 +2121,7 @@ show peers [] $ echo "show peers" | socat - /tmp/hostB 0x55871b5ab320: [15/Apr/2019:11:28:03] id=sharedlb state=0 flags=0x3 \ - resync_timeout= + resync_timeout= task_calls=3 0x55871b5b2540: id=hostC(remote) addr=127.0.0.12:10002 status=CONN \ reconnect=3s confirm=0 flags=0x0 @@ -2129,7 +2130,8 @@ show peers [] flags=0x0 0x55871b5aed70: id=hostA(remote) addr=127.0.0.10:10000 status=ESTA \ reconnect=2s confirm=0 - flags=0x20000200 appctx:0x7fa46800ee00 st0=7 st1=0 state=EST + flags=0x20000200 appctx:0x7fa46800ee00 st0=7 st1=0 task_calls=62356 \ + state=EST remote_table:0x55871b5ab960 id=stkt local_id=1 remote_id=1 last_local_table:0x55871b5ab960 id=stkt local_id=1 remote_id=1 shared tables: diff --git a/src/peers.c b/src/peers.c index 3f59b10ba7..1cb7fe9fe7 100644 --- a/src/peers.c +++ b/src/peers.c @@ -2762,7 +2762,7 @@ static int peers_dump_head(struct buffer *msg, struct stream_interface *si, stru struct tm tm; get_localtime(peers->last_change, &tm); - chunk_appendf(msg, "%p: [%02d/%s/%04d:%02d:%02d:%02d] id=%s state=%d flags=0x%x resync_timeout=%s\n", + chunk_appendf(msg, "%p: [%02d/%s/%04d:%02d:%02d:%02d] id=%s state=%d flags=0x%x resync_timeout=%s task_calls=%u\n", peers, tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec, @@ -2770,7 +2770,8 @@ static int peers_dump_head(struct buffer *msg, struct stream_interface *si, stru peers->resync_timeout ? tick_is_expired(peers->resync_timeout, now_ms) ? "" : human_time(TICKS_TO_MS(peers->resync_timeout - now_ms), - TICKS_TO_MS(1000)) : ""); + TICKS_TO_MS(1000)) : "", + peers->sync_task ? peers->sync_task->calls : 0); if (ci_putchk(si_ic(si), msg) == -1) { si_rx_room_blk(si); @@ -2812,7 +2813,8 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru if (!appctx) goto end; - chunk_appendf(&trash, " appctx:%p st0=%d st1=%d", appctx, appctx->st0, appctx->st1); + chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", appctx, appctx->st0, appctx->st1, + appctx->t ? appctx->t->calls : 0); peer_si = peer->appctx->owner; if (!peer_si)