MINOR: stats: add server revision id support
Make use of the new srv->rid value in stats.
Stat is referred as ST_F_SRID, it is now used in stats_fill_sv_stats
function in order to be included in csv and json stats dumps.
Moreover, "rid: $value" will be displayed next to server puid
in html stats page if "stats show-legend" is specified in the stats frontend.
(mouse hovering tooltip)
Depends on the following commit:
"MINOR: server: add srv->rid (revision id) value"
diff --git a/include/haproxy/stats-t.h b/include/haproxy/stats-t.h
index efa0ac3..1a7d3d1 100644
--- a/include/haproxy/stats-t.h
+++ b/include/haproxy/stats-t.h
@@ -456,6 +456,7 @@
ST_F_NEED_CONN_EST,
ST_F_UWEIGHT,
ST_F_AGG_SRV_CHECK_STATUS,
+ ST_F_SRID,
/* must always be the last one */
ST_F_TOTAL_FIELDS
diff --git a/src/stats.c b/src/stats.c
index 8ed5a71..5fd4d3f 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -260,6 +260,7 @@
[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_SRID] = { .name = "srid", .desc = "Server id revision, to prevent server id reuse mixups" },
};
/* one line of info */
@@ -1153,7 +1154,7 @@
chunk_appendf(out, "%s, ", field_str(stats, ST_F_ADDR));
/* id */
- chunk_appendf(out, "id: %d", stats[ST_F_SID].u.u32);
+ chunk_appendf(out, "id: %d, rid: %d", stats[ST_F_SID].u.u32, stats[ST_F_SRID].u.u32);
/* cookie */
if (stats[ST_F_COOKIE].type) {
@@ -2283,6 +2284,9 @@
case ST_F_SID:
metric = mkf_u32(FO_KEY|FS_SERVICE, sv->puid);
break;
+ case ST_F_SRID:
+ metric = mkf_u32(FN_COUNTER, sv->rid);
+ break;
case ST_F_THROTTLE:
if (sv->cur_state == SRV_ST_STARTING && !server_is_draining(sv))
metric = mkf_u32(FN_AVG, server_throttle_rate(sv));