MINOR: stats: report the load balancing algorithm in CSV output
It was already present in the HTML output, let's add it to CSV now,
but only when SHLGNDS is set.
diff --git a/doc/management.txt b/doc/management.txt
index 83c7a34..5edfaab 100644
--- a/doc/management.txt
+++ b/doc/management.txt
@@ -1025,6 +1025,7 @@
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
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 504bba1..386c464 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -336,6 +336,7 @@
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 @@
[ST_F_ADDR] = "addr",
[ST_F_COOKIE] = "cookie",
[ST_F_MODE] = "mode",
+ [ST_F_ALGO] = "algo",
};
/* one line of stats */
@@ -3751,7 +3753,7 @@
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 @@
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 */