]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: report the listener's protocol along with the address in stats
authorWilly Tarreau <w@1wt.eu>
Thu, 11 May 2023 12:49:43 +0000 (14:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 May 2023 12:52:56 +0000 (14:52 +0200)
When "optioon socket-stats" is used in a frontend, its listeners have
their own stats and will appear in the stats page. And when the stats
page has "stats show-legends", then a tooltip appears on each such
socket with ip:port and ID. The problem is that since QUIC arrived, it
was not possible to distinguish the TCP listeners from the QUIC ones
because no protocol indication was mentioned. Now we add a "proto"
legend there with the protocol name, so we can see "tcp4" or "quic6"
and figure how the socket is bound.

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

index d185d85babc6b058f1a0ccf69c04d782bdfe61ce..663641615b6aaf9d04f85916fd7ffe44254d3cfe 100644 (file)
@@ -469,6 +469,7 @@ enum stat_field {
        ST_F_H1REQ,
        ST_F_H2REQ,
        ST_F_H3REQ,
+       ST_F_PROTO,
 
        /* must always be the last one */
        ST_F_TOTAL_FIELDS
index cc3668f55c8836a29f88f3b9c0a3eddef4f1dcad..c06fce3d30ccfe60b0c8d03245df3e06b8e63977 100644 (file)
@@ -1086,6 +1086,8 @@ static int stats_dump_fields_html(struct buffer *out,
                        else if (*field_str(stats, ST_F_ADDR))
                                chunk_appendf(out, "%s, ", field_str(stats, ST_F_ADDR));
 
+                       chunk_appendf(out, "proto=%s, ", field_str(stats, ST_F_PROTO));
+
                        /* id */
                        chunk_appendf(out, "id: %d</div>", stats[ST_F_SID].u.u32);
                }
@@ -2078,6 +2080,9 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
                                        }
                                }
                                break;
+                       case ST_F_PROTO:
+                               metric = mkf_str(FO_STATUS, l->rx.proto->name);
+                               break;
                        default:
                                /* not used for listen. If a specific metric
                                 * is requested, return an error. Otherwise continue.