]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: peers: adds counters on show peers about tasks calls.
authorEmeric Brun <ebrun@haproxy.com>
Thu, 18 Apr 2019 09:39:43 +0000 (11:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 18 Apr 2019 16:24:25 +0000 (18:24 +0200)
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.

doc/management.txt
src/peers.c

index cc5ecb9805509f601c98a480e3a322c630214188..952a25f3df0bab6fff64a50136be4a61dfdcc9d4 100644 (file)
@@ -2099,7 +2099,7 @@ show peers [<peers section>]
 
   $ echo "show peers" | socat - /tmp/hostA
   0x55deb0224320: [15/Apr/2019:11:28:01] id=sharedlb state=0 flags=0x3 \
-    resync_timeout=<PAST>
+    resync_timeout=<PAST> 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 [<peers section>]
         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 [<peers section>]
 
   $ echo "show peers" | socat - /tmp/hostB
   0x55871b5ab320: [15/Apr/2019:11:28:03] id=sharedlb state=0 flags=0x3 \
-    resync_timeout=<PAST>
+    resync_timeout=<PAST> 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 [<peers section>]
         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:
index 3f59b10ba7e15daf835b2564194b42435cea28be..1cb7fe9fe7ac5a5998c2ada7803a72a308932a99 100644 (file)
@@ -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) ? "<PAST>" :
                                             human_time(TICKS_TO_MS(peers->resync_timeout - now_ms),
-                                            TICKS_TO_MS(1000)) : "<NEVER>");
+                                            TICKS_TO_MS(1000)) : "<NEVER>",
+                     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)