]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add two new stats counters for sendto() errors
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 4 Aug 2022 10:00:00 +0000 (12:00 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 5 Aug 2022 13:27:14 +0000 (15:27 +0200)
Add "quic_socket_full" new stats counter for sendto() errors with EAGAIN as errno.
and "quic_sendto_err" counter for any other error.

include/haproxy/quic_stats-t.h
include/haproxy/xprt_quic-t.h
src/quic_sock.c
src/quic_stats.c
src/xprt_quic.c

index 4b76b931cf5dec32beded979bb2a36544e381bd0..8a682285c7a9c30b01937babaa421de0a3efe4f3 100644 (file)
@@ -12,6 +12,8 @@ enum {
        QUIC_ST_DROPPED_PACKET,
        QUIC_ST_DROPPED_PACKET_BUFOVERRUN,
        QUIC_ST_DROPPED_PARSING,
+       QUIC_ST_SOCKET_FULL,
+       QUIC_ST_SENDTO_ERR,
        QUIC_ST_LOST_PACKET,
        QUIC_ST_TOO_SHORT_INITIAL_DGRAM,
        QUIC_ST_RETRY_SENT,
@@ -52,6 +54,8 @@ struct quic_counters {
        long long dropped_pkt;       /* total number of dropped packets */
        long long dropped_pkt_bufoverrun;/* total number of dropped packets because of buffer overrun */
        long long dropped_parsing;   /* total number of dropped packets upon parsing errors */
+       long long socket_full;       /* total number of EAGAIN errors on sendto() calls */
+       long long sendto_err;        /* total number of errors on sendto() calls, EAGAIN excepted */
        long long lost_pkt;          /* total number of lost packets */
        long long too_short_initial_dgram; /* total number of too short datagrams with Initial packets */
        long long retry_sent;        /* total number of Retry sent */
index 7ef6122a6deb200cc5a407b68bfdeadbdd61b15f..f1063ba8a20072219b017d18b7e9ccdfcec4366d 100644 (file)
@@ -703,7 +703,6 @@ struct quic_conn {
        unsigned int nb_pkt_since_cc;
 
        const struct qcc_app_ops *app_ops;
-       unsigned int sendto_err;
        struct quic_counters *prx_counters;
 };
 
index 12d94b71bf8198e1b04e93ef4d6b6b9c43b731e4..b50c22803b2914e0634f9ee0b68b84dadea25a8c 100644 (file)
@@ -393,8 +393,14 @@ size_t qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t sz,
        }
        else if (ret == 0 || errno == EAGAIN || errno == EWOULDBLOCK ||
                 errno == ENOTCONN || errno == EINPROGRESS || errno == EBADF) {
+               struct proxy *prx = qc->li->bind_conf->frontend;
+               struct quic_counters *prx_counters =
+                       EXTRA_COUNTERS_GET(prx->extra_counters_fe, &quic_stats_module);
                /* TODO must be handle properly. It is justified for UDP ? */
-               qc->sendto_err++;
+               if (errno == EAGAIN || errno == EWOULDBLOCK)
+                       HA_ATOMIC_INC(&prx_counters->socket_full);
+               else
+                       HA_ATOMIC_INC(&prx_counters->sendto_err);
        }
        else if (errno) {
                /* TODO unlisted errno : handle it explicitely. */
index c34d873342fa20705e40323a8acb63948ff8c45f..529e245da8999934694cb5fabf0abdf4ea9a4e55 100644 (file)
@@ -8,6 +8,10 @@ static struct name_desc quic_stats[] = {
                                          .desc = "Total number of dropped packets because of buffer overrun" },
        [QUIC_ST_DROPPED_PARSING]     = { .name = "quic_dropped_parsing_pkt",
                                          .desc = "Total number of dropped packets upon parsing error" },
+       [QUIC_ST_SOCKET_FULL]         = { .name = "quic_socket_full",
+                                         .desc = "Total number of EAGAIN error on sendto() calls" },
+       [QUIC_ST_SENDTO_ERR]          = { .name = "quic_sendto_err",
+                                         .desc = "Total number of error on sendto() calls, EAGAIN excepted" },
        [QUIC_ST_LOST_PACKET]         = { .name = "quic_lost_pkt",
                                          .desc = "Total number of lost sent packets" },
        [QUIC_ST_TOO_SHORT_INITIAL_DGRAM] = { .name = "quic_too_short_dgram",
@@ -83,6 +87,8 @@ static void quic_fill_stats(void *data, struct field *stats)
        stats[QUIC_ST_DROPPED_PACKET]    = mkf_u64(FN_COUNTER, counters->dropped_pkt);
        stats[QUIC_ST_DROPPED_PACKET_BUFOVERRUN] = mkf_u64(FN_COUNTER, counters->dropped_pkt_bufoverrun);
        stats[QUIC_ST_DROPPED_PARSING]   = mkf_u64(FN_COUNTER, counters->dropped_parsing);
+       stats[QUIC_ST_SOCKET_FULL]       = mkf_u64(FN_COUNTER, counters->socket_full);
+       stats[QUIC_ST_SENDTO_ERR]        = mkf_u64(FN_COUNTER, counters->sendto_err);
        stats[QUIC_ST_LOST_PACKET]       = mkf_u64(FN_COUNTER, counters->lost_pkt);
        stats[QUIC_ST_TOO_SHORT_INITIAL_DGRAM] = mkf_u64(FN_COUNTER, counters->too_short_initial_dgram);
        stats[QUIC_ST_RETRY_SENT]        = mkf_u64(FN_COUNTER, counters->retry_sent);
index 4046b670c67d30ad73dabde78e4f52b39914b822..c193c5f750bb707cc7b1208865e680cb277c1005 100644 (file)
@@ -598,7 +598,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                if (mask & QUIC_EV_CONN_SPPKTS) {
                        const struct quic_tx_packet *pkt = a2;
 
-                       chunk_appendf(&trace_buf, " err=%u cwnd=%llu ppif=%llu pif=%llu", qc->sendto_err,
+                       chunk_appendf(&trace_buf, " cwnd=%llu ppif=%llu pif=%llu",
                                     (unsigned long long)qc->path->cwnd,
                                     (unsigned long long)qc->path->prep_in_flight,
                                     (unsigned long long)qc->path->in_flight);
@@ -4397,7 +4397,6 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
 
        qc->streams_by_id = EB_ROOT_UNIQUE;
        qc->stream_buf_count = 0;
-       qc->sendto_err = 0;
        memcpy(&qc->peer_addr, saddr, sizeof qc->peer_addr);
 
        if (server && !qc_lstnr_params_init(qc, &l->bind_conf->quic_params,