From a9dc8e25878013ef6124af6cc9d7fddbf7ab5a38 Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Mon, 23 Feb 2026 11:25:53 -0500 Subject: [PATCH] MINOR: quic: add a new metric for ncbuf failures This counts the number of times we failed to add data to the ncbuf buffer because of the gap size limit. --- include/haproxy/quic_stats-t.h | 2 ++ src/mux_quic.c | 5 +++++ src/quic_stats.c | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/include/haproxy/quic_stats-t.h b/include/haproxy/quic_stats-t.h index 1ee626590..0a82d7cac 100644 --- a/include/haproxy/quic_stats-t.h +++ b/include/haproxy/quic_stats-t.h @@ -52,6 +52,7 @@ enum { QUIC_ST_STREAM_DATA_BLOCKED, QUIC_ST_STREAMS_BLOCKED_BIDI, QUIC_ST_STREAMS_BLOCKED_UNI, + QUIC_ST_NCBUF_GAP_LIMIT, QUIC_STATS_COUNT /* must be the last */ }; @@ -99,6 +100,7 @@ struct quic_counters { long long stream_data_blocked; /* total number of times STREAM_DATA_BLOCKED frame was received */ long long streams_blocked_bidi; /* total number of times STREAMS_BLOCKED_BIDI frame was received */ long long streams_blocked_uni; /* total number of times STREAMS_BLOCKED_UNI frame was received */ + long long ncbuf_gap_limit; /* total number of times we failed to add data to ncbuf due to gap size limit */ }; #endif /* USE_QUIC */ diff --git a/src/mux_quic.c b/src/mux_quic.c index 14afb4073..8da5d9a2c 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1875,6 +1875,8 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset, left = len; while (left) { struct qc_stream_rxbuf *buf; + struct proxy *px; + struct quic_counters *prx_counters; ncb_sz_t ncb_off; buf = qcs_get_rxbuf(qcs, offset, &len); @@ -1911,6 +1913,9 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset, case NCB_RET_GAP_SIZE: TRACE_DATA("cannot bufferize frame due to gap size limit", QMUX_EV_QCC_RECV|QMUX_EV_QCS_RECV, qcc->conn, qcs); + px = qcc->proxy; + prx_counters = EXTRA_COUNTERS_GET(px->extra_counters_fe, &quic_stats_module); + HA_ATOMIC_INC(&prx_counters->ncbuf_gap_limit); return 1; } diff --git a/src/quic_stats.c b/src/quic_stats.c index 9b6927f63..daee9456d 100644 --- a/src/quic_stats.c +++ b/src/quic_stats.c @@ -86,6 +86,8 @@ static struct stat_col quic_stats[] = { .desc = "Total number of received STREAMS_BLOCKED_BIDI frames" }, [QUIC_ST_STREAMS_BLOCKED_UNI] = { .name = "quic_streams_blocked_uni", .desc = "Total number of received STREAMS_BLOCKED_UNI frames" }, + [QUIC_ST_NCBUF_GAP_LIMIT] = { .name = "quic_ncbuf_gap_limit", + .desc = "Total number of failures to add to ncbuf because of gap size limit" }, }; struct quic_counters quic_counters; @@ -225,6 +227,9 @@ static int quic_fill_stats(void *data, struct field *stats, unsigned int *select case QUIC_ST_STREAMS_BLOCKED_UNI: metric = mkf_u64(FN_COUNTER, counters->streams_blocked_uni); break; + case QUIC_ST_NCBUF_GAP_LIMIT: + metric = mkf_u64(FN_COUNTER, counters->ncbuf_gap_limit); + break; default: /* not used for frontends. If a specific metric * is requested, return an error. Otherwise continue. -- 2.47.3