]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: add the estimated need of concurrent connections per server
authorWilly Tarreau <w@1wt.eu>
Mon, 29 Jun 2020 13:38:53 +0000 (15:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 29 Jun 2020 14:29:11 +0000 (16:29 +0200)
The max_used_conns value is used as an estimate of the needed number of
connections on a server to know how many to keep open. But this one is
not reported, making it hard to troubleshoot reuse issues. Let's export
it in the sessions/current column.

include/haproxy/stats-t.h
src/stats.c

index c5d68ddebd1f4d173249754b601a743b1dde6ed4..01c399d88100494b7d225ffa4ea63396ded75cc6 100644 (file)
@@ -426,6 +426,7 @@ enum stat_field {
        ST_F_IDLE_CONN_CUR,
        ST_F_SAFE_CONN_CUR,
        ST_F_USED_CONN_CUR,
+       ST_F_NEED_CONN_EST,
 
        /* must always be the last one */
        ST_F_TOTAL_FIELDS
index 351b79fa00e6e591e72d64bf8050f4a0af281ddd..1a453c39849a67f3ccb0091078fef4ae4a6eee23 100644 (file)
@@ -247,6 +247,7 @@ const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = {
        [ST_F_IDLE_CONN_CUR]                 = { .name = "idle_conn_cur",               .desc = "Current number of unsafe idle connections"},
        [ST_F_SAFE_CONN_CUR]                 = { .name = "safe_conn_cur",               .desc = "Current number of safe idle connections"},
        [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"},
 };
 
 /* one line of info */
@@ -997,6 +998,7 @@ static int stats_dump_fields_html(struct buffer *out,
                                "<tr><th>Current idle connections:</th><td>%s</td></tr>"
                                "<tr><th>- unsafe:</th><td>%s</td></tr>"
                                "<tr><th>- safe:</th><td>%s</td></tr>"
+                               "<tr><th>Estimated need of connections:</th><td>%s</td></tr>"
                                "<tr><th>Active connections limit:</th><td>%s</td></tr>"
                                "<tr><th>Idle connections limit:</th><td>%s</td></tr>"
                                "</table></div></u>"
@@ -1010,6 +1012,7 @@ static int stats_dump_fields_html(struct buffer *out,
                              U2H(stats[ST_F_SRV_ICUR].u.u32),
                              U2H(stats[ST_F_IDLE_CONN_CUR].u.u32),
                              U2H(stats[ST_F_SAFE_CONN_CUR].u.u32),
+                             U2H(stats[ST_F_NEED_CONN_EST].u.u32),
 
                                LIM2A(stats[ST_F_SLIM].u.u32, "-"),
                                stats[ST_F_SRV_ILIM].type ? U2H(stats[ST_F_SRV_ILIM].u.u32) : "-",
@@ -1703,6 +1706,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
        stats[ST_F_IDLE_CONN_CUR] = mkf_u32(0, sv->curr_idle_nb);
        stats[ST_F_SAFE_CONN_CUR] = mkf_u32(0, sv->curr_safe_nb);
        stats[ST_F_USED_CONN_CUR] = mkf_u32(0, sv->curr_used_conns);
+       stats[ST_F_NEED_CONN_EST] = mkf_u32(0, sv->est_need_conns);
 
        /* status */
        fld_status = chunk_newstr(out);