BUG/MINOR: stats: fixing stat shows disabled frontend status as 'OPEN'

This patch adresses the issue #1626.

Adding support for PR_FL_PAUSED flag in the function stats_fill_fe_stats().
The command 'show stat' now properly reports a disabled frontend
using "PAUSED" state label.

This patch depends on the following commits:
  - 7d00077fd5 "BUG/MEDIUM: proxy: ensure pause_proxy()
  and resume_proxy() own PROXY_LOCK".
  - 001328873c "MINOR: listener: small API change"
  - d46f437de6 "MINOR: proxy/listener: support for additional PAUSED state"

It should be backported to 2.6, 2.5 and 2.4

(cherry picked from commit cddec0aef526f2dc64bad5a83ad788d60c12639c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
Aurelien DARRAGON 2022-09-09 15:58:57 +02:00 committed by Christopher Faulet
parent 1f9d9f53f0
commit 8cbc474b39

View File

@ -1697,9 +1697,18 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
case ST_F_DSES:
metric = mkf_u64(FN_COUNTER, px->fe_counters.denied_sess);
break;
case ST_F_STATUS:
metric = mkf_str(FO_STATUS, (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED)) ? "STOP" : "OPEN");
case ST_F_STATUS: {
const char *state;
if (px->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
state = "STOP";
else if (px->flags & PR_FL_PAUSED)
state = "PAUSED";
else
state = "OPEN";
metric = mkf_str(FO_STATUS, state);
break;
}
case ST_F_PID:
metric = mkf_u32(FO_KEY, 1);
break;