]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: report the load balancing algorithm in CSV output
authorWilly Tarreau <w@1wt.eu>
Mon, 11 Jan 2016 13:48:36 +0000 (14:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 Mar 2016 16:08:05 +0000 (17:08 +0100)
It was already present in the HTML output, let's add it to CSV now,
but only when SHLGNDS is set.

doc/management.txt
src/dumpstats.c

index 83c7a34397b3d1d6b7dfe8ec91a6166e30e26e8a..5edfaab9c0f53cce02f8ec6a560dc8e691c9080c 100644 (file)
@@ -1025,6 +1025,7 @@ S (Servers).
  73. addr [L..S]: address:port or "unix". IPv6 has brackets around the address.
  74: cookie [..BS]: server's cookie value or backend's cookie name
  75: mode [LFBS]: proxy mode (tcp, http, health, unknown)
+ 76: algo [..B.]: load balancing algorithm
 
 
 9.2. Unix Socket commands
index 504bba1de8ab77c42ce36b1718b2229033f0a0ce..386c464409c0e134bf9d48caadddfddf724408e1 100644 (file)
@@ -336,6 +336,7 @@ enum stat_field {
        ST_F_ADDR,
        ST_F_COOKIE,
        ST_F_MODE,
+       ST_F_ALGO,
 
        /* must always be the last one */
        ST_F_TOTAL_FIELDS
@@ -422,6 +423,7 @@ const char *stat_field_names[ST_F_TOTAL_FIELDS] = {
        [ST_F_ADDR]           = "addr",
        [ST_F_COOKIE]         = "cookie",
        [ST_F_MODE]           = "mode",
+       [ST_F_ALGO]           = "algo",
 };
 
 /* one line of stats */
@@ -3751,7 +3753,7 @@ static int stats_dump_fields_html(const struct field *stats, int admin, unsigned
                if (flags & ST_SHLGNDS) {
                        /* balancing */
                        chunk_appendf(&trash, "<div class=tips>balancing: %s",
-                                     backend_lb_algo_str(px->lbprm.algo & BE_LB_ALGO));
+                                     field_str(stats, ST_F_ALGO));
 
                        /* cookie */
                        if (stats[ST_F_COOKIE].type) {
@@ -4346,9 +4348,11 @@ static int stats_dump_be_stats(struct stream_interface *si, struct proxy *px, in
        stats[ST_F_TYPE]     = mkf_u32(FO_CONFIG|FS_SERVICE, STATS_TYPE_BE);
        stats[ST_F_RATE]     = mkf_u32(0, read_freq_ctr(&px->be_sess_per_sec));
        stats[ST_F_RATE_MAX] = mkf_u32(0, px->be_counters.sps_max);
+
        if (flags & ST_SHLGNDS) {
                if (px->cookie_name)
                        stats[ST_F_COOKIE] = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, px->cookie_name);
+               stats[ST_F_ALGO] = mkf_str(FO_CONFIG|FS_SERVICE, backend_lb_algo_str(px->lbprm.algo & BE_LB_ALGO));
        }
 
        /* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */