haproxy_backend_agg_server_check_status currently aggregates
haproxy_server_status instead of haproxy_server_check_status.
We deprecate this and create a new one,
haproxy_backend_agg_server_status to clarify what it really
does.
---
 addons/promex/service-prometheus.c | 4 +++-
 include/haproxy/stats-t.h          | 1 +
 src/stats.c                        | 6 ++++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/addons/promex/service-prometheus.c 
b/addons/promex/service-prometheus.c
index b54695c17..9330a860c 100644
--- a/addons/promex/service-prometheus.c
+++ b/addons/promex/service-prometheus.c
@@ -302,6 +302,7 @@ const struct promex_metric 
promex_st_metrics[ST_F_TOTAL_FIELDS] = {
        [ST_F_NEED_CONN_EST]        = { .n = IST("need_connections_current"),   
      .type = PROMEX_MT_GAUGE,    .flags = (                                    
                                   PROMEX_FL_SRV_METRIC) },
        [ST_F_UWEIGHT]              = { .n = IST("uweight"),                    
      .type = PROMEX_MT_GAUGE,    .flags = (                                    
           PROMEX_FL_BACK_METRIC | PROMEX_FL_SRV_METRIC) },
        [ST_F_AGG_SRV_CHECK_STATUS] = { .n = IST("agg_server_check_status"),    
      .type = PROMEX_MT_GAUGE,    .flags = (                                    
           PROMEX_FL_BACK_METRIC                       ) },
+       [ST_F_AGG_SRV_STATUS ]      = { .n = IST("agg_server_status"),          
      .type = PROMEX_MT_GAUGE,    .flags = (                                    
           PROMEX_FL_BACK_METRIC                       ) },
 };
 
 /* Description of overridden stats fields */
@@ -833,7 +834,8 @@ static int promex_dump_back_metrics(struct appctx *appctx, 
struct htx *htx)
                                return -1;
 
                        switch (ctx->field_num) {
-                               case ST_F_AGG_SRV_CHECK_STATUS:
+                               case ST_F_AGG_SRV_CHECK_STATUS: // DEPRECATED
+                               case ST_F_AGG_SRV_STATUS:
                                        if (!px->srv)
                                                goto next_px;
                                        sv = px->srv;
diff --git a/include/haproxy/stats-t.h b/include/haproxy/stats-t.h
index efa0ac383..253fb6c48 100644
--- a/include/haproxy/stats-t.h
+++ b/include/haproxy/stats-t.h
@@ -455,6 +455,7 @@ enum stat_field {
        ST_F_USED_CONN_CUR,
        ST_F_NEED_CONN_EST,
        ST_F_UWEIGHT,
+       ST_F_AGG_SRV_STATUS,
        ST_F_AGG_SRV_CHECK_STATUS,
 
        /* must always be the last one */
diff --git a/src/stats.c b/src/stats.c
index 8ed5a7133..c15bc27ec 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -259,7 +259,8 @@ const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = {
        [ST_F_USED_CONN_CUR]                 = { .name = "used_conn_cur",       
        .desc = "Current number of connections in use"},
        [ST_F_NEED_CONN_EST]                 = { .name = "need_conn_est",       
        .desc = "Estimated needed number of connections"},
        [ST_F_UWEIGHT]                       = { .name = "uweight",             
        .desc = "Server's user weight, or sum of active servers' user weights 
for a backend" },
-       [ST_F_AGG_SRV_CHECK_STATUS]          = { .name = 
"agg_server_check_status",     .desc = "Backend's aggregated gauge of servers' 
state check status" },
+       [ST_F_AGG_SRV_CHECK_STATUS]          = { .name = 
"agg_server_check_status",     .desc = "[DEPRECATED] Backend's aggregated gauge 
of servers' status" },
+       [ST_F_AGG_SRV_STATUS ]               = { .name = "agg_server_status",   
        .desc = "Backend's aggregated gauge of servers' status" },
 };
 
 /* one line of info */
@@ -2673,7 +2674,8 @@ int stats_fill_be_stats(struct proxy *px, int flags, 
struct field *stats, int le
                                        chunk_appendf(out, " (%d/%d)", nbup, 
nbsrv);
                                metric = mkf_str(FO_STATUS, fld);
                                break;
-                       case ST_F_AGG_SRV_CHECK_STATUS:
+                       case ST_F_AGG_SRV_CHECK_STATUS:   // DEPRECATED
+                       case ST_F_AGG_SRV_STATUS:
                                metric = mkf_u32(FN_GAUGE, 0);
                                break;
                        case ST_F_WEIGHT:
-- 
2.25.1

Reply via email to